gitweb.git
Merge branch 'fc/contrib-bzr-hg-fixes'Junio C Hamano Wed, 18 Sep 2013 18:45:49 +0000 (11:45 -0700)

Merge branch 'fc/contrib-bzr-hg-fixes'

* fc/contrib-bzr-hg-fixes:
contrib/remote-helpers: quote variable references in redirection targets
contrib/remote-helpers: style updates for test scripts
remote-hg: use notes to keep track of Hg revisions
remote-helpers: cleanup more global variables
remote-helpers: trivial style fixes
remote-hg: improve basic test
remote-hg: add missing &&s in the test
remote-hg: fix test
remote-bzr: make bzr branches configurable per-repo
remote-bzr: fix export of utf-8 authors

Merge branch 'js/add-i-mingw'Junio C Hamano Wed, 18 Sep 2013 18:45:06 +0000 (11:45 -0700)

Merge branch 'js/add-i-mingw'

The implementation of "add -i" has a crippling code to work around
ActiveState Perl limitation but it by mistake also triggered on Git
for Windows where MSYS perl is used.

* js/add-i-mingw:
add--interactive: fix external command invocation on Windows

Merge branch 'ks/p4-view-spec'Junio C Hamano Wed, 18 Sep 2013 18:44:50 +0000 (11:44 -0700)

Merge branch 'ks/p4-view-spec'

* ks/p4-view-spec:
git p4: implement view spec wildcards with "p4 where"
git p4 test: sanitize P4CHARSET

Merge branch 'jk/duplicate-objects-in-packs'Junio C Hamano Wed, 18 Sep 2013 18:43:47 +0000 (11:43 -0700)

Merge branch 'jk/duplicate-objects-in-packs'

A packfile that stores the same object more than once is broken and
will be rejected by "git index-pack" that is run when receiving data
over the wire.

* jk/duplicate-objects-in-packs:
t5308: check that index-pack --strict detects duplicate objects
test index-pack on packs with recoverable delta cycles
add tests for indexing packs with delta cycles
sha1-lookup: handle duplicate keys with GIT_USE_LOOKUP
test-sha1: add a binary output mode

Merge branch 'nd/git-dir-pointing-at-gitfile'Junio C Hamano Wed, 18 Sep 2013 18:42:36 +0000 (11:42 -0700)

Merge branch 'nd/git-dir-pointing-at-gitfile'

We made sure that we notice the user-supplied GIT_DIR is actually a
gitfile, but did not do the same when the default ".git" is a gitfile.

* nd/git-dir-pointing-at-gitfile:
Make setup_git_env() resolve .git file when $GIT_DIR is not specified

Merge branch 'jk/pager-bypass-cat-for-default-pager'Junio C Hamano Wed, 18 Sep 2013 18:42:15 +0000 (11:42 -0700)

Merge branch 'jk/pager-bypass-cat-for-default-pager'

If a build-time fallback is set to "cat" instead of "less", we
should apply the same "no subprocess or pipe" optimization as we
apply to user-supplied GIT_PAGER=cat.

* jk/pager-bypass-cat-for-default-pager:
pager: turn on "cat" optimization for DEFAULT_PAGER

Merge branch 'fc/t3200-fixes'Junio C Hamano Wed, 18 Sep 2013 18:42:13 +0000 (11:42 -0700)

Merge branch 'fc/t3200-fixes'

* fc/t3200-fixes:
t: branch: fix broken && chains
t: branch: fix typo
t: branch: trivial style fix

Merge branch 'fc/rev-parse-test-updates'Junio C Hamano Wed, 18 Sep 2013 18:42:03 +0000 (11:42 -0700)

Merge branch 'fc/rev-parse-test-updates'

Modernize tests.

* fc/rev-parse-test-updates:
rev-parse test: use standard test functions for setup
rev-parse test: use test_cmp instead of "test" builtin
rev-parse test: use test_must_fail, not "if <command>; then false; fi"
rev-parse test: modernize quoting and whitespace

fetch-pack.c: show correct command name that failsNguyễn Thái Ngọc Duy Wed, 18 Sep 2013 13:41:18 +0000 (20:41 +0700)

fetch-pack.c: show correct command name that fails

When --shallow-file is added to the command line, it has to be
before the subcommand name, the first argument won't be the command
name any more. Stop assuming that and keep track of the command name
explicitly.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

contacts: fix to work in subdirectoriesEric Sunshine Wed, 18 Sep 2013 02:52:05 +0000 (22:52 -0400)

contacts: fix to work in subdirectories

Unlike other git commands which work correctly at the top-level or in a
subdirectory, git-contacts fails when invoked in a subdirectory. This is
because it invokes git-blame with pathnames relative to the top-level,
but git-blame interprets the pathnames as relative to the current
directory. Fix this.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Update draft release notes to 1.8.5 for the first half... Junio C Hamano Tue, 17 Sep 2013 18:43:58 +0000 (11:43 -0700)

Update draft release notes to 1.8.5 for the first half of the fourth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'jk/remove-remote-helpers-in-python'Junio C Hamano Tue, 17 Sep 2013 18:43:01 +0000 (11:43 -0700)

Merge branch 'jk/remove-remote-helpers-in-python'

Remove now disused remote-helpers framework for helpers written in
Python.

* jk/remove-remote-helpers-in-python:
git_remote_helpers: remove little used Python library

Merge branch 'ss/doclinks'Junio C Hamano Tue, 17 Sep 2013 18:42:54 +0000 (11:42 -0700)

Merge branch 'ss/doclinks'

When we converted many documents that were traditionally text-only
to be formatted to AsciiDoc, we did not update links that point at
them to refer to the formatted HTML files.

* ss/doclinks:
Documentation: make AsciiDoc links always point to HTML files

Merge branch 'rh/ishes-doc'Junio C Hamano Tue, 17 Sep 2013 18:42:51 +0000 (11:42 -0700)

Merge branch 'rh/ishes-doc'

We liberally use "committish" and "commit-ish" (and "treeish" and
"tree-ish"); as these are non-words, let's unify these terms to
their dashed form. More importantly, clarify the documentation on
object peeling using these terms.

* rh/ishes-doc:
glossary: fix and clarify the definition of 'ref'
revisions.txt: fix and clarify <rev>^{<type>}
glossary: more precise definition of tree-ish (a.k.a. treeish)
use 'commit-ish' instead of 'committish'
use 'tree-ish' instead of 'treeish'
glossary: define commit-ish (a.k.a. committish)
glossary: mention 'treeish' as an alternative to 'tree-ish'

Merge branch 'dw/diff-no-index-doc'Junio C Hamano Tue, 17 Sep 2013 18:42:44 +0000 (11:42 -0700)

Merge branch 'dw/diff-no-index-doc'

When the user types "git diff" outside a working tree, thinking he
is inside one, the current error message that is a single-liner
"usage: git diff --no-index <path> <path>" may not be sufficient to
make him realize the mistake. Add "Not a git repository" to the
error message when we fell into the "--no-index" mode without an
explicit command line option to instruct us to do so.

