gitweb.git
upload-pack: strip refs before calling ref_is_hidden()Lukas Fleischer Thu, 5 Nov 2015 06:07:29 +0000 (07:07 +0100)

upload-pack: strip refs before calling ref_is_hidden()

Make hideRefs handling in upload-pack consistent with the behavior
described in the documentation by stripping refs before comparing them
with prefixes in hideRefs.

Signed-off-by: Lukas Fleischer <lfleischer@lfos.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

config.txt: document the semantics of hideRefs with... Lukas Fleischer Tue, 3 Nov 2015 07:58:14 +0000 (08:58 +0100)

config.txt: document the semantics of hideRefs with namespaces

Right now, there is no clear definition of how transfer.hideRefs should
behave when a namespace is set. Explain that hideRefs prefixes match
stripped names in that case. This is how hideRefs patterns are currently
handled in receive-pack.

Signed-off-by: Lukas Fleischer <lfleischer@lfos.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Sync with maintJunio C Hamano Tue, 3 Nov 2015 23:41:50 +0000 (15:41 -0800)

Sync with maint

Merge branch 'mk/blame-error-message' into maintJunio C Hamano Tue, 3 Nov 2015 23:32:42 +0000 (15:32 -0800)

Merge branch 'mk/blame-error-message' into maint

The error message from "git blame --contents --reverse" incorrectly
talked about "--contents --children".

* mk/blame-error-message:
blame: fix option name in error message

Merge branch 'jk/merge-file-exit-code' into maintJunio C Hamano Tue, 3 Nov 2015 23:32:41 +0000 (15:32 -0800)

Merge branch 'jk/merge-file-exit-code' into maint

"git merge-file" tried to signal how many conflicts it found, which
obviously would not work well when there are too many of them.

* jk/merge-file-exit-code:
merge-file: clamp exit code to maximum 127

Merge branch 'dt/name-hash-dir-entry-fix' into maintJunio C Hamano Tue, 3 Nov 2015 23:32:40 +0000 (15:32 -0800)

Merge branch 'dt/name-hash-dir-entry-fix' into maint

The name-hash subsystem that is used to cope with case insensitive
filesystems keeps track of directories and their on-filesystem
cases for all the paths in the index by holding a pointer to a
randomly chosen cache entry that is inside the directory (for its
ce->ce_name component). This pointer was not updated even when the
cache entry was removed from the index, leading to use after free.
This was fixed by recording the path for each directory instead of
borrowing cache entries and restructuring the API somewhat.

* dt/name-hash-dir-entry-fix:
name-hash: don't reuse cache_entry in dir_entry

Merge branch 'jc/am-3-fallback-regression-fix' into... Junio C Hamano Tue, 3 Nov 2015 23:32:39 +0000 (15:32 -0800)

Merge branch 'jc/am-3-fallback-regression-fix' into maint

"git am -3" had a small regression where it is aborted in its error
handling codepath when underlying merge-recursive failed in certain
ways, as it assumed that the internal call to merge-recursive will
never die, which is not the case (yet).

* jc/am-3-fallback-regression-fix:
am -3: do not let failed merge from completing the error codepath

Merge branch 'jc/usage-stdin' into maintJunio C Hamano Tue, 3 Nov 2015 23:32:38 +0000 (15:32 -0800)

Merge branch 'jc/usage-stdin' into maint

The synopsis text and the usage string of subcommands that read
list of things from the standard input are often shown as if they
only take input from a file on a filesystem, which was misleading.

* jc/usage-stdin:
usage: do not insist that standard input must come from a file

Merge branch 'rt/placeholder-in-usage' into maintJunio C Hamano Tue, 3 Nov 2015 23:32:37 +0000 (15:32 -0800)

Merge branch 'rt/placeholder-in-usage' into maint

A couple of commands still showed "[options]" in their usage string
to note where options should come on their command line, but we
spell that "[<options>]" in most places these days.

* rt/placeholder-in-usage:
am, credential-cache: add angle brackets to usage string

Merge branch 'dt/t7063-fix-flaky-test' into maintJunio C Hamano Tue, 3 Nov 2015 23:32:36 +0000 (15:32 -0800)

Merge branch 'dt/t7063-fix-flaky-test' into maint

* dt/t7063-fix-flaky-test:
t7063: fix flaky untracked-cache test

Merge branch 'mk/submodule-gitdir-path' into maintJunio C Hamano Tue, 3 Nov 2015 23:32:34 +0000 (15:32 -0800)

Merge branch 'mk/submodule-gitdir-path' into maint

The submodule code has been taught to work better with separate
work trees created via "git worktree add".

* mk/submodule-gitdir-path:
path: implement common_dir handling in git_pathdup_submodule()
submodule refactor: use strbuf_git_path_submodule() in add_submodule_odb()

Merge branch 'nd/gc-auto-background-fix' into maintJunio C Hamano Tue, 3 Nov 2015 23:32:33 +0000 (15:32 -0800)

Merge branch 'nd/gc-auto-background-fix' into maint

When "git gc --auto" is backgrounded, its diagnosis message is
lost. Save it to a file in $GIT_DIR and show it next time the "gc
--auto" is run.

* nd/gc-auto-background-fix:
gc: save log from daemonized gc --auto and print it next time

Merge branch 'ls/p4-translation-failure' into maintJunio C Hamano Tue, 3 Nov 2015 23:32:31 +0000 (15:32 -0800)

Merge branch 'ls/p4-translation-failure' into maint

Work around "git p4" failing when the P4 depot records the contents
in UTF-16 without UTF-16 BOM.

* ls/p4-translation-failure:
git-p4: handle "Translation of file content failed"
git-p4: add test case for "Translation of file content failed" error

Merge branch 'gr/rebase-i-drop-warn' into maintJunio C Hamano Tue, 3 Nov 2015 23:32:30 +0000 (15:32 -0800)

Merge branch 'gr/rebase-i-drop-warn' into maint

Recent update to "rebase -i" that tries to sanity check the edited
insn sheet before it uses it has become too picky on Windows where
CRLF left by the editor is turned into a trailing CR on the line
read via the "read" built-in command.

* gr/rebase-i-drop-warn:
rebase-i: work around Windows CRLF line endings
t3404: "rebase -i" gets broken when insn sheet uses CR/LF line endings

Merge branch 'js/clone-dissociate' into maintJunio C Hamano Tue, 3 Nov 2015 23:32:28 +0000 (15:32 -0800)

Merge branch 'js/clone-dissociate' into maint

"git clone --dissociate" runs a big "git repack" process at the
end, and it helps to close file descriptors that are open on the
packs and their idx files before doing so on filesystems that
cannot remove a file that is still open.

* js/clone-dissociate:
clone --dissociate: avoid locking pack files
sha1_file.c: add a function to release all packs
sha1_file: consolidate code to close a pack's file descriptor
t5700: demonstrate a Windows file locking issue with `git clone --dissociate`

Merge branch 'ld/p4-import-labels' into maintJunio C Hamano Tue, 3 Nov 2015 23:32:27 +0000 (15:32 -0800)

Merge branch 'ld/p4-import-labels' into maint

Correct "git p4 --detect-labels" so that it does not fail to create
a tag that points at a commit that is also being imported.

* ld/p4-import-labels:
git-p4: fix P4 label import for unprocessed commits
git-p4: do not terminate creating tag for unknown commit
git-p4: failing test for ignoring invalid p4 labels

Merge branch 'tk/stripspace' into maintJunio C Hamano Tue, 3 Nov 2015 23:32:26 +0000 (15:32 -0800)

Merge branch 'tk/stripspace' into maint

The internal stripspace() function has been moved to where it
logically belongs to, i.e. strbuf API, and the command line parser
of "git stripspace" has been updated to use the parse_options API.

* tk/stripspace:
stripspace: use parse-options for command-line parsing
strbuf: make stripspace() part of strbuf

Merge branch 'jk/repository-extension' into maintJunio C Hamano Tue, 3 Nov 2015 23:32:25 +0000 (15:32 -0800)

Merge branch 'jk/repository-extension' into maint

Prepare for Git on-disk repository representation to undergo
backward incompatible changes by introducing a new repository
format version "1", with an extension mechanism.

* jk/repository-extension:
introduce "preciousObjects" repository extension
introduce "extensions" form of core.repositoryformatversion

Tenth batch for 2.7Junio C Hamano Tue, 3 Nov 2015 23:18:22 +0000 (15:18 -0800)

Tenth batch for 2.7

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

Merge branch 'rs/daemon-plug-child-leak'Junio C Hamano Tue, 3 Nov 2015 23:13:11 +0000 (15:13 -0800)

Merge branch 'rs/daemon-plug-child-leak'

"git daemon" uses "run_command()" without "finish_command()", so it
needs to release resources itself, which it forgot to do.

* rs/daemon-plug-child-leak:
daemon: plug memory leak
run-command: factor out child_process_clear()

Merge branch 'mk/blame-first-parent'Junio C Hamano Tue, 3 Nov 2015 23:13:09 +0000 (15:13 -0800)

Merge branch 'mk/blame-first-parent'

"git blame" learnt to take "--first-parent" and "--reverse" at the
same time when it makes sense.

* mk/blame-first-parent:
blame: allow blame --reverse --first-parent when it makes sense
blame: extract find_single_final
blame: test to describe use of blame --reverse --first-parent

Merge branch 'rs/wt-status-detached-branch-fix'Junio C Hamano Tue, 3 Nov 2015 23:13:08 +0000 (15:13 -0800)

Merge branch 'rs/wt-status-detached-branch-fix'

"git status --branch --short" accessed beyond the constant string
"HEAD", which has been corrected.

* rs/wt-status-detached-branch-fix:
wt-status: use skip_prefix() to get rid of magic string length constants
wt-status: don't skip a magical number of characters blindly
wt-status: avoid building bogus branch name with detached HEAD
wt-status: exit early using goto in wt_shortstatus_print_tracking()
t7060: add test for status --branch on a detached HEAD

Merge branch 'rs/show-branch-argv-array'Junio C Hamano Tue, 3 Nov 2015 23:13:06 +0000 (15:13 -0800)

Merge branch 'rs/show-branch-argv-array'

Code simplification.

* rs/show-branch-argv-array:
show-branch: use argv_array for default arguments

Merge branch 'js/git-gdb'Junio C Hamano Tue, 3 Nov 2015 23:13:05 +0000 (15:13 -0800)

Merge branch 'js/git-gdb'

Allow easier debugging of a single "git" invocation in our test
scripts.

* js/git-gdb:
test: facilitate debugging Git executables in tests with gdb

Merge branch 'jk/initialization-fix-to-add-submodule... Junio C Hamano Tue, 3 Nov 2015 23:13:04 +0000 (15:13 -0800)

Merge branch 'jk/initialization-fix-to-add-submodule-odb'

We peek objects from submodule's object store by linking it to the
list of alternate object databases, but the code to do so forgot to
correctly initialize the list.

* jk/initialization-fix-to-add-submodule-odb:
add_submodule_odb: initialize alt_odb list earlier

Merge branch 'da/difftool'Junio C Hamano Tue, 3 Nov 2015 23:13:01 +0000 (15:13 -0800)

Merge branch 'da/difftool'

The code to prepare the working tree side of temporary directory
for the "dir-diff" feature forgot that symbolic links need not be
copied (or symlinked) to the temporary area, as the code already
special cases and overwrites them. Besides, it was wrong to try
computing the object name of the target of symbolic link, which may
not even exist or may be a directory.

* da/difftool:
difftool: ignore symbolic links in use_wt_file

Merge branch 'jc/mailinfo-lib'Junio C Hamano Tue, 3 Nov 2015 23:12:59 +0000 (15:12 -0800)

Merge branch 'jc/mailinfo-lib'

Hotfix for a topic already in 'master'.

* jc/mailinfo-lib:
mailinfo: fix passing wrong address to git_mailinfo_config

Merge branch 'kn/for-each-branch'Junio C Hamano Tue, 3 Nov 2015 23:12:55 +0000 (15:12 -0800)

Merge branch 'kn/for-each-branch'