* dw/diff-no-index-doc:
diff --no-index: describe in a separate paragraph
diff --no-index: clarify operation when not inside a repository

Merge branch 'ta/user-manual'Junio C Hamano Tue, 17 Sep 2013 18:42:41 +0000 (11:42 -0700)

Merge branch 'ta/user-manual'

Update the user's manual to more recent versions of Git.

* ta/user-manual:
"git prune" is safe
Remove irrelevant reference from "Tying it all together"
Remove unnecessary historical note from "Object storage format"
Improve section "Merging multiple trees"
Improve section "Manipulating branches"
Simplify "How to make a commit"
Fix some typos and improve wording
Use "git merge" instead of "git pull ."
Use current output for "git repack"
Use current "detached HEAD" message
Call it "Git User Manual" and remove reference to very old Git version

Merge branch 'fc/trivial'Junio C Hamano Tue, 17 Sep 2013 18:42:34 +0000 (11:42 -0700)

Merge branch 'fc/trivial'

* fc/trivial:
pull: use $curr_branch_short more
add: trivial style cleanup
reset: trivial style cleanup
branch: trivial style fix
reset: trivial refactoring

Merge branch 'fc/fast-export'Junio C Hamano Tue, 17 Sep 2013 18:42:31 +0000 (11:42 -0700)

Merge branch 'fc/fast-export'

Code simpification.

* fc/fast-export:
fast-export: refactor get_tags_and_duplicates()
fast-export: make extra_refs global

Merge branch 'ab/gitweb-author-initials'Junio C Hamano Tue, 17 Sep 2013 18:42:27 +0000 (11:42 -0700)

Merge branch 'ab/gitweb-author-initials'

* ab/gitweb-author-initials:
gitweb: Fix the author initials in blame for non-ASCII names

Merge branch 'jk/has-sha1-file-retry-packed'Junio C Hamano Tue, 17 Sep 2013 18:41:34 +0000 (11:41 -0700)

Merge branch 'jk/has-sha1-file-retry-packed'

When an object is not found after checking the packfiles and then
loose object directory, read_sha1_file() re-checks the packfiles to
prevent racing with a concurrent repacker; teach the same logic to
has_sha1_file().

* jk/has-sha1-file-retry-packed:
has_sha1_file: re-check pack directory before giving up

Merge branch 'jk/write-broken-index-with-nul-sha1'Junio C Hamano Tue, 17 Sep 2013 18:40:27 +0000 (11:40 -0700)

Merge branch 'jk/write-broken-index-with-nul-sha1'

Earlier we started rejecting an attempt to add 0{40} object name to
the index and to tree objects, but it sometimes is necessary to
allow so to be able to use tools like filter-branch to correct such
broken tree objects.

* jk/write-broken-index-with-nul-sha1:
write_index: optionally allow broken null sha1s

Merge branch 'jx/clean-interactive'Junio C Hamano Tue, 17 Sep 2013 18:40:23 +0000 (11:40 -0700)

Merge branch 'jx/clean-interactive'

Finishing touches to update the document to adjust to a new option
"git clean" learned recently.

* jx/clean-interactive:
documentation: clarify notes for clean.requireForce

Merge branch 'tb/precompose-autodetect-fix'Junio C Hamano Tue, 17 Sep 2013 18:39:59 +0000 (11:39 -0700)

Merge branch 'tb/precompose-autodetect-fix'

On MacOS X, we detected if the filesystem needs the "pre-composed
unicode strings" workaround, but did not automatically enable it.
Now we do.

* tb/precompose-autodetect-fix:
Set core.precomposeunicode to true on e.g. HFS+

Merge branch 'kk/tests-with-no-perl'Junio C Hamano Tue, 17 Sep 2013 18:39:35 +0000 (11:39 -0700)

Merge branch 'kk/tests-with-no-perl'

Some tests were not skipped under NO_PERL build.

* kk/tests-with-no-perl:
reset test: modernize style
t/t7106-reset-unborn-branch.sh: Add PERL prerequisite
add -i test: use skip_all instead of repeated PERL prerequisite
Make test "using invalid commit with -C" more strict

Merge branch 'ap/commit-author-mailmap'Junio C Hamano Tue, 17 Sep 2013 18:38:33 +0000 (11:38 -0700)

Merge branch 'ap/commit-author-mailmap'

"git commit --author=$name", when $name is not in the canonical
"A. U. Thor <au.thor@example.xz>" format, looks for a matching name
from existing history, but did not consult mailmap to grab the
preferred author name.

* ap/commit-author-mailmap:
commit: search author pattern against mailmap

Merge branch 'jk/free-tree-buffer'Junio C Hamano Tue, 17 Sep 2013 18:37:33 +0000 (11:37 -0700)

Merge branch 'jk/free-tree-buffer'

* jk/free-tree-buffer:
clear parsed flag when we free tree buffers

Merge branch 'maint'Junio C Hamano Tue, 17 Sep 2013 18:37:13 +0000 (11:37 -0700)

Merge branch 'maint'

* maint:
t7406-submodule-update: add missing &&

t3200: fix failure on case-insensitive filesystemsEric Sunshine Sat, 14 Sep 2013 07:36:24 +0000 (03:36 -0400)

t3200: fix failure on case-insensitive filesystems

62d94a3a (t3200: Add test demonstrating minor regression in 41c21f2;
2013-09-08) introduced a test which creates a directory named 'a',
however, on case-insensitive filesystems, this action fails with a
"fatal: cannot mkdir a: File exists" error due to a file named 'A' left
over from earlier tests. Resolve this problem.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t7508: avoid non-portable sed expressionEric Sunshine Sat, 14 Sep 2013 04:47:12 +0000 (00:47 -0400)

t7508: avoid non-portable sed expression

2556b996 (status: disable display of '#' comment prefix by default;
2013-09-06) introduced tests which fail on Mac OS X due to unportable
use of \t (for TAB) in a sed expression. POSIX [1][2] also disallows
it. Fix this.

[1]: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sed.html#tag_20_116_13_02
[2]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_03_02

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Acked-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t7406-submodule-update: add missing &&Tay Ray Chuan Sun, 15 Sep 2013 17:38:21 +0000 (01:38 +0800)

t7406-submodule-update: add missing &&

322bb6e (2011 Aug 11) introduced a new subshell at the end of a test
case but omitted a '&&' to join the two; fix this.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pack-objects: no crc check when the cached version... Nguyễn Thái Ngọc Duy Fri, 13 Sep 2013 11:03:00 +0000 (18:03 +0700)

pack-objects: no crc check when the cached version is used

Current code makes pack-objects always do check_pack_crc() in
unpack_entry() even if right after that we find out there's a cached
version and pack access is not needed. Swap two code blocks, search
for cached version first, then check crc.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

check-ignore: Add option to ignore index contentsDave Williams Thu, 5 Sep 2013 16:08:01 +0000 (17:08 +0100)