Using the timestamp based criteria in "git branch --sort" did not
tiebreak branches that point at commits with the same timestamp (or
the same commit), making the resulting output unstable.

* kn/for-each-branch:
ref-filter: fallback on alphabetical comparison

daemon: plug memory leakRené Scharfe Sat, 24 Oct 2015 12:23:20 +0000 (14:23 +0200)

daemon: plug memory leak

Call child_process_clear() when a child ends to release the memory
allocated for its environment. This is necessary because unlike all
other users of start_command() we don't call finish_command(), which
would have taken care of that for us.

This leak was introduced by f063d38b (daemon: use cld->env_array
when re-spawning).

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

run-command: factor out child_process_clear()René Scharfe Sat, 24 Oct 2015 12:11:27 +0000 (14:11 +0200)

run-command: factor out child_process_clear()

Avoid duplication by moving the code to release allocated memory for
arguments and environment to its own function, child_process_clear().
Export it to provide a counterpart to child_process_init().

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mailinfo: fix passing wrong address to git_mailinfo_configNguyễn Thái Ngọc Duy Sun, 1 Nov 2015 14:30:30 +0000 (15:30 +0100)

mailinfo: fix passing wrong address to git_mailinfo_config

git_mailinfo_config() expects "struct mailinfo *". But in
setup_mailinfo(), "mi" is already "struct mailinfo *". &mi would make
it "struct mailinfo **" and git_mailinfo_config() would damage some
other memory when it assigns some value to mi->use_scissors.

This is caught by t4150.20. git_mailinfo_config() breaks
mi->name.alloc and makes strbuf_release() in clear_mailinfo() attempt
to free strbuf_slopbuf.

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

show-branch: use argv_array for default argumentsRené Scharfe Sat, 31 Oct 2015 19:06:45 +0000 (20:06 +0100)

show-branch: use argv_array for default arguments

Use argv_array instead of open-coding it.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

wt-status: use skip_prefix() to get rid of magic string... René Scharfe Sat, 31 Oct 2015 17:37:43 +0000 (18:37 +0100)

wt-status: use skip_prefix() to get rid of magic string length constants

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

wt-status: don't skip a magical number of characters... René Scharfe Sat, 31 Oct 2015 17:37:12 +0000 (18:37 +0100)

wt-status: don't skip a magical number of characters blindly

Use the variable branch_name, which already has "refs/heads/" removed,
instead of blindly advancing in the ->branch string by 11 bytes. This
is safer and less magical.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

wt-status: avoid building bogus branch name with detach... René Scharfe Sat, 31 Oct 2015 17:36:35 +0000 (18:36 +0100)

wt-status: avoid building bogus branch name with detached HEAD

If we're on a detached HEAD then wt_shortstatus_print_tracking() takes
the string "HEAD (no branch)", translates it, skips the first eleven
characters and passes the result to branch_get(), which returns a bogus
result and accesses memory out of bounds in order to produce it.
Somehow stat_tracking_info(), which is passed that result, does the
right thing anyway, i.e. it finds that there is no base.

Avoid the bogus results and memory accesses by checking for HEAD first
and exiting early in that case. This fixes t7060 with --valgrind.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

wt-status: exit early using goto in wt_shortstatus_prin... René Scharfe Sat, 31 Oct 2015 17:36:01 +0000 (18:36 +0100)

wt-status: exit early using goto in wt_shortstatus_print_tracking()

Deduplicate printing the line terminator by jumping to the end of the
function.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t7060: add test for status --branch on a detached HEADRené Scharfe Sat, 31 Oct 2015 17:35:32 +0000 (18:35 +0100)

t7060: add test for status --branch on a detached HEAD

This test fails when run under Valgrind because branch_get() gets passed
a bogus branch name pointer:

==62831== Invalid read of size 1
==62831== at 0x4F76AE: branch_get (remote.c:1650)
==62831== by 0x53499E: wt_shortstatus_print_tracking (wt-status.c:1654)
==62831== by 0x53499E: wt_shortstatus_print (wt-status.c:1706)
==62831== by 0x428D29: cmd_status (commit.c:1384)
==62831== by 0x405D6D: run_builtin (git.c:350)
==62831== by 0x405D6D: handle_builtin (git.c:536)
==62831== by 0x404F10: run_argv (git.c:582)
==62831== by 0x404F10: main (git.c:690)
==62831== Address 0x5e89b0b is 6 bytes after a block of size 5 alloc'd
==62831== at 0x4C28C4F: malloc (vg_replace_malloc.c:299)
==62831== by 0x59579E9: strdup (strdup.c:42)
==62831== by 0x52E108: xstrdup (wrapper.c:43)
==62831== by 0x5322A6: wt_status_prepare (wt-status.c:130)
==62831== by 0x4276E0: status_init_config (commit.c:184)
==62831== by 0x428BB8: cmd_status (commit.c:1350)
==62831== by 0x405D6D: run_builtin (git.c:350)
==62831== by 0x405D6D: handle_builtin (git.c:536)
==62831== by 0x404F10: run_argv (git.c:582)
==62831== by 0x404F10: main (git.c:690)

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

blame: allow blame --reverse --first-parent when it... Max Kirillov Fri, 30 Oct 2015 05:01:53 +0000 (07:01 +0200)

blame: allow blame --reverse --first-parent when it makes sense

Allow combining --reverse and --first-parent if initial commit of
specified range is at the first-parent chain starting from the final
commit. Disable the prepare_revision_walk()'s builtin children
collection, instead picking only the ones which are along the first
parent chain.

Signed-off-by: Max Kirillov <max@max630.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

blame: extract find_single_finalMax Kirillov Fri, 30 Oct 2015 05:01:52 +0000 (07:01 +0200)

blame: extract find_single_final

Signed-off-by: Max Kirillov <max@max630.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

blame: test to describe use of blame --reverse --first... Max Kirillov Fri, 30 Oct 2015 05:01:51 +0000 (07:01 +0200)

blame: test to describe use of blame --reverse --first-parent

Reverse blame can be used to locate removal of lines which does not
change adjacent lines. Such edits do not appear in non-reverse blame,
because the adjacent lines last changed commit is older history, before
the edit.

For a big and active project which uses topic branches, or analogous
feature, for example pull-requests, the history can contain many
concurrent branches, and even after an edit merged into the target
branch, there are still many (sometimes several tens or even hundreds)
topic branch which do not contain it:

a0--a1-----*a2-*a3-a4...-*a100
|\ / / /
| b0-B1..bN / /
|\ / /
| c0.. ..cN /
\ /
z0.. ..zN

Here, the '*'s mark the first parent in merge, and uppercase B1 - the
commit where the line being blamed for was removed. Since commits cN-zN
do not contain B1, they still have the line removed in B1, and
reverse blame can report that the last commit for the line was zN
(meaning that it was removed in a100). In fact it really does return
some very late commit, and this makes it unusable for finding the B1
commit.

The search could be done by blame --reverse --first-parent. For range
a0..a100 it would return a1, and then only one additional blame along
the a0..bN will return the desired commit b0. But combining --reverse
and --first-parent was forbidden in 95a4fb0eac, because incorrectly
specified range could produce unexpected and meaningless result.

Add test which describes the expected behavior of
`blame --reverse --first-parent` in the case described above.

Signed-off-by: Max Kirillov <max@max630.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

test: facilitate debugging Git executables in tests... Johannes Schindelin Fri, 30 Oct 2015 19:02:56 +0000 (12:02 -0700)

test: facilitate debugging Git executables in tests with gdb

When prefixing a Git call in the test suite with 'debug ', it will
now be run with GDB, allowing the developer to debug test failures
more conveniently.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

ref-filter: fallback on alphabetical comparisonKarthik Nayak Fri, 30 Oct 2015 08:45:28 +0000 (14:15 +0530)

ref-filter: fallback on alphabetical comparison

In ref-filter.c the comparison of refs while sorting is handled by
cmp_ref_sorting() function. When sorting as per numerical values
(e.g. --sort=objectsize) there is no fallback comparison when both
refs hold the same value. This can cause unexpected results (i.e. the
order of listing refs with equal values cannot be pre-determined) as
pointed out by Johannes Sixt ($gmane/280117).

Hence, fallback to alphabetical comparison based on the refname
whenever the other criterion is equal.

A test in t3203 was expecting that branch-two sorts before HEAD, which
happened to be how qsort(3) on Linux sorted the array, but (1) that
outcome was not even guaranteed, and (2) once we start breaking ties
with the refname, "HEAD" should sort before "branch-two" so the
original expectation was inconsistent with the criterion we now use.

Update it to match the new world order, which we can now depend on
being stable.

Helped-by: Junio C Hamano <gitster@pobox.com>
Reported-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Karthik Nayak <Karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ninth batch for 2.7Junio C Hamano Fri, 30 Oct 2015 20:17:31 +0000 (13:17 -0700)

Ninth batch for 2.7

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

Merge branch 'jk/merge-file-exit-code'Junio C Hamano Fri, 30 Oct 2015 20:07:08 +0000 (13:07 -0700)

Merge branch 'jk/merge-file-exit-code'

"git merge-file" tried to signal how many conflicts it found, which
obviously would not work well when there are too many of them.

* jk/merge-file-exit-code:
merge-file: clamp exit code to maximum 127

Merge branch 'gr/rebase-i-drop-warn'Junio C Hamano Fri, 30 Oct 2015 20:07:06 +0000 (13:07 -0700)

Merge branch 'gr/rebase-i-drop-warn'

Recent update to "rebase -i" that tries to sanity check the edited
insn sheet before it uses it has become too picky on Windows where
CRLF left by the editor is turned into a trailing CR on the line
read via the "read" built-in command.

* gr/rebase-i-drop-warn:
rebase-i: work around Windows CRLF line endings
t3404: "rebase -i" gets broken when insn sheet uses CR/LF line endings

Merge branch 'xf/user-manual-ff'Junio C Hamano Fri, 30 Oct 2015 20:07:05 +0000 (13:07 -0700)

Merge branch 'xf/user-manual-ff'

* xf/user-manual-ff:
user-manual: fix the description of fast-forward

Merge branch 'rs/pop-commit'Junio C Hamano Fri, 30 Oct 2015 20:07:03 +0000 (13:07 -0700)

Merge branch 'rs/pop-commit'

Code simplification.

* rs/pop-commit:
use pop_commit() for consuming the first entry of a struct commit_list

Merge branch 'mk/blame-error-message'Junio C Hamano Fri, 30 Oct 2015 20:07:01 +0000 (13:07 -0700)

Merge branch 'mk/blame-error-message'

The error message from "git blame --contents --reverse" incorrectly
talked about "--contents --children".

* mk/blame-error-message:
blame: fix option name in error message

Merge branch 'js/misc-fixes'Junio C Hamano Fri, 30 Oct 2015 20:06:59 +0000 (13:06 -0700)

Merge branch 'js/misc-fixes'

Various compilation fixes and squelching of warnings.

* js/misc-fixes:
Correct fscanf formatting string for I64u values
Silence GCC's "cast of pointer to integer of a different size" warning
Squelch warning about an integer overflow

Merge branch 'js/imap-send-curl-compilation-fix'Junio C Hamano Fri, 30 Oct 2015 20:06:58 +0000 (13:06 -0700)

Merge branch 'js/imap-send-curl-compilation-fix'

"git imap-send" did not compile well with older version of cURL library.

* js/imap-send-curl-compilation-fix:
imap-send: only use CURLOPT_LOGIN_OPTIONS if it is actually available

Merge branch 'jk/delete-modechange-conflict'Junio C Hamano Fri, 30 Oct 2015 20:06:56 +0000 (13:06 -0700)

Merge branch 'jk/delete-modechange-conflict'

Merging a branch that removes a path and another that changes the
mode bits on the same path should have conflicted at the path, but
it didn't and silently favoured the removal.

* jk/delete-modechange-conflict:
merge: detect delete/modechange conflict
t6031: generalize for recursive and resolve strategies
t6031: move triple-rename test to t3030

Merge branch 'jc/add-u-A-default-to-top'Junio C Hamano Fri, 30 Oct 2015 20:06:55 +0000 (13:06 -0700)