check-ignore: Add option to ignore index contents

check-ignore currently shows how .gitignore rules would treat untracked
paths. Tracked paths do not generate useful output. This prevents
debugging of why a path became tracked unexpectedly unless that path is
first removed from the index with `git rm --cached <path>`.

The option --no-index tells the command to bypass the check for the
path being in the index and hence allows tracked paths to be checked
too.

Whilst this behaviour deviates from the characteristics of `git add` and
`git status` its use case is unlikely to cause any user confusion.

Test scripts are augmented to check this option against the standard
ignores to ensure correct behaviour.

Signed-off-by: Dave Williams <dave@opensourcesolutions.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

urlmatch.c: recompute pointer after append_normalized_e... Thomas Rast Thu, 12 Sep 2013 14:15:40 +0000 (07:15 -0700)

urlmatch.c: recompute pointer after append_normalized_escapes

When append_normalized_escapes is called, its internal strbuf_add* calls can
cause the strbuf's buf to be reallocated changing the value of the buf pointer.

Do not use the strbuf buf pointer from before any append_normalized_escapes
calls afterwards. Instead recompute the needed pointer.

Signed-off-by: Thomas Rast <trast@inf.ethz.ch>
Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Sync with maint for l10n updatesJunio C Hamano Thu, 12 Sep 2013 21:53:47 +0000 (14:53 -0700)

Sync with maint for l10n updates

* maint:
l10n: de.po: use "das Tag" instead of "der Tag"

Update draft release notes to 1.8.5 for the third batch... Junio C Hamano Thu, 12 Sep 2013 21:42:47 +0000 (14:42 -0700)

Update draft release notes to 1.8.5 for the third batch of topics

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'jc/pager-configuration-doc'Junio C Hamano Thu, 12 Sep 2013 21:41:53 +0000 (14:41 -0700)

Merge branch 'jc/pager-configuration-doc'

It was unclear in the documentation how various configurations and
environment variables determine which pager is eventually used.

* jc/pager-configuration-doc:
config: rewrite core.pager documentation

Merge branch 'mm/remote-helpers-doc'Junio C Hamano Thu, 12 Sep 2013 21:41:50 +0000 (14:41 -0700)

Merge branch 'mm/remote-helpers-doc'

* mm/remote-helpers-doc:
Documentation/remote-helpers: document common use-case for private ref

Merge branch 'mn/doc-pack-heu-remove-dead-pastebin'Junio C Hamano Thu, 12 Sep 2013 21:41:47 +0000 (14:41 -0700)

Merge branch 'mn/doc-pack-heu-remove-dead-pastebin'

* mn/doc-pack-heu-remove-dead-pastebin:
remove dead pastebin link from pack-heuristics document

Merge branch 'mm/fast-import-feature-doc'Junio C Hamano Thu, 12 Sep 2013 21:41:45 +0000 (14:41 -0700)

Merge branch 'mm/fast-import-feature-doc'

* mm/fast-import-feature-doc:
Documentation/fast-import: clarify summary for `feature` command

Merge branch 'mm/mediawiki-dumb-push-fix'Junio C Hamano Thu, 12 Sep 2013 21:41:41 +0000 (14:41 -0700)

Merge branch 'mm/mediawiki-dumb-push-fix'

* mm/mediawiki-dumb-push-fix:
git-remote-mediawiki: no need to update private ref in non-dumb push
git-remote-mediawiki: use no-private-update capability on dumb push
transport-helper: add no-private-update capability
git-remote-mediawiki: add test and check Makefile targets

Merge branch 'jc/commit-is-spelled-with-two-ems'Junio C Hamano Thu, 12 Sep 2013 21:41:38 +0000 (14:41 -0700)

Merge branch 'jc/commit-is-spelled-with-two-ems'

* jc/commit-is-spelled-with-two-ems:
typofix: cherry is spelled with two ars
typofix: commit is spelled with two ems

Merge branch 'jk/config-int-range-check'Junio C Hamano Thu, 12 Sep 2013 21:41:00 +0000 (14:41 -0700)

Merge branch 'jk/config-int-range-check'

"git config" did not provide a way to set or access numbers larger
than a native "int" on the platform; it now provides 64-bit signed
integers on all platforms.

* jk/config-int-range-check:
git-config: always treat --int as 64-bit internally
config: make numeric parsing errors more clear
config: set errno in numeric git_parse_* functions
config: properly range-check integer values
config: factor out integer parsing from range checks

Add new @ shortcut for HEADFelipe Contreras Mon, 2 Sep 2013 06:34:30 +0000 (01:34 -0500)

Add new @ shortcut for HEAD

Typing 'HEAD' is tedious, especially when we can use '@' instead.

The reason for choosing '@' is that it follows naturally from the
ref@op syntax (e.g. HEAD@{u}), except we have no ref, and no
operation, and when we don't have those, it makes sens to assume
'HEAD'.

So now we can use 'git show @~1', and all that goody goodness.

Until now '@' was a valid name, but it conflicts with this idea, so
let's make it invalid. Probably very few people, if any, used this name.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mailmap: work around implementations with pure inline... Junio C Hamano Thu, 12 Sep 2013 15:37:08 +0000 (08:37 -0700)

mailmap: work around implementations with pure inline strcasecmp

On some systems (e.g. MinGW 4.0), string.h has only inline
definition of strcasecmp and no non-inline implementation is
supplied anywhere, which is, eh, "unusual". We cannot take an
address of such a function to store it in namemap.cmp.

Work it around by introducing our own level of indirection.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

commit: disable status hints when writing to COMMIT_EDITMSGMatthieu Moy Thu, 12 Sep 2013 10:50:06 +0000 (12:50 +0200)

commit: disable status hints when writing to COMMIT_EDITMSG

This turns the template COMMIT_EDITMSG from e.g

# [...]
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: builtin/commit.c
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# t/foo
#

to

# [...]
# Changes to be committed:
# modified: builtin/commit.c
#
# Untracked files:
# t/foo
#

Most status hints were written to be accurate when running "git status"
before running a commit. Many of them are not applicable when the commit
has already been started, and should not be shown in COMMIT_EDITMSG. The
most obvious are hints advising to run "git commit",
"git rebase/am/cherry-pick --continue", which do not make sense when the
command has already been run.

Other messages become slightly inaccurate (e.g. hint to use "git add" to
add untracked files), as the suggested commands are not immediately
applicable during the editing of COMMIT_EDITMSG, but would be applicable
if the commit is aborted. These messages are both potentially helpful and
slightly misleading. This patch chose to remove them too, to avoid
introducing too much complexity in the status code.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

wt-status: turn advice_status_hints into a field of... Matthieu Moy Thu, 12 Sep 2013 10:50:05 +0000 (12:50 +0200)

wt-status: turn advice_status_hints into a field of wt_status

No behavior change in this patch, but this makes the display of status
hints more flexible as they can be enabled or disabled for individual
calls to commit.c:run_status().

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