Merge branch 'jc/add-u-A-default-to-top'

"git --literal-pathspecs add -u/-A" without any command line
argument misbehaved ever since Git 2.0.

* jc/add-u-A-default-to-top:
add: simplify -u/-A without pathspec

Merge branch 'ar/clone-dissociate'Junio C Hamano Fri, 30 Oct 2015 20:06:53 +0000 (13:06 -0700)

Merge branch 'ar/clone-dissociate'

"git clone --dissociate" used to require that "--reference" was
used at the same time, but you can create a new repository that
borrows objects from another without using "--reference", namely
with "clone --local" from a repository that borrows objects from
other repositories.

* ar/clone-dissociate:
clone: allow "--dissociate" without reference

Merge git://ozlabs.org/~paulus/gitkJunio C Hamano Fri, 30 Oct 2015 16:02:27 +0000 (09:02 -0700)

Merge git://ozlabs.org/~paulus/gitk

* git://ozlabs.org/~paulus/gitk:
gitk: Update Russian translation
gitk: Add accelerator to German locale
gitk: Add accelerators to Japanese locale
gitk: Update msgid's for menu items with accelerator
gitk: l10n: Update Catalan translation
gitk: Add missing accelerators
Updated Vietnamese translation

Merge https://github.com/vnwildman/gitkPaul Mackerras Fri, 30 Oct 2015 10:01:55 +0000 (21:01 +1100)

Merge https://github.com/vnwildman/gitk

This brings in an update to the Vietnamese translation.

Signed-off-by: Paul Mackerras <paulus@samba.org>

gitk: Update Russian translationDimitriy Ryazantcev Tue, 13 Oct 2015 09:52:46 +0000 (12:52 +0300)

gitk: Update Russian translation

Signed-off-by: Dimitriy Ryazantcev <dimitriy.ryazantcev@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>

gitk: Add accelerator to German localeTakashi Iwai Tue, 20 Oct 2015 12:33:04 +0000 (14:33 +0200)

gitk: Add accelerator to German locale

Assigned either to the first letter or some unique letter. At least
there are no conflicts, as far as I see...

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>

gitk: Add accelerators to Japanese localeTakashi Iwai Tue, 20 Oct 2015 12:33:03 +0000 (14:33 +0200)

gitk: Add accelerators to Japanese locale

Just follow the English accelerator keys.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>

gitk: Update msgid's for menu items with acceleratorTakashi Iwai Tue, 20 Oct 2015 12:33:02 +0000 (14:33 +0200)

gitk: Update msgid's for menu items with accelerator

The commit d99b4b0de27a ("gitk: Accelerators for the main menu")
modified the menu item strings with the accelerator, but the
translations didn't follow, thus the menus are shown without
translations.

This patch systematically update the msgid keys just to follow this
change. The contents aren't changed, so the accelerator won't work in
these locales for now. Each locale translator needs to add proper
acceleration keys appropriately.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>

gitk: l10n: Update Catalan translationAlex Henrie Tue, 6 Oct 2015 04:26:12 +0000 (22:26 -0600)

gitk: l10n: Update Catalan translation

The gitk included in git 2.6.0 crashes if run from a Catalan locale.
I'm hoping that a translation update will fix this.

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>

gitk: Add missing acceleratorsBeat Bolli Wed, 30 Sep 2015 19:50:11 +0000 (21:50 +0200)

gitk: Add missing accelerators

In d99b4b0de27a ("gitk: Accelerators for the main menu", 2015-09-09),
accelerators were added to allow efficient keyboard navigation. One
instance of the strings "Edit view..." and "Delete view" were left
without the ampersand.

Add the missing ampersand characters to unbreak our international
users.

Signed-off-by: Beat Bolli <dev+git@drbeat.li>
Signed-off-by: Paul Mackerras <paulus@samba.org>

Eighth batch for 2.7Junio C Hamano Thu, 29 Oct 2015 21:02:40 +0000 (14:02 -0700)

Eighth batch for 2.7

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

Merge branch 'jc/am-mailinfo-direct'Junio C Hamano Thu, 29 Oct 2015 20:59:23 +0000 (13:59 -0700)

Merge branch 'jc/am-mailinfo-direct'

"git am" used to spawn "git mailinfo" via run_command() API once
per each patch, but learned to make a direct call to mailinfo()
instead.

* jc/am-mailinfo-direct:
am: make direct call to mailinfo

Merge branch 'jc/mailinfo-lib'Junio C Hamano Thu, 29 Oct 2015 20:59:21 +0000 (13:59 -0700)

Merge branch 'jc/mailinfo-lib'

The implementation of "git mailinfo" was refactored so that a
mailinfo() function can be directly called from inside a process.

* jc/mailinfo-lib: (34 commits)
mailinfo: remove calls to exit() and die() deep in the callchain
mailinfo: handle charset conversion errors in the caller
mailinfo: libify
mailinfo: keep the parsed log message in a strbuf
mailinfo: handle_commit_msg() shouldn't be called after finding patchbreak
mailinfo: move content/content_top to struct mailinfo
mailinfo: move [ps]_hdr_data to struct mailinfo
mailinfo: move cmitmsg and patchfile to struct mailinfo
mailinfo: move charset to struct mailinfo
mailinfo: move transfer_encoding to struct mailinfo
mailinfo: move check for metainfo_charset to convert_to_utf8()
mailinfo: move metainfo_charset to struct mailinfo
mailinfo: move use_scissors and use_inbody_headers to struct mailinfo
mailinfo: move add_message_id and message_id to struct mailinfo
mailinfo: move patch_lines to struct mailinfo
mailinfo: move filter/header stage to struct mailinfo
mailinfo: move global "FILE *fin, *fout" to struct mailinfo
mailinfo: move keep_subject & keep_non_patch_bracket to struct mailinfo
mailinfo: introduce "struct mailinfo" to hold globals
mailinfo: move global "line" into mailinfo() function
...

Merge branch 'rp/link-curl-before-ssl'Junio C Hamano Thu, 29 Oct 2015 20:59:20 +0000 (13:59 -0700)

Merge branch 'rp/link-curl-before-ssl'

The linkage order of libraries was wrong in places around libcurl.

* rp/link-curl-before-ssl:
configure.ac: detect ssl need with libcurl
Makefile: make curl-config path configurable
Makefile: link libcurl before zlib

Merge branch 'dt/name-hash-dir-entry-fix'Junio C Hamano Thu, 29 Oct 2015 20:59:19 +0000 (13:59 -0700)

Merge branch 'dt/name-hash-dir-entry-fix'

The name-hash subsystem that is used to cope with case insensitive
filesystems keeps track of directories and their on-filesystem
cases for all the paths in the index by holding a pointer to a
randomly chosen cache entry that is inside the directory (for its
ce->ce_name component). This pointer was not updated even when the
cache entry was removed from the index, leading to use after free.
This was fixed by recording the path for each directory instead of
borrowing cache entries and restructuring the API somewhat.

* dt/name-hash-dir-entry-fix:
name-hash: don't reuse cache_entry in dir_entry

Merge branch 'tk/sigchain-unnecessary-post-tempfile'Junio C Hamano Thu, 29 Oct 2015 20:59:17 +0000 (13:59 -0700)

Merge branch 'tk/sigchain-unnecessary-post-tempfile'

Remove no-longer used #include.

* tk/sigchain-unnecessary-post-tempfile:
shallow: remove unused #include "sigchain.h"
read-cache: remove unused #include "sigchain.h"
diff: remove unused #include "sigchain.h"
credential-cache--daemon: remove unused #include "sigchain.h"

Merge branch 'jk/war-on-sprintf'Junio C Hamano Thu, 29 Oct 2015 20:59:17 +0000 (13:59 -0700)

Merge branch 'jk/war-on-sprintf'

* jk/war-on-sprintf:
compat/mingw.c: remove printf format warning
read_branches_file: plug a FILE* leak

Merge branch 'jc/em-dash-in-doc'Junio C Hamano Thu, 29 Oct 2015 20:59:16 +0000 (13:59 -0700)

Merge branch 'jc/em-dash-in-doc'

AsciiDoc markup fixes.

* jc/em-dash-in-doc:
Documentation: AsciiDoc spells em-dash as double-dashes, not triple

Merge branch 'jc/everyday-markup'Junio C Hamano Thu, 29 Oct 2015 20:59:15 +0000 (13:59 -0700)

Merge branch 'jc/everyday-markup'

AsciiDoc markup fixes.

* jc/everyday-markup:
Documentation/everyday: match undefline with the text

Merge branch 'xf/user-manual-markup'Junio C Hamano Thu, 29 Oct 2015 20:59:14 +0000 (13:59 -0700)

Merge branch 'xf/user-manual-markup'

AsciiDoc markup fixes.

* xf/user-manual-markup:
Documentation: match undefline with the text in old release notes
Documentation: match underline with the text
Documentation: fix header markup

difftool: ignore symbolic links in use_wt_fileDavid Aguilar Thu, 29 Oct 2015 18:19:01 +0000 (11:19 -0700)

difftool: ignore symbolic links in use_wt_file

The caller is preparing a narrowed-down copy of the working tree and
this function is asked if the path should be included in that copy.
If we say yes, the path from the working tree will be either symlinked
or copied into the narrowed-down copy.

For any path that is a symbolic link, the caller later fixes up the
narrowed-down copy by unlinking the path and replacing it with a
regular file it writes out that mimics the way how "git diff"
compares symbolic links.

Let's answer "no, you do not want to copy/symlink the working tree
file" for all symbolic links from this function, as we know the
result will not be used because it will be overwritten anyway.

Incidentally, this also stops the function from feeding a symbolic
link in the working tree to hash-object, which is a wrong thing to
do to begin with. The link may be pointing at a directory, or worse
may be dangling (both would be noticed as an error). Even if the
link points at a regular file, hashing the contents of a file that
is pointed at by the link is not correct (Git hashes the contents of
the link itself, not the pointee).

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

merge-file: clamp exit code to maximum 127Jeff King Wed, 28 Oct 2015 22:44:21 +0000 (18:44 -0400)

merge-file: clamp exit code to maximum 127

Git-merge-file is documented to return one of three exit
codes:

- zero means the merge was successful

- a negative number means an error occurred

- a positive number indicates the number of conflicts

Unfortunately, this all gets stuffed into an 8-bit return
code. Which means that if you have 256 conflicts, this wraps
to zero, and the merge appears to succeed (and commits a
blob full of conflict-marker cruft!).

This patch clamps the return value to a maximum of 127,
which we should be able to safely represent everywhere. This
also leaves 128-255 for other values. Shells (and some parts
of git) will typically represent signal death as 128 plus
the signal number. And negative values are typically coerced
to an 8-bit unsigned value (so "return -1" ends up as 255).

Technically negative returns have the same problem (e.g.,
"-256" wraps back to 0), but this is not a problem in
practice, as the only negative value we use is "-1".

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

rebase-i: work around Windows CRLF line endingsJunio C Hamano Wed, 28 Oct 2015 14:54:48 +0000 (15:54 +0100)

rebase-i: work around Windows CRLF line endings

Editors on Windows can and do save text files with CRLF line
endings, which is the convention on the platform. We are seeing
reports that the "read" command in a port of bash to the environment
however does not strip the CRLF at the end, not adjusting for the
same convention on the platform.

This breaks the recently added sanity checks for the insn sheet fed
to "rebase -i"; instead of an empty line (hence nothing in $command),
the script was getting a lone CR in there.

Special case a lone CR and treat it the same way as an empty line to
work this around.

This patch (also) passes the test with Git for Windows, where the
issue was seen first.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t3404: "rebase -i" gets broken when insn sheet uses... Johannes Schindelin Wed, 28 Oct 2015 14:54:21 +0000 (15:54 +0100)

t3404: "rebase -i" gets broken when insn sheet uses CR/LF line endings

Based on a bug report by Chad Boles.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

add_submodule_odb: initialize alt_odb list earlierJeff King Wed, 28 Oct 2015 14:07:25 +0000 (10:07 -0400)

add_submodule_odb: initialize alt_odb list earlier