commit: factor status configuration is a helper functionMatthieu Moy Thu, 12 Sep 2013 10:50:04 +0000 (12:50 +0200)

commit: factor status configuration is a helper function

cmd_commit and cmd_status use very similar code to initialize the
wt_status structure. Factor this code into a function to ensure future
changes will keep both versions consistent.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

http-backend: provide Allow header for 405Brian M. Carlson Thu, 12 Sep 2013 00:30:01 +0000 (00:30 +0000)

http-backend: provide Allow header for 405

The HTTP 1.1 standard requires an Allow header for 405 Method Not Allowed:

The response MUST include an Allow header containing a list of valid methods
for the requested resource.

So provide such a header when we return a 405 to the user agent.

Signed-off-by: Brian M. Carlson <sandals@crustytoothpaste.net>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'maint' of git://github.com/git-l10n/git... Junio C Hamano Thu, 12 Sep 2013 04:12:02 +0000 (21:12 -0700)

Merge branch 'maint' of git://github.com/git-l10n/git-po into maint

* 'maint' of git://github.com/git-l10n/git-po:
l10n: de.po: use "das Tag" instead of "der Tag"

Update draft release notes to 1.8.5Junio C Hamano Wed, 11 Sep 2013 22:05:57 +0000 (15:05 -0700)

Update draft release notes to 1.8.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'jc/ls-files-killed-optim'Junio C Hamano Wed, 11 Sep 2013 22:03:28 +0000 (15:03 -0700)

Merge branch 'jc/ls-files-killed-optim'

"git ls-files -k" needs to crawl only the part of the working tree
that may overlap the paths in the index to find killed files, but
shared code with the logic to find all the untracked files, which
made it unnecessarily inefficient.

* jc/ls-files-killed-optim:
dir.c::test_one_path(): work around directory_exists_in_index_icase() breakage
t3010: update to demonstrate "ls-files -k" optimization pitfalls
ls-files -k: a directory only can be killed if the index has a non-directory
dir.c: use the cache_* macro to access the current index

Merge branch 'es/rebase-i-no-abbrev'Junio C Hamano Wed, 11 Sep 2013 22:02:29 +0000 (15:02 -0700)

Merge branch 'es/rebase-i-no-abbrev'

The commit object names in the insn sheet that was prepared at the
beginning of "rebase -i" session can become ambiguous as the
rebasing progresses and the repository gains more commits. Make
sure the internal record is kept with full 40-hex object names.

* es/rebase-i-no-abbrev:
rebase -i: fix short SHA-1 collision
t3404: rebase -i: demonstrate short SHA-1 collision
t3404: make tests more self-contained

Merge branch 'rt/rebase-p-no-merge-summary'Junio C Hamano Wed, 11 Sep 2013 22:00:56 +0000 (15:00 -0700)

Merge branch 'rt/rebase-p-no-merge-summary'

"git rebase -p" internally used the merge machinery, but when
rebasing, there should not be a need for merge summary.

* rt/rebase-p-no-merge-summary:
rebase --preserve-merges: ignore "merge.log" config

Merge branch 'tf/gitweb-ss-tweak'Junio C Hamano Wed, 11 Sep 2013 22:00:54 +0000 (15:00 -0700)

Merge branch 'tf/gitweb-ss-tweak'

Tweak Gitweb CSS to layout some elements better.

* tf/gitweb-ss-tweak:
gitweb: make search help link less ugly
gitweb: omit the repository owner when it is unset
gitweb: vertically centre contents of page footer
gitweb: ensure OPML text fits inside its box

Merge branch 'sb/mailmap-freeing-NULL-is-ok'Junio C Hamano Wed, 11 Sep 2013 22:00:43 +0000 (15:00 -0700)

Merge branch 'sb/mailmap-freeing-NULL-is-ok'

* sb/mailmap-freeing-NULL-is-ok:
mailmap: remove redundant check for freeing memory

Merge branch 'js/xread-in-full'Junio C Hamano Wed, 11 Sep 2013 21:59:46 +0000 (14:59 -0700)

Merge branch 'js/xread-in-full'

A call to xread() was used without a loop around to cope with short
read in the codepath to stream new contents to a pack.

* js/xread-in-full:
stream_to_pack: xread does not guarantee to read all requested bytes

Merge branch 'es/rebase-i-respect-core-commentchar'Junio C Hamano Wed, 11 Sep 2013 21:58:52 +0000 (14:58 -0700)

Merge branch 'es/rebase-i-respect-core-commentchar'

"rebase -i" forgot that the comment character can be configurable
while reading its insn sheet.

* es/rebase-i-respect-core-commentchar:
rebase -i: fix cases ignoring core.commentchar

Merge branch 'jn/post-receive-utf8'Junio C Hamano Wed, 11 Sep 2013 21:58:46 +0000 (14:58 -0700)

Merge branch 'jn/post-receive-utf8'

Update post-receive-email script to make sure the message contents
and pathnames are encoded consistently in UTF-8.

* jn/post-receive-utf8:
hooks/post-receive-email: set declared encoding to utf-8
hooks/post-receive-email: force log messages in UTF-8
hooks/post-receive-email: use plumbing instead of git log/show

Merge branch 'sh/pull-rebase-preserve'Junio C Hamano Wed, 11 Sep 2013 21:57:49 +0000 (14:57 -0700)

Merge branch 'sh/pull-rebase-preserve'

"git pull --rebase" always flattened the history; pull.rebase can
now be set to "preserve" to invoke "rebase --preserve-merges".

* sh/pull-rebase-preserve:
pull: allow pull to preserve merges when rebasing

Merge branch 'nd/push-no-thin'Junio C Hamano Wed, 11 Sep 2013 21:56:58 +0000 (14:56 -0700)

Merge branch 'nd/push-no-thin'

"git push --no-thin" was a no-op by mistake.

* nd/push-no-thin:
push: respect --no-thin

Windows: do not redefine _WIN32_WINNTSebastian Schuberth Wed, 11 Sep 2013 16:06:31 +0000 (18:06 +0200)

Windows: do not redefine _WIN32_WINNT

With MinGW runtime version 4.0 this interferes with the previous
definition from sdkddkver.h.

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

lookup_object: remove hashtable_index() and optimize... Nicolas Pitre Tue, 10 Sep 2013 22:17:12 +0000 (18:17 -0400)

lookup_object: remove hashtable_index() and optimize hash_obj()

hashtable_index() appears to be a close duplicate of hash_obj().
Keep only the later and make it usable for all cases.

Also remove the modulus as this is an expensive operation.
The size argument is always a power of 2 anyway, so a simple
mask operation provides the same result.

On a 'git rev-list --all --objects' run this decreased the time spent
in lookup_object from 27.5% to 24.1%.

[jc: with a few comments on "modulus turned into mask" by Peff]

Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Improve documentation concerning the status.submodulesu... Jens Lehmann Wed, 11 Sep 2013 19:07:15 +0000 (21:07 +0200)

Improve documentation concerning the status.submodulesummary setting