The add_submodule_odb function tries to add a submodule's
object store as an "alternate". It needs the existing list
to be initialized (from the objects/info/alternates file)
for two reasons:

1. We look for duplicates with the existing alternate
stores, but obviously this doesn't work if we haven't
loaded any yet.

2. We link our new entry into the list by prepending it to
alt_odb_list. But we do _not_ modify alt_odb_tail.
This variable starts as NULL, and is a signal to the
alt_odb code that the list has not yet been
initialized.

We then call read_info_alternates on the submodule (to
recursively load its alternates), which will try to
append to that tail, assuming it has been initialized.
This causes us to segfault if it is NULL.

This rarely comes up in practice, because we will have
initialized the alt_odb any time we do an object lookup. So
you can trigger this only when:

- you try to access a submodule (e.g., a diff with
diff.submodule=log)

- the access happens before any other object has been
accessed (e.g., because the diff is between the working
tree and the index)

- the submodule contains an alternates file (so we try to
add an entry to the NULL alt_odb_tail)

To fix this, we just need to call prepare_alt_odb at the
start of the function (and if we have already initialized,
it is a noop).

Note that we can remove the prepare_alt_odb call from the
end. It is guaranteed to be a noop, since we will have
called it earlier.

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

Seventh batch for 2.7Junio C Hamano Mon, 26 Oct 2015 23:02:08 +0000 (16:02 -0700)

Seventh batch for 2.7

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

Merge branch 'dk/p4-import-ctypes'Junio C Hamano Mon, 26 Oct 2015 22:55:26 +0000 (15:55 -0700)

Merge branch 'dk/p4-import-ctypes'

"git-p4" tried to use from ctypes module without first importing
it.

* dk/p4-import-ctypes:
git-p4: import the ctypes module

Merge branch 'jk/repository-extension'Junio C Hamano Mon, 26 Oct 2015 22:55:24 +0000 (15:55 -0700)

Merge branch 'jk/repository-extension'

Prepare for Git on-disk repository representation to undergo
backward incompatible changes by introducing a new repository
format version "1", with an extension mechanism.

* jk/repository-extension:
introduce "preciousObjects" repository extension
introduce "extensions" form of core.repositoryformatversion

Merge branch 'dt/t7063-fix-flaky-test'Junio C Hamano Mon, 26 Oct 2015 22:55:23 +0000 (15:55 -0700)

Merge branch 'dt/t7063-fix-flaky-test'

* dt/t7063-fix-flaky-test:
t7063: fix flaky untracked-cache test

Merge branch 'kn/for-each-tag'Junio C Hamano Mon, 26 Oct 2015 22:55:22 +0000 (15:55 -0700)

Merge branch 'kn/for-each-tag'

Recent update to "git tag --contains" caused a performance
regression.

* kn/for-each-tag:
tag.c: use the correct algorithm for the '--contains' option

Merge branch 'es/worktree-add'Junio C Hamano Mon, 26 Oct 2015 22:55:21 +0000 (15:55 -0700)

Merge branch 'es/worktree-add'

* es/worktree-add:
worktree: usage: denote <branch> as optional with 'add'

Merge branch 'tk/stripspace'Junio C Hamano Mon, 26 Oct 2015 22:55:20 +0000 (15:55 -0700)

Merge branch 'tk/stripspace'

The internal stripspace() function has been moved to where it
logically belongs to, i.e. strbuf API, and the command line parser
of "git stripspace" has been updated to use the parse_options API.

* tk/stripspace:
stripspace: use parse-options for command-line parsing
strbuf: make stripspace() part of strbuf

Merge branch 'rt/placeholder-in-usage'Junio C Hamano Mon, 26 Oct 2015 22:55:18 +0000 (15:55 -0700)

Merge branch 'rt/placeholder-in-usage'

A couple of commands still showed "[options]" in their usage string
to note where options should come on their command line, but we
spell that "[<options>]" in most places these days.

* rt/placeholder-in-usage:
am, credential-cache: add angle brackets to usage string

Merge branch 'jc/usage-stdin'Junio C Hamano Mon, 26 Oct 2015 22:55:17 +0000 (15:55 -0700)

Merge branch 'jc/usage-stdin'

The synopsis text and the usage string of subcommands that read
list of things from the standard input are often shown as if they
only take input from a file on a filesystem, which was misleading.

* jc/usage-stdin:
usage: do not insist that standard input must come from a file

Merge branch 'mr/worktree-list'Junio C Hamano Mon, 26 Oct 2015 22:55:16 +0000 (15:55 -0700)

Merge branch 'mr/worktree-list'

Add the "list" subcommand to "git worktree".

* mr/worktree-list:
worktree: add 'list' command
worktree: add details to the worktree struct
worktree: add a function to get worktree details
worktree: refactor find_linked_symref function
worktree: add top-level worktree.c

Merge branch 'jc/am-3-fallback-regression-fix'Junio C Hamano Mon, 26 Oct 2015 22:55:15 +0000 (15:55 -0700)

Merge branch 'jc/am-3-fallback-regression-fix'

"git am -3" had a small regression where it is aborted in its error
handling codepath when underlying merge-recursive failed in certain
ways, as it assumed that the internal call to merge-recursive will
never die, which is not the case (yet).

* jc/am-3-fallback-regression-fix:
am -3: do not let failed merge from completing the error codepath

merge: detect delete/modechange conflictJeff King Mon, 26 Oct 2015 21:39:39 +0000 (17:39 -0400)

merge: detect delete/modechange conflict

If one side deletes a file and the other changes its
content, we notice and report a conflict. However, if
instead of changing the content, we change only the mode,
the merge does not notice (and the mode change is silently
dropped).

The trivial index merge notices the problem and correctly
leaves the conflict in the index, but both merge-recursive
and merge-one-file will silently resolve this in favor of
the deletion. In many cases that is a sane resolution, but
we should be punting to the user whenever there is any
question. So let's detect and treat this as a conflict (in
both strategies).

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

t6031: generalize for recursive and resolve strategiesJeff King Mon, 26 Oct 2015 21:37:18 +0000 (17:37 -0400)

t6031: generalize for recursive and resolve strategies

This script tests the filemode handling of merge-recursive,
but we do not test the same thing for merge-resolve. Let's
generalize the script a little:

1. Break out the setup steps for each test into a separate
snippet.

2. For each test, run it twice; once with "-s recursive"
and once with "-s resolve". We can avoid repeating
ourselves by adding a function.

3. Since we have a nice abstracted function, we can make
our tests more thorough by testing both directions
(change on "ours" versus "theirs").

This improves our test coverage, and will make this the
place to add more tests related to merging mode changes.

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

t6031: move triple-rename test to t3030Jeff King Mon, 26 Oct 2015 21:36:18 +0000 (17:36 -0400)

t6031: move triple-rename test to t3030

The t6031 test was introduced to check filemode handling of
merge-recursive. Much later, an unrelated test was tacked on
to look at renames and d/f conflicts. This test does not
depend on anything that happened before (it actually blows
away any existing content in the test repo). Let's move it
to t3030, where there are more related tests.

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

use pop_commit() for consuming the first entry of a... René Scharfe Sat, 24 Oct 2015 16:21:31 +0000 (18:21 +0200)

use pop_commit() for consuming the first entry of a struct commit_list

Instead of open-coding the function pop_commit() just call it. This
makes the intent clearer and reduces code size.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Correct fscanf formatting string for I64u valuesWaldek Maleska Mon, 26 Oct 2015 13:15:33 +0000 (14:15 +0100)

Correct fscanf formatting string for I64u values

This fix is probably purely cosmetic because PRIuMAX is likely identical
to SCNuMAX. Nevertheless, when using a function of the scanf() family,
the correct interpolation to use is the latter, not the former.

Signed-off-by: Waldek Maleska <w.maleska@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Silence GCC's "cast of pointer to integer of a differen... Johannes Schindelin Mon, 26 Oct 2015 13:15:25 +0000 (14:15 +0100)

Silence GCC's "cast of pointer to integer of a different size" warning

When calculating hashes from pointers, it actually makes sense to cut
off the most significant bits. In that case, said warning does not make
a whole lot of sense.

So let's just work around it by casting the pointer first to intptr_t
and then casting up/down to the final integral type.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Squelch warning about an integer overflowJohannes Schindelin Mon, 26 Oct 2015 13:15:21 +0000 (14:15 +0100)

Squelch warning about an integer overflow

We cannot rely on long integers to have more than 32 bits.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

imap-send: only use CURLOPT_LOGIN_OPTIONS if it is... Johannes Schindelin Mon, 26 Oct 2015 13:14:58 +0000 (14:14 +0100)

imap-send: only use CURLOPT_LOGIN_OPTIONS if it is actually available

This fixes the compilation on an older Linux that was used to debug
test failures when upgrading Git for Windows to Git v2.3.0.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

blame: fix option name in error messageMax Kirillov Mon, 26 Oct 2015 05:29:00 +0000 (07:29 +0200)

blame: fix option name in error message

The option name used in blame's UI is `--reverse`.

Signed-off-by: Max Kirillov <max@max630.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

user-manual: fix the description of fast-forwardXue Fuqiao Sun, 25 Oct 2015 00:28:43 +0000 (08:28 +0800)

user-manual: fix the description of fast-forward

The "Fast-forward merges" section of user-manual.txt incorrectly
says if the current branch is a descendant of the other, Git will
perform a fast-forward merge, but it should the other way around.

Signed-off-by: Xue Fuqiao <xfq.free@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

add: simplify -u/-A without pathspecJunio C Hamano Sun, 25 Oct 2015 02:31:11 +0000 (19:31 -0700)

add: simplify -u/-A without pathspec

Since Git 2.0, "add -u" and "add -A" run from a subdirectory without
any pathspec mean "everything in the working tree" (before 2.0, they
were limited to the current directory). The limiting to the current
directory was implemented by inserting "." to the command line when
the end user did not give us any pathspec. At 2.0, we updated the
code to insert ":/" (instead of '.') to consider everything from the
top-level, by using a pathspec magic "top".

The call to parse_pathspec() using the command line arguments is,
however, made with PATHSPEC_PREFER_FULL option since 5a76aff1 (add:
convert to use parse_pathspec, 2013-07-14), which predates Git 2.0.
In retrospect, there was no need to turn "adding . to limit to the
directory" into "adding :/ to unlimit to everywhere" in Git 2.0;
instead we could just have done "if there is no pathspec on the
command line, just let it be". The parse_pathspec() then would give
us a pathspec that matches everything and all is well.

Incidentally such a simplification also fixes a corner case bug that
stems from the fact that ":/" does not necessarily mean any magic.
A user would say "git --literal-pathspecs add -u :/" from the
command line when she has a directory ':' and wants to add
everything in it (and she knows that her :/ will be taken as
'everything under the sun' magic pathspec unless she disables the
magic with --literal-pathspecs). The internal use of ':/' would
behave the same way as such an explicitly given ":/" when run with
"--literal-pathspecs", and will not add everything under the sun as
the code originally intended.

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

compat/mingw.c: remove printf format warningJohannes Sixt Fri, 23 Oct 2015 06:02:52 +0000 (08:02 +0200)

compat/mingw.c: remove printf format warning

5096d490 (convert trivial sprintf / strcpy calls to xsnprintf) converted
two sprintf calls. Now GCC warns that "format '%u' expects argument of
type 'unsigned int', but argument 4 has type 'long unsigned int'".
Instead of changing the format string, use a variable of type unsigned
in place of the typedef-ed type DWORD, which hides that it is actually an
unsigned long.

There is no correctness issue with the old code because unsigned long and
unsigned are always of the same size on Windows, even in 64-bit builds.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

read_branches_file: plug a FILE* leakJohannes Sixt Fri, 23 Oct 2015 06:02:51 +0000 (08:02 +0200)

read_branches_file: plug a FILE* leak

The earlier rewrite f28e3ab2 (read_branches_file: simplify string handling)
of read_branches_file() lost an fclose() call. Put it back.

As on Windows files that are open cannot be removed, the leak manifests in
a failure of 'git remote rename origin origin' when the remote's URL is
specified in .git/branches/origin, because by the time that the command
attempts to remove this file, it is still open.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>