'git status' and 'git commit' can be told to also show the output of "git
submodule summary" by setting the "status.submodulesummary" config option.
But status and commit also honor the "diff.ignoreSubmodules" and the
"submodule.<name>.ignore" settings, which then disable the summary partly
or completely. This - and the fact that the last two settings do not
affect the "git submodule" commands at all - is not well documented.

Extend the documentation in those places where "status.submodulesummary",
"diff.ignoreSubmodules" and "submodule.<name>.ignore" are described to
better explain these dependencies.

Thanks-to: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

MinGW: Fix stat definitions to work with MinGW runtime... Sebastian Schuberth Wed, 11 Sep 2013 16:02:09 +0000 (18:02 +0200)

MinGW: Fix stat definitions to work with MinGW runtime version 4.0

For an overview of changes in mingwrt-4.0 see:

http://sourceforge.net/p/mingw/mingw-org-wsl/ci/4.0.0/tree/NEWS

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

MSVC: fix stat definition hellKarsten Blees Tue, 10 Sep 2013 23:23:13 +0000 (01:23 +0200)

MSVC: fix stat definition hell

In msvc.h, there's a couple of stat related functions defined diffently
from mingw.h. When we remove these definitions, the only problem we get is
"warning C4005: '_stati64' : macro redefinition" for this line in mingw.h:

#define _stati64(x,y) mingw_stat(x,y)

The reason is that as of MSVCR80.dll (distributed with MSVC 2005), the
original _stati64 family of functions was renamed to _stat32i64, and the
former function names became macros (pointing to the appropriate function
based on the definition of _USE_32BIT_TIME_T).

Defining _stati64 works on MinGW because MinGW by default compiles against
the MSVCRT.DLL that is part of Windows (i.e. _stati64 is a function rather
than a macro).

Note: MinGW *can* compile for newer MSVC runtime versions, and MSVC
apparently can also compile for the Windows MSVCRT.DLL via the DDK (see
http://www.syndicateofideas.com/posts/fighting-the-msvcrt-dll-hell ).

Remove the stat definitions from msvc.h, as they are not compiler related.

In mingw.h, determine the runtime version in use from the definitions of
_stati64 and _USE_32BIT_TIME_T, and define stat() accordingly.

This also fixes that stat() in MSVC builds still resolves to mingw_lstat()
instead of mingw_stat().

Signed-off-by: Karsten Blees <blees@dcon.de>
Acked-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

MSVC: fix compile errors due to macro redefinitionsKarsten Blees Tue, 10 Sep 2013 23:22:34 +0000 (01:22 +0200)

MSVC: fix compile errors due to macro redefinitions

Skip errno.h definitions if they are already defined.

Signed-off-by: Karsten Blees <blees@dcon.de>
Acked-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

MSVC: fix compile errors due to missing libintl.hKarsten Blees Tue, 10 Sep 2013 23:21:53 +0000 (01:21 +0200)

MSVC: fix compile errors due to missing libintl.h

Set NO_GETTEXT in config.mak.uname to get rid of libintl.h dependency.

Signed-off-by: Karsten Blees <blees@dcon.de>
Acked-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

update-ref: add test cases covering --stdin signatureBrad King Wed, 11 Sep 2013 12:46:18 +0000 (08:46 -0400)

update-ref: add test cases covering --stdin signature

Extend t/t1400-update-ref.sh to cover cases using the --stdin option.

Signed-off-by: Brad King <brad.king@kitware.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

cvsserver: pick up the right mode bitsJunio C Hamano Tue, 10 Sep 2013 22:33:06 +0000 (15:33 -0700)

cvsserver: pick up the right mode bits

When determining the file mode from either ls-tree or diff-tree
output, we used to grab these octal mode string (typically 100644 or
100755) and then did

$git_perms .= "r" if ( $mode & 4 );
$git_perms .= "w" if ( $mode & 2 );
$git_perms .= "x" if ( $mode & 1 );

which was already wrong, as (100644 & 4) is very different from
oct("100644") & 4. An earlier refactoring 2c3af7e7 (cvsserver:
factor out git-log parsing logic, 2012-10-13) further changed it to
pick the third octal digit (10*0*644 or 10*0*755) from the left and
then do the above conversion, which does not make sense, either.

Let's use the third digit from the last of the octal mode string to
make sure we get the executable and read bits right.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Tested-by: Michael Cronenworth <mike@cchtml.com>

send-email: don't call methods on undefined valuesBrian M. Carlson Sun, 8 Sep 2013 20:54:34 +0000 (20:54 +0000)

send-email: don't call methods on undefined values

If SSL verification is enabled in git send-email, we could attempt to call a
method on an undefined value if the verification failed, since $smtp would end
up being undef. Look up the error string in a way that will produce a helpful
error message and not cause further errors.

Signed-off-by: Brian M. Carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Update draft release notes to 1.8.5 for the second... Junio C Hamano Mon, 9 Sep 2013 21:51:42 +0000 (14:51 -0700)

Update draft release notes to 1.8.5 for the second batch of topics

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'nd/magic-pathspec'Junio C Hamano Mon, 9 Sep 2013 21:50:42 +0000 (14:50 -0700)

Merge branch 'nd/magic-pathspec'

Use "struct pathspec" interface in more places, instead of array of
characters, the latter of which cannot express magic pathspecs
(e.g. ":(icase)makefile" that matches both Makefile and makefile).

* nd/magic-pathspec:
add: lift the pathspec magic restriction on "add -p"
pathspec: catch prepending :(prefix) on pathspec with short magic

Merge branch 'jk/mailmap-incomplete-line'Junio C Hamano Mon, 9 Sep 2013 21:50:41 +0000 (14:50 -0700)

Merge branch 'jk/mailmap-incomplete-line'

* jk/mailmap-incomplete-line:
mailmap: handle mailmap blobs without trailing newlines

Merge branch 'sp/clip-read-write-to-8mb'Junio C Hamano Mon, 9 Sep 2013 21:50:39 +0000 (14:50 -0700)

Merge branch 'sp/clip-read-write-to-8mb'

Send a large request to read(2)/write(2) as a smaller but still
reasonably large chunks, which would improve the latency when the
operation needs to be killed and incidentally works around broken
64-bit systems that cannot take a 2GB write or read in one go.

* sp/clip-read-write-to-8mb:
Revert "compat/clipped-write.c: large write(2) fails on Mac OS X/XNU"
xread, xwrite: limit size of IO to 8MB

Merge branch 'tg/index-struct-sizes'Junio C Hamano Mon, 9 Sep 2013 21:50:38 +0000 (14:50 -0700)

Merge branch 'tg/index-struct-sizes'

The code that reads from a region that mmaps an on-disk index
assumed that "int"/"short" are always 32/16 bits.

* tg/index-struct-sizes:
read-cache: use fixed width integer types

Merge branch 'jc/transport-do-not-use-connect-twice... Junio C Hamano Mon, 9 Sep 2013 21:50:37 +0000 (14:50 -0700)

Merge branch 'jc/transport-do-not-use-connect-twice-in-fetch'

The auto-tag-following code in "git fetch" tries to reuse the same
transport twice when the serving end does not cooperate and does
not give tags that point to commits that are asked for as part of
the primary transfer. Unfortunately, Git-aware transport helper
interface is not designed to be used more than once, hence this
does not work over smart-http transfer.

* jc/transport-do-not-use-connect-twice-in-fetch:
builtin/fetch.c: Fix a sparse warning
fetch: work around "transport-take-over" hack
fetch: refactor code that fetches leftover tags
fetch: refactor code that prepares a transport
fetch: rename file-scope global "transport" to "gtransport"
t5802: add test for connect helper

Merge branch 'es/contacts-blame-L-multi'Junio C Hamano Mon, 9 Sep 2013 21:50:36 +0000 (14:50 -0700)

Merge branch 'es/contacts-blame-L-multi'

* es/contacts-blame-L-multi:
contacts: reduce git-blame invocations
contacts: gather all blame sources prior to invoking git-blame
contacts: validate hunk length earlier

Merge branch 'jc/url-match'Junio C Hamano Mon, 9 Sep 2013 21:50:32 +0000 (14:50 -0700)

Merge branch 'jc/url-match'

Allow section.<urlpattern>.var configuration variables to be
treated as a "virtual" section.var given a URL, and use the
mechanism to enhance http.* configuration variables.

This is a reroll of Kyle J. McKay's work.

* jc/url-match:
builtin/config.c: compilation fix
config: "git config --get-urlmatch" parses section.<url>.key
builtin/config: refactor collect_config()
config: parse http.<url>.<variable> using urlmatch
config: add generic callback wrapper to parse section.<url>.key
config: add helper to normalize and match URLs
http.c: fix parsing of http.sslCertPasswordProtected variable

Merge branch 'jl/submodule-mv'Junio C Hamano Mon, 9 Sep 2013 21:36:15 +0000 (14:36 -0700)

Merge branch 'jl/submodule-mv'

"git mv A B" when moving a submodule A does "the right thing",
inclusing relocating its working tree and adjusting the paths in
the .gitmodules file.

* jl/submodule-mv: (53 commits)
rm: delete .gitmodules entry of submodules removed from the work tree
mv: update the path entry in .gitmodules for moved submodules
submodule.c: add .gitmodules staging helper functions
mv: move submodules using a gitfile
mv: move submodules together with their work trees
rm: do not set a variable twice without intermediate reading.
t6131 - skip tests if on case-insensitive file system
parse_pathspec: accept :(icase)path syntax
pathspec: support :(glob) syntax
pathspec: make --literal-pathspecs disable pathspec magic
pathspec: support :(literal) syntax for noglob pathspec
kill limit_pathspec_to_literal() as it's only used by parse_pathspec()
parse_pathspec: preserve prefix length via PATHSPEC_PREFIX_ORIGIN
parse_pathspec: make sure the prefix part is wildcard-free
rename field "raw" to "_raw" in struct pathspec
tree-diff: remove the use of pathspec's raw[] in follow-rename codepath
remove match_pathspec() in favor of match_pathspec_depth()
remove init_pathspec() in favor of parse_pathspec()
remove diff_tree_{setup,release}_paths
convert common_prefix() to use struct pathspec
...

Merge branch 'es/blame-L-twice'Junio C Hamano Mon, 9 Sep 2013 21:35:11 +0000 (14:35 -0700)

Merge branch 'es/blame-L-twice'

Teaches "git blame" to take more than one -L ranges.

* es/blame-L-twice:
line-range: reject -L line numbers less than 1
t8001/t8002: blame: add tests of -L line numbers less than 1
line-range: teach -L^:RE to search from start of file
line-range: teach -L:RE to search from end of previous -L range
line-range: teach -L^/RE/ to search from start of file
line-range-format.txt: document -L/RE/ relative search
log: teach -L/RE/ to search from end of previous -L range
blame: teach -L/RE/ to search from end of previous -L range
line-range: teach -L/RE/ to search relative to anchor point
blame: document multiple -L support
t8001/t8002: blame: add tests of multiple -L options
blame: accept multiple -L ranges
blame: inline one-line function into its lone caller
range-set: publish API for re-use by git-blame -L
line-range-format.txt: clarify -L:regex usage form
git-log.txt: place each -L option variation on its own line

Merge branch 'tr/log-full-diff-keep-true-parents'Junio C Hamano Mon, 9 Sep 2013 21:33:16 +0000 (14:33 -0700)

Merge branch 'tr/log-full-diff-keep-true-parents'

Output from "git log --full-diff -- <pathspec>" looked strange,
because comparison was done with the previous ancestor that touched
the specified <pathspec>, causing the patches for paths outside the
pathspec to show more than the single commit has changed.

Tweak "git reflog -p" for the same reason using the same mechanism.

* tr/log-full-diff-keep-true-parents:
log: use true parents for diff when walking reflogs
log: use true parents for diff even when rewriting

Merge branch 'jk/cat-file-batch-optim'Junio C Hamano Mon, 9 Sep 2013 21:33:07 +0000 (14:33 -0700)

Merge branch 'jk/cat-file-batch-optim'

Rework the reverted change to `cat-file --batch-check`.

* jk/cat-file-batch-optim:
cat-file: only split on whitespace when %(rest) is used

Merge branch 'es/blame-L-more'Junio C Hamano Mon, 9 Sep 2013 21:32:45 +0000 (14:32 -0700)

Merge branch 'es/blame-L-more'

More fixes to the code to parse the "-L" option in "log" and "blame".

* es/blame-L-more:
blame: reject empty ranges -L,+0 and -L,-0
t8001/t8002: blame: demonstrate acceptance of bogus -L,+0 and -L,-0
blame: reject empty ranges -LX,+0 and -LX,-0
t8001/t8002: blame: demonstrate acceptance of bogus -LX,+0 and -LX,-0
log: fix -L bounds checking bug
t4211: retire soon-to-be unimplementable tests
t4211: log: demonstrate -L bounds checking bug
blame: fix -L bounds checking bug
t8001/t8002: blame: add empty file & partial-line tests
t8001/t8002: blame: demonstrate -L bounds checking bug
t8001/t8002: blame: decompose overly-large test

Merge branch 'db/http-savecookies'Junio C Hamano Mon, 9 Sep 2013 21:32:08 +0000 (14:32 -0700)

Merge branch 'db/http-savecookies'

* db/http-savecookies:
t5551: Remove header from curl cookie file
http: add http.savecookies option to write out HTTP cookies

Merge branch 'jc/push-cas'Junio C Hamano Mon, 9 Sep 2013 21:30:29 +0000 (14:30 -0700)

Merge branch 'jc/push-cas'

Allow a safer "rewind of the remote tip" push than blind "--force",
by requiring that the overwritten remote ref to be unchanged since
the new history to replace it was prepared.

The machinery is more or less ready. The "--force" option is again
the big red button to override any safety, thanks to J6t's sanity
(the original round allowed --lockref to defeat --force).

The logic to choose the default implemented here is fragile
(e.g. "git fetch" after seeing a failure will update the
remote-tracking branch and will make the next "push" pass,
defeating the safety pretty easily). It is suitable only for the
simplest workflows, and it may hurt users more than it helps them.

* jc/push-cas:
push: teach --force-with-lease to smart-http transport
send-pack: fix parsing of --force-with-lease option
t5540/5541: smart-http does not support "--force-with-lease"
t5533: test "push --force-with-lease"
push --force-with-lease: tie it all together
push --force-with-lease: implement logic to populate old_sha1_expect[]
remote.c: add command line option parser for "--force-with-lease"
builtin/push.c: use OPT_BOOL, not OPT_BOOLEAN
cache.h: move remote/connect API out of it

Merge branch 'nd/clone-connectivity-shortcut'Junio C Hamano Mon, 9 Sep 2013 21:30:01 +0000 (14:30 -0700)

Merge branch 'nd/clone-connectivity-shortcut'

* nd/clone-connectivity-shortcut:
smart http: use the same connectivity check on cloning

Merge branch 'jc/diff-filter-negation'Junio C Hamano Mon, 9 Sep 2013 21:28:35 +0000 (14:28 -0700)

Merge branch 'jc/diff-filter-negation'

Teach "git diff --diff-filter" to express "I do not want to see
these classes of changes" more directly by listing only the
unwanted ones in lowercase (e.g. "--diff-filter=d" will show
everything but deletion) and deprecate "diff-files -q" which did
the same thing as "--diff-filter=d".

* jc/diff-filter-negation:
diff: deprecate -q option to diff-files
diff: allow lowercase letter to specify what change class to exclude
diff: reject unknown change class given to --diff-filter
diff: preparse --diff-filter string argument
diff: factor out match_filter()
diff: pass the whole diff_options to diffcore_apply_filter()

Merge branch 'ms/fetch-prune-configuration'Junio C Hamano Mon, 9 Sep 2013 21:27:11 +0000 (14:27 -0700)

Merge branch 'ms/fetch-prune-configuration'

Allow fetch.prune and remote.*.prune configuration variables to be set,
and "git fetch" to behave as if "--prune" is given.

"git fetch" that honors remote.*.prune is fine, but I wonder if we
should somehow make "git push" aware of it as well. Perhaps
remote.*.prune should not be just a boolean, but a 4-way "none",
"push", "fetch", "both"?

* ms/fetch-prune-configuration:
fetch: make --prune configurable

cherry-pick: allow "-" as abbreviation of '@{-1}'Hiroshige Umino Thu, 5 Sep 2013 14:57:23 +0000 (23:57 +0900)

cherry-pick: allow "-" as abbreviation of '@{-1}'

"-" abbreviation is handy for "cherry-pick" like "checkout" and "merge".

It's also good for uniformity that a "-" stands as
the name of the previous branch where a branch name is
accepted and it could not mean any other things like stdin.

Signed-off-by: Hiroshige Umino <hiroshige88@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

upload-pack: bump keepalive default to 5 secondsJeff King Sun, 8 Sep 2013 09:02:06 +0000 (05:02 -0400)

upload-pack: bump keepalive default to 5 seconds

There is no reason not to turn on keepalives by default.
They take very little bandwidth, and significantly less than
the progress reporting they are replacing. And in the case
that progress reporting is on, we should never need to send
a keepalive anyway, as we will constantly be showing
progress and resetting the keepalive timer.

We do not necessarily know what the client's idea of a
reasonable timeout is, so let's keep this on the low side of
5 seconds. That is high enough that we will always prefer
our normal 1-second progress reports to sending a keepalive
packet, but low enough that no sane client should consider
the connection hung.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

upload-pack: send keepalive packets during pack computationJeff King Sun, 8 Sep 2013 09:01:31 +0000 (05:01 -0400)

upload-pack: send keepalive packets during pack computation

When upload-pack has started pack-objects, there may be a quiet
period while pack-objects prepares the pack (i.e., counting objects
and delta compression). Normally we would see (and send to the
client) progress information, but if "--quiet" is in effect,
pack-objects will produce nothing at all until the pack data is
ready. On a large repository, this can take tens of seconds (or even
minutes if the system is loaded or the repository is badly packed).
Clients or intermediate proxies can sometimes give up in this
situation, assuming that the server or connection has hung.

This patch introduces a "keepalive" option; if upload-pack sees no
data from pack-objects for a certain number of seconds, it will send
an empty sideband data packet to let the other side know that we are
still working on it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-config: always treat --int as 64-bit internallyJeff King Sun, 8 Sep 2013 08:40:02 +0000 (04:40 -0400)

git-config: always treat --int as 64-bit internally

When you run "git config --int", the maximum size of integer
you get depends on how git was compiled, and what it
considers to be an "int".

This is almost useful, because your scripts calling "git
config" will behave similarly to git internally. But relying
on this is dubious; you have to actually know how git treats
each value internally (e.g., int versus unsigned long),
which is not documented and is subject to change. And even
if you know it is "unsigned long", we do not have a
git-config option to match that behavior.

Furthermore, you may simply be asking git to store a value
on your behalf (e.g., configuration for a hook). In that
case, the relevant range check has nothing at all to do with
git, but rather with whatever scripting tools you are using
(and git has no way of knowing what the appropriate range is
there).

Not only is the range check useless, but it is actively
harmful, as there is no way at all for scripts to look
at config variables with large values. For instance, one
cannot reliably get the value of pack.packSizeLimit via
git-config. On an LP64 system, git happily uses a 64-bit
"unsigned long" internally to represent the value, but the
script cannot read any value over 2G.

Ideally, the "--int" option would simply represent an
arbitrarily large integer. For practical purposes, however,
a 64-bit integer is large enough, and is much easier to
implement (and if somebody overflows it, we will still
notice the problem, and not simply return garbage).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

config: make numeric parsing errors more clearJeff King Sun, 8 Sep 2013 08:38:22 +0000 (04:38 -0400)

config: make numeric parsing errors more clear

If we try to parse an integer config argument and get a
number outside of the representable range, we die with the
cryptic message: "bad config value for '%s'".

We can improve two things:

1. Show the value that produced the error (e.g., bad
config value '3g' for 'foo.bar').

2. Mention the reason the value was rejected (e.g.,
"invalid unit" versus "out of range").

A few tests need to be updated with the new output, but that
should not be representative of real-world breakage, as
scripts should not be depending on the exact text of our
stderr output, which is subject to i18n anyway.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

config: set errno in numeric git_parse_* functionsJeff King Sun, 8 Sep 2013 08:36:42 +0000 (04:36 -0400)

config: set errno in numeric git_parse_* functions

When we are parsing an integer or unsigned long, we use
the strto*max functions, which properly set errno to ERANGE
if we get a large value. However, we also do further range
checks after applying our multiplication factor, but do not
set ERANGE. This means that a caller cannot tell if an error
was caused by ERANGE or if the input was simply not a valid
number.

This patch teaches git_parse_signed and git_parse_unsigned to set
ERANGE for range errors, and EINVAL for other errors, so that the
caller can reliably tell these cases apart.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

config: properly range-check integer valuesJeff King Sun, 8 Sep 2013 08:33:08 +0000 (04:33 -0400)

config: properly range-check integer values

When we look at a config value as an integer using the
git_config_int function, we carefully range-check the value
we get and complain if it is out of our range. But the range
we compare to is that of a "long", which we then cast to an
"int" in the function's return value. This means that on
systems where "int" and "long" have different sizes (e.g.,
LP64 systems), we may pass the range check, but then return
nonsense by truncating the value as we cast it to an int.

We can solve this by converting git_parse_long into
git_parse_int, and range-checking the "int" range. Nobody
actually cared that we used a "long" internally, since the
result was truncated anyway. And the only other caller of
git_parse_long is git_config_maybe_bool, which should be
fine to just use int (though we will now forbid out-of-range
nonsense like setting "merge.ff" to "10g" to mean "true",
which is probably a good thing).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

config: factor out integer parsing from range checksJeff King Sun, 8 Sep 2013 08:29:27 +0000 (04:29 -0400)

config: factor out integer parsing from range checks

When we are parsing integers for config, we use an intmax_t
(or uintmax_t) internally, and then check against the size
of our result type at the end. We can parameterize the
maximum representable value, which will let us re-use the
parsing code for a variety of range checks.

Unfortunately, we cannot combine the signed and unsigned
parsing functions easily, as we have to rely on the signed
and unsigned C types internally.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

branch.c: Relax unnecessary requirement on upstream... Per Cederqvist Sun, 8 Sep 2013 20:58:15 +0000 (22:58 +0200)

branch.c: Relax unnecessary requirement on upstream's remote ref name

When creating an upstream relationship, we use the configured remotes and
their refspecs to determine the upstream configuration settings
branch.<name>.remote and branch.<name>.merge. However, if the matching
refspec does not have refs/heads/<something> on the remote side, we end
up rejecting the match, and failing the upstream configuration.

It could be argued that when we set up an branch's upstream, we want that
upstream to also be a proper branch in the remote repo. Although this is
typically the common case, there are cases (as demonstrated by the previous
patch in this series) where this requirement prevents a useful upstream
relationship from being formed. Furthermore:

- We have fundamentally no say in how the remote repo have organized its
branches. The remote repo may put branches (or branch-like constructs
that are insteresting for downstreams to track) outside refs/heads/*.

- The user may intentionally want to track a non-branch from a remote
repo, by using a branch and configured upstream in the local repo.

Relaxing the checking to only require a matching remote/refspec allows the
testcase introduced in the previous patch to succeed, and has no negative
effect on the rest of the test suite.

This patch fixes a behavior (arguably a regression) first introduced in
41c21f2 (branch.c: Validate tracking branches with refspecs instead of
refs/remotes/*) on 2013-04-21 (released in >= v1.8.3.2).

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t3200: Add test demonstrating minor regression in 41c21f2Johan Herland Sun, 8 Sep 2013 20:58:14 +0000 (22:58 +0200)

t3200: Add test demonstrating minor regression in 41c21f2

In 41c21f2 (branch.c: Validate tracking branches with refspecs instead of
refs/remotes/*), we changed the rules for what is considered a valid tracking
branch (a.k.a. upstream branch). We now use the configured remotes and their
refspecs to determine whether a proposed tracking branch is in fact within
the domain of a remote, and we then use that information to deduce the
upstream configuration (branch.<name>.remote and branch.<name>.merge).

However, with that change, we also check that - in addition to a matching
refspec - the result of mapping the tracking branch through that refspec
(i.e. the corresponding ref name in the remote repo) happens to start with
"refs/heads/". In other words, we require that a tracking branch refers to
a _branch_ in the remote repo.

Now, consider that you are e.g. setting up an automated building/testing
infrastructure for a group of similar "source" repositories. The build/test
infrastructure consists of a central scheduler, and a number of build/test
"slave" machines that perform the actual build/test work. The scheduler
monitors the group of similar repos for changes (e.g. with a periodic
"git fetch"), and triggers builds/tests to be run on one or more slaves.
Graphically the changes flow between the repos like this:

Source #1 -------v ----> Slave #1
/
Source #2 -----> Scheduler -----> Slave #2
\
Source #3 -------^ ----> Slave #3

... ...

The scheduler maintains a single Git repo with each of the source repos set
up as distinct remotes. The slaves also need access to all the changes from
all of the source repos, so they pull from the scheduler repo, but using the
following custom refspec:

remote.origin.fetch = "+refs/remotes/*:refs/remotes/*"

This makes all of the scheduler's remote-tracking branches automatically
available as identical remote-tracking branches in each of the slaves.

Now, consider what happens if a slave tries to create a local branch with
one of the remote-tracking branches as upstream:

git branch local_branch --track refs/remotes/source-1/some_branch

Git now looks at the configured remotes (in this case there is only "origin",
pointing to the scheduler's repo) and sees refs/remotes/source-1/some_branch
matching origin's refspec. Mapping through that refspec we find that the
corresponding remote ref name is "refs/remotes/source-1/some_branch".
However, since this remote ref name does not start with "refs/heads/", we
discard it as a suitable upstream, and the whole command fails.

This patch adds a testcase demonstrating this failure by creating two
source repos ("a" and "b") that are forwarded through a scheduler ("c")
to a slave repo ("d"), that then tries create a local branch with an
upstream. See the next patch in this series for the exciting conclusion
to this story...

Reported-by: Per Cederqvist <cederp@opera.com>
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Refer to branch.<name>.remote/merge when documenting... Johan Herland Sun, 8 Sep 2013 20:58:13 +0000 (22:58 +0200)

Refer to branch.<name>.remote/merge when documenting --track

Make it easier for readers to find the actual config variables that
implement the "upstream" relationship.

Suggested-by: Per Cederqvist <cederp@opera.com>
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t3200: Minor fix when preparing for tracking failureJohan Herland Sun, 8 Sep 2013 20:58:12 +0000 (22:58 +0200)

t3200: Minor fix when preparing for tracking failure

We're testing that trying to --track a ref that is not covered by any remote
refspec should fail. For that, we want to have refs/remotes/local/master
present, but we also want the remote.local.fetch refspec to NOT match
refs/remotes/local/master (so that the tracking setup will fail, as intended).
However, when doing "git fetch local" to ensure the existence of
refs/remotes/local/master, we must not already have changed remote.local.fetch
so as to cause refs/remotes/local/master not to be fetched. Therefore, set
remote.local.fetch to refs/heads/*:refs/remotes/local/* BEFORE we fetch, and
then reset it to refs/heads/s:refs/remotes/local/s AFTER we have fetched
(but before we test --track).

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>