gitweb.git
Git 2.15.1 v2.15.1Junio C Hamano Tue, 28 Nov 2017 04:39:14 +0000 (13:39 +0900)

Git 2.15.1

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

Merge branch 'rs/config-write-section-fix' into maintJunio C Hamano Tue, 28 Nov 2017 04:38:33 +0000 (13:38 +0900)

Merge branch 'rs/config-write-section-fix' into maint

There was a recent semantic mismerge in the codepath to write out a
section of a configuration section, which has been corrected.

* rs/config-write-section-fix:
config: flip return value of write_section()

A bit more fixes for 2.15.1Junio C Hamano Mon, 27 Nov 2017 01:58:31 +0000 (10:58 +0900)

A bit more fixes for 2.15.1

We've been waiting long enough, a few more would not hurt ;-)

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

Merge branch 'ma/reduce-heads-leakfix' into maintJunio C Hamano Mon, 27 Nov 2017 01:57:02 +0000 (10:57 +0900)

Merge branch 'ma/reduce-heads-leakfix' into maint

Leak fixes.

* ma/reduce-heads-leakfix:
reduce_heads: fix memory leaks
builtin/merge-base: free commit lists

Merge branch 'ma/bisect-leakfix' into maintJunio C Hamano Mon, 27 Nov 2017 01:57:02 +0000 (10:57 +0900)

Merge branch 'ma/bisect-leakfix' into maint

Leak fixes.

* ma/bisect-leakfix:
bisect: fix memory leak when returning best element
bisect: fix off-by-one error in `best_bisection_sorted()`
bisect: fix memory leak in `find_bisection()`
bisect: change calling-convention of `find_bisection()`

Merge branch 'rs/apply-fuzzy-match-fix' into maintJunio C Hamano Mon, 27 Nov 2017 01:57:02 +0000 (10:57 +0900)

Merge branch 'rs/apply-fuzzy-match-fix' into maint

A fix for an ancient bug in "git apply --ignore-space-change" codepath.

* rs/apply-fuzzy-match-fix:
apply: avoid out-of-bounds access in fuzzy_matchlines()

Merge branch 'ad/submitting-patches-title-decoration... Junio C Hamano Mon, 27 Nov 2017 01:57:01 +0000 (10:57 +0900)

Merge branch 'ad/submitting-patches-title-decoration' into maint

Doc update around use of "format-patch --subject-prefix" etc.

* ad/submitting-patches-title-decoration:
doc/SubmittingPatches: correct subject guidance

Merge branch 'rs/imap-send-next-arg-fix' into maintJunio C Hamano Mon, 27 Nov 2017 01:57:00 +0000 (10:57 +0900)

Merge branch 'rs/imap-send-next-arg-fix' into maint

Error checking in "git imap-send" for empty response has been
improved.

* rs/imap-send-next-arg-fix:
imap-send: handle missing response codes gracefully
imap-send: handle NULL return of next_arg()

RelNotes: minor typo fixes in 2.15.1 draftTodd Zullinger Sat, 25 Nov 2017 17:32:40 +0000 (12:32 -0500)

RelNotes: minor typo fixes in 2.15.1 draft

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

Almost ready for 2.15.1Junio C Hamano Tue, 21 Nov 2017 05:07:08 +0000 (14:07 +0900)

Almost ready for 2.15.1

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

Merge branch 'rs/sequencer-rewrite-file-cleanup' into... Junio C Hamano Tue, 21 Nov 2017 05:05:33 +0000 (14:05 +0900)

Merge branch 'rs/sequencer-rewrite-file-cleanup' into maint

Code cleanup.

* rs/sequencer-rewrite-file-cleanup:
sequencer.c: check return value of close() in rewrite_file()
sequencer: use O_TRUNC to truncate files
sequencer: factor out rewrite_file()

Merge branch 'cb/t4201-robustify' into maintJunio C Hamano Tue, 21 Nov 2017 05:05:33 +0000 (14:05 +0900)

Merge branch 'cb/t4201-robustify' into maint

A test update.

* cb/t4201-robustify:
t4201: make use of abbreviation in the test more robust

Merge branch 'tz/fsf-address-update' into maintJunio C Hamano Tue, 21 Nov 2017 05:05:32 +0000 (14:05 +0900)

Merge branch 'tz/fsf-address-update' into maint

Replace the mailing address of FSF to a URL, as FSF prefers.

* tz/fsf-address-update:
Replace Free Software Foundation address in license notices
Replace Free Software Foundation address in license notices

Merge branch 'ad/rebase-i-serie-typofix' into maintJunio C Hamano Tue, 21 Nov 2017 05:05:32 +0000 (14:05 +0900)

Merge branch 'ad/rebase-i-serie-typofix' into maint

Typofix.

* ad/rebase-i-serie-typofix:
rebase -i: fix comment typo

Merge branch 'jk/info-alternates-fix' into maintJunio C Hamano Tue, 21 Nov 2017 05:05:31 +0000 (14:05 +0900)

Merge branch 'jk/info-alternates-fix' into maint

We used to add an empty alternate object database to the system
that does not help anything; it has been corrected.

* jk/info-alternates-fix:
link_alt_odb_entries: make empty input a noop

Merge branch 'ab/pcre-v2' into maintJunio C Hamano Tue, 21 Nov 2017 05:05:30 +0000 (14:05 +0900)

Merge branch 'ab/pcre-v2' into maint

Building with NO_LIBPCRE1_JIT did not disable it, which has been fixed.

* ab/pcre-v2:
grep: fix NO_LIBPCRE1_JIT to fully disable JIT

Merge branch 'sr/wrapper-quote-filenames' into maintJunio C Hamano Tue, 21 Nov 2017 05:05:29 +0000 (14:05 +0900)

Merge branch 'sr/wrapper-quote-filenames' into maint

Some error messages did not quote filenames shown in it, which have
been fixed.

* sr/wrapper-quote-filenames:
wrapper.c: consistently quote filenames in error messages

Merge branch 'bw/rebase-i-ignored-submodule-fix' into... Junio C Hamano Tue, 21 Nov 2017 05:05:29 +0000 (14:05 +0900)

Merge branch 'bw/rebase-i-ignored-submodule-fix' into maint

"git rebase -i" recently started misbehaving when a submodule that
is configured with 'submodule.<name>.ignore' is dirty; this has
been corrected.

* bw/rebase-i-ignored-submodule-fix:
wt-status: actually ignore submodules when requested

config: flip return value of write_section()René Scharfe Sat, 18 Nov 2017 10:20:04 +0000 (11:20 +0100)

config: flip return value of write_section()

d9bd4cbb9cc (config: flip return value of store_write_*()) made
write_section() follow the convention of write(2) to return -1 on error
and the number of written bytes on success. 3b48045c6c7 (Merge branch
'sd/branch-copy') changed it back to returning 0 on error and 1 on
success, but left its callers still checking for negative values.

Let write_section() follow the convention of write(2) again to meet the
expectations of its callers.

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

Start preparation for 2.15.1Junio C Hamano Wed, 15 Nov 2017 03:04:22 +0000 (12:04 +0900)

Start preparation for 2.15.1

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

Merge branch 'ks/mailmap' into maintJunio C Hamano Wed, 15 Nov 2017 03:05:04 +0000 (12:05 +0900)

Merge branch 'ks/mailmap' into maint

* ks/mailmap:
mailmap: use Kaartic Sivaraam's new address

Merge branch 'jm/relnotes-2.15-typofix' into maintJunio C Hamano Wed, 15 Nov 2017 03:05:04 +0000 (12:05 +0900)

Merge branch 'jm/relnotes-2.15-typofix' into maint

Typofix.

* jm/relnotes-2.15-typofix:
fix typos in 2.15.0 release notes

Merge branch 'cn/diff-indent-no-longer-is-experimental... Junio C Hamano Wed, 15 Nov 2017 03:05:04 +0000 (12:05 +0900)

Merge branch 'cn/diff-indent-no-longer-is-experimental' into maint

Doc update.

* cn/diff-indent-no-longer-is-experimental:
diff: --indent-heuristic is no longer experimental

Merge branch 'js/mingw-redirect-std-handles' into maintJunio C Hamano Wed, 15 Nov 2017 03:05:03 +0000 (12:05 +0900)

Merge branch 'js/mingw-redirect-std-handles' into maint

MinGW updates.

* js/mingw-redirect-std-handles:
mingw: document the standard handle redirection
mingw: optionally redirect stderr/stdout via the same handle
mingw: add experimental feature to redirect standard handles

Merge branch 'js/wincred-empty-cred' into maintJunio C Hamano Wed, 15 Nov 2017 03:05:03 +0000 (12:05 +0900)

Merge branch 'js/wincred-empty-cred' into maint

MinGW updates.

* js/wincred-empty-cred:
wincred: handle empty username/password correctly
t0302: check helper can handle empty credentials

Merge branch 'js/mingw-full-version-in-resources' into... Junio C Hamano Wed, 15 Nov 2017 03:05:03 +0000 (12:05 +0900)

Merge branch 'js/mingw-full-version-in-resources' into maint

MinGW updates.

* js/mingw-full-version-in-resources:
mingw: include the full version information in the resources

Merge branch 'dk/libsecret-unlock-to-load-fix' into... Junio C Hamano Wed, 15 Nov 2017 03:05:02 +0000 (12:05 +0900)

Merge branch 'dk/libsecret-unlock-to-load-fix' into maint

The credential helper for libsecret (in contrib/) has been improved
to allow possibly prompting the end user to unlock secrets that are
currently locked (otherwise the secrets may not be loaded).

* dk/libsecret-unlock-to-load-fix:
credential-libsecret: unlock locked secrets

Merge branch 'js/early-config' into maintJunio C Hamano Wed, 15 Nov 2017 03:05:01 +0000 (12:05 +0900)

Merge branch 'js/early-config' into maint

Correct start-up sequence so that a repository could be placed
immediately under the root directory again (which was broken at
around Git 2.13).

* js/early-config:
setup: avoid double slashes when looking for HEAD

Merge branch 'ad/5580-unc-tests-on-cygwin' into maintJunio C Hamano Wed, 15 Nov 2017 03:05:00 +0000 (12:05 +0900)

Merge branch 'ad/5580-unc-tests-on-cygwin' into maint

UNC paths are also relevant in Cygwin builds and they are now
tested just like Mingw builds.

* ad/5580-unc-tests-on-cygwin:
t5580: add Cygwin support

Merge branch 'ao/diff-populate-filespec-lstat-errorpath... Junio C Hamano Wed, 15 Nov 2017 03:04:59 +0000 (12:04 +0900)

Merge branch 'ao/diff-populate-filespec-lstat-errorpath-fix' into maint

After an error from lstat(), diff_populate_filespec() function
sometimes still went ahead and used invalid data in struct stat,
which has been fixed.

* ao/diff-populate-filespec-lstat-errorpath-fix:
diff: fix lstat() error handling in diff_populate_filespec()

Merge branch 'sb/blame-config-doc' into maintJunio C Hamano Wed, 15 Nov 2017 03:04:59 +0000 (12:04 +0900)

Merge branch 'sb/blame-config-doc' into maint

Description of blame.{showroot,blankboundary,showemail,date}
configuration variables have been added to "git config --help".

* sb/blame-config-doc:
config: document blame configuration

Merge branch 'tb/complete-checkout' into maintJunio C Hamano Wed, 15 Nov 2017 03:04:58 +0000 (12:04 +0900)

Merge branch 'tb/complete-checkout' into maint

Command line completion (in contrib/) update.

* tb/complete-checkout:
completion: add remaining flags to checkout

Merge branch 'jc/check-ref-format-oor' into maintJunio C Hamano Wed, 15 Nov 2017 03:04:57 +0000 (12:04 +0900)

Merge branch 'jc/check-ref-format-oor' into maint

"git check-ref-format --branch @{-1}" bit a "BUG()" when run
outside a repository for obvious reasons; clarify the documentation
and make sure we do not even try to expand the at-mark magic in
such a case, but still call the validation logic for branch names.

* jc/check-ref-format-oor:
check-ref-format doc: --branch validates and expands <branch>
check-ref-format --branch: strip refs/heads/ using skip_prefix
check-ref-format --branch: do not expand @{...} outside repository

Merge branch 'jc/t5601-copy-workaround' into maintJunio C Hamano Wed, 15 Nov 2017 03:04:56 +0000 (12:04 +0900)

Merge branch 'jc/t5601-copy-workaround' into maint

A (possibly flakey) test fix.

* jc/t5601-copy-workaround:
t5601: rm the target file of cp that could still be executing

Merge branch 'jk/rebase-i-exec-gitdir-fix' into maintJunio C Hamano Wed, 15 Nov 2017 03:04:56 +0000 (12:04 +0900)

Merge branch 'jk/rebase-i-exec-gitdir-fix' into maint

A recent regression in "git rebase -i" that broke execution of git
commands from subdirectories via "exec" insn has been fixed.

* jk/rebase-i-exec-gitdir-fix:
sequencer: pass absolute GIT_DIR to exec commands

Merge branch 'bw/grep-recurse-submodules' into maintJunio C Hamano Wed, 15 Nov 2017 03:04:55 +0000 (12:04 +0900)

Merge branch 'bw/grep-recurse-submodules' into maint

A broken access to object databases in recent update to "git grep
--recurse-submodules" has been fixed.

* bw/grep-recurse-submodules:
grep: take the read-lock when adding a submodule

Merge branch 'js/submodule-in-excluded' into maintJunio C Hamano Wed, 15 Nov 2017 03:04:54 +0000 (12:04 +0900)

Merge branch 'js/submodule-in-excluded' into maint

"git status --ignored -u" did not stop at a working tree of a
separate project that is embedded in an ignored directory and
listed files in that other project, instead of just showing the
directory itself as ignored.

* js/submodule-in-excluded:
status: do not get confused by submodules in excluded directories

Merge branch 'ao/check-resolve-ref-unsafe-result' into... Junio C Hamano Wed, 15 Nov 2017 03:04:53 +0000 (12:04 +0900)

Merge branch 'ao/check-resolve-ref-unsafe-result' into maint

"git commit", after making a commit, did not check for errors when
asking on what branch it made the commit, which has been correted.

* ao/check-resolve-ref-unsafe-result:
commit: check result of resolve_ref_unsafe

Merge branch 'jk/misc-resolve-ref-unsafe-fixes' into... Junio C Hamano Wed, 15 Nov 2017 03:04:52 +0000 (12:04 +0900)

Merge branch 'jk/misc-resolve-ref-unsafe-fixes' into maint

Some codepaths did not check for errors when asking what branch the
HEAD points at, which have been fixed.

* jk/misc-resolve-ref-unsafe-fixes:
worktree: handle broken symrefs in find_shared_symref()
log: handle broken HEAD in decoration check
remote: handle broken symrefs
test-ref-store: avoid passing NULL to printf

Merge branch 'sb/diff-color-moved-use-xdl-recmatch... Junio C Hamano Wed, 15 Nov 2017 03:04:52 +0000 (12:04 +0900)

Merge branch 'sb/diff-color-moved-use-xdl-recmatch' into maint

Instead of using custom line comparison and hashing functions to
implement "moved lines" coloring in the diff output, use the pair
of these functions from lower-layer xdiff/ code.

* sb/diff-color-moved-use-xdl-recmatch:
diff.c: get rid of duplicate implementation
xdiff-interface: export comparing and hashing strings

Merge branch 'jk/diff-color-moved-fix' into maintJunio C Hamano Wed, 15 Nov 2017 03:04:51 +0000 (12:04 +0900)

Merge branch 'jk/diff-color-moved-fix' into maint

The experimental "color moved lines differently in diff output"
feature was buggy around "ignore whitespace changes" edges, whihch
has been corrected.

* jk/diff-color-moved-fix:
diff: handle NULs in get_string_hash()
diff: fix whitespace-skipping with --color-moved
t4015: test the output of "diff --color-moved -b"
t4015: check "negative" case for "-w --color-moved"
t4015: refactor --color-moved whitespace test

Merge branch 'kd/auto-col-with-pager-fix' into maintJunio C Hamano Wed, 15 Nov 2017 03:04:50 +0000 (12:04 +0900)

Merge branch 'kd/auto-col-with-pager-fix' into maint

"auto" as a value for the columnar output configuration ought to
judge "is the output consumed by humans?" with the same criteria as
"auto" for coloured output configuration, i.e. either the standard
output stream is going to tty, or a pager is in use. We forgot the
latter, which has been fixed.

* kd/auto-col-with-pager-fix:
column: do not include pager.c
column: show auto columns when pager is active

Merge branch 'sg/travis-fixes' into maintJunio C Hamano Wed, 15 Nov 2017 03:04:49 +0000 (12:04 +0900)

Merge branch 'sg/travis-fixes' into maint

TravisCI build updates.

* sg/travis-fixes:
travis-ci: don't build Git for the static analysis job
travis-ci: fix running P4 and Git LFS tests in Linux build jobs

link_alt_odb_entries: make empty input a noopJeff King Sun, 12 Nov 2017 10:27:39 +0000 (10:27 +0000)

link_alt_odb_entries: make empty input a noop

If an empty string is passed to link_alt_odb_entries(), our
loop finds no entries and we link nothing. But we still do
some preparatory work to normalize the object directory
path, even though we'll never look at the result. This
triggers in basically every git process, since we feed the
usually-empty ALTERNATE_DB_ENVIRONMENT to the function.

Let's detect early that there's nothing to do and return.
While we're at it, let's treat NULL the same as an empty
string as a favor to our callers. That saves
prepare_alt_odb() from having to cover this case.

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

grep: fix NO_LIBPCRE1_JIT to fully disable JITCharles Bailey Sun, 12 Nov 2017 16:59:38 +0000 (16:59 +0000)

grep: fix NO_LIBPCRE1_JIT to fully disable JIT

If you have a pcre1 library which is compiled with JIT enabled then
PCRE_STUDY_JIT_COMPILE will be defined whether or not the
NO_LIBPCRE1_JIT configuration is set.

This means that we enable JIT functionality when calling pcre_study
even if NO_LIBPCRE1_JIT has been explicitly set and we just use plain
pcre_exec later.

Fix this by using own macro (GIT_PCRE_STUDY_JIT_COMPILE) which we set to
PCRE_STUDY_JIT_COMPILE only if NO_LIBPCRE1_JIT is not set and define to
0 otherwise, as before.

Reviewed-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t4201: make use of abbreviation in the test more robustCharles Bailey Sun, 12 Nov 2017 15:25:23 +0000 (15:25 +0000)

t4201: make use of abbreviation in the test more robust

The test for '--abbrev' in t4201-shortlog.sh assumes that the commits
generated in the test can always be uniquely abbreviated to 5 hex digits
but this is not always the case. If you were unlucky and happened to run
the test at (say) Thu Jun 22 03:04:49 2017 +0000, you would find that
the first commit generated would collide with a tree object created
later in the same test.

This can be simulated in the version of t4201-shortlog.sh prior to this
commit by setting GIT_COMMITTER_DATE and GIT_AUTHOR_DATE to 1498100689
after sourcing test-lib.sh.

Change the test to test --abbrev=35 instead of --abbrev=5 to almost
completely avoid the possibility of a partial collision and add a call
to test_tick in the setup to make the test repeatable (the latter alone
is sufficient to make it robust enough).

Signed-off-by: Charles Bailey <cbailey32@bloomberg.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

apply: avoid out-of-bounds access in fuzzy_matchlines()René Scharfe Sat, 11 Nov 2017 14:10:19 +0000 (15:10 +0100)

apply: avoid out-of-bounds access in fuzzy_matchlines()

fuzzy_matchlines() uses a pointers to the first and last characters of
two lines to keep track while matching them. This makes it impossible
to deal with empty strings. It accesses characters before the start of
empty lines. It can also access characters after the end when checking
for trailing whitespace in the main loop.

Avoid that by using pointers to the first character and the one *after*
the last one. This is well-defined as long as the latter is not
dereferenced. Basically rewrite the function based on that premise; it
becomes much simpler as a result. There is no need to check for
leading whitespace outside of the main loop anymore.

Reported-by: Mahmoud Al-Qudsi <mqudsi@neosmart.net>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

doc/SubmittingPatches: correct subject guidanceAdam Dinwoodie Fri, 10 Nov 2017 15:02:50 +0000 (15:02 +0000)

doc/SubmittingPatches: correct subject guidance

The examples and common practice for adding markers such as "RFC" or
"v2" to the subject of patch emails is to have them within the same
brackets as the "PATCH" text, not after the closing bracket. Further,
the practice of `git format-patch` and the like, as well as what appears
to be the more common pratice on the mailing list, is to use "[RFC
PATCH]", not "[PATCH/RFC]".

Update the SubmittingPatches article to match and to reference the
`format-patch` helper arguments, and also make some minor text
clarifications in the area.

Signed-off-by: Adam Dinwoodie <adam@dinwoodie.org>
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'tz/fsf-address-update' of ../git-gui... Junio C Hamano Thu, 9 Nov 2017 04:24:43 +0000 (13:24 +0900)

Merge branch 'tz/fsf-address-update' of ../git-gui into tz/fsf-address-update

* 'tz/fsf-address-update' of ../git-gui:
Replace Free Software Foundation address in license notices

Replace Free Software Foundation address in license... Todd Zullinger Tue, 7 Nov 2017 05:39:33 +0000 (00:39 -0500)

Replace Free Software Foundation address in license notices

The mailing address for the FSF has changed over the years. Rather than
updating the address across all files, refer readers to gnu.org, as the
GNU GPL documentation now suggests for license notices. The mailing
address is retained in the full license files (COPYING and LGPL-2.1).

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

Replace Free Software Foundation address in license... Todd Zullinger Tue, 7 Nov 2017 05:39:33 +0000 (00:39 -0500)

Replace Free Software Foundation address in license notices

The mailing address for the FSF has changed over the years. Rather than
updating the address across all files, refer readers to gnu.org, as the
GNU GPL documentation now suggests for license notices. The mailing
address is retained in the full license files (COPYING and LGPL-2.1).

The old address is still present in t/diff-lib/COPYING. This is
intentional, as the file is used in tests and the contents are not
expected to change.

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

rebase -i: fix comment typoAdam Dinwoodie Wed, 8 Nov 2017 13:20:20 +0000 (13:20 +0000)

rebase -i: fix comment typo

Signed-off-by: Adam Dinwoodie <adam@dinwoodie.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

reduce_heads: fix memory leaksMartin Ågren Tue, 7 Nov 2017 20:39:45 +0000 (21:39 +0100)

reduce_heads: fix memory leaks

We currently have seven callers of `reduce_heads(foo)`. Six of them do
not use the original list `foo` again, and actually, all six of those
end up leaking it.

Introduce and use `reduce_heads_replace(&foo)` as a leak-free version of
`foo = reduce_heads(foo)` to fix several of these. Fix the remaining
leaks using `free_commit_list()`.

While we're here, document `reduce_heads()` and mark it as `extern`.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

builtin/merge-base: free commit listsMartin Ågren Tue, 7 Nov 2017 20:39:44 +0000 (21:39 +0100)

builtin/merge-base: free commit lists

In several functions, we iterate through a commit list by assigning
`result = result->next`. As a consequence, we lose the original pointer
and eventually leak the list.

Rewrite the loops so that we keep the original pointers, then call
`free_commit_list()`. Various alternatives were considered:

1) Use `UNLEAK(result)` before the loop. Simple change, but not very
pretty. These would definitely be new lows among our usages of UNLEAK.
2) Use `pop_commit()` when looping. Slightly less simple change, but it
feels slightly preferable to first display the list, then free it.
3) As in this patch, but with `UNLEAK()` instead of freeing. We'd still
go through all the trouble of refactoring the loop, and because it's not
super-obvious that we're about to exit, let's just free the lists -- it
probably doesn't affect the runtime much.

In `handle_independent()` we can drop `result` while we're here and
reuse the `revs`-variable instead. That matches several other users of
`reduce_heads()`. The memory-leak that this hides will be addressed in
the next commit.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

wt-status: actually ignore submodules when requestedBrandon Williams Mon, 6 Nov 2017 22:08:19 +0000 (14:08 -0800)

wt-status: actually ignore submodules when requested

Since ff6f1f564 (submodule-config: lazy-load a repository's .gitmodules
file, 2017-08-03) rebase interactive fails if there are any submodules
with unstaged changes which have been configured with a value for
'submodule.<name>.ignore' in the repository's config.

This is due to how configured values of 'submodule.<name>.ignore' are
handled in addition to a change in how the submodule config is loaded.
When the diff machinery hits a submodule (gitlink as well as a
corresponding entry in the submodule subsystem) it will read the value
of 'submodule.<name>.ignore' stored in the repository's config and if
the config is present it will clear the 'IGNORE_SUBMODULES' (which is
the flag explicitly requested by rebase interactive),
'IGNORE_UNTRACKED_IN_SUBMODULES', and 'IGNORE_DIRTY_SUBMODULES' diff
flags and then set one of them based on the configured value.

Historically this wasn't a problem because the submodule subsystem
wasn't initialized because the .gitmodules file wasn't explicitly loaded
by the rebase interactive command. So when the diff machinery hit a
submodule it would skip over reading any configured values of
'submodule.<name>.ignore'.

In order to preserve the behavior of submodules being ignored by rebase
interactive, also set the 'OVERRIDE_SUBMODULE_CONFIG' diff flag when
submodules are requested to be ignored when checking for unstaged
changes.

Reported-by: Orgad Shaneh <orgads@gmail.com>
Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

wrapper.c: consistently quote filenames in error messagesSimon Ruderich Wed, 1 Nov 2017 14:44:44 +0000 (15:44 +0100)

wrapper.c: consistently quote filenames in error messages

All other error messages in the file use quotes around the file name.

This change removes two translations as "could not write to '%s'" and
"could not close '%s'" are already translated and these two are the only
occurrences without quotes.

Signed-off-by: Simon Ruderich <simon@ruderich.org>
[jc: adjusted tests I noticed were broken by the change]
Signed-off-by: Junio C Hamano <gitster@pobox.com>

fix typos in 2.15.0 release notesJean Carlo Machado Sat, 4 Nov 2017 12:16:16 +0000 (10:16 -0200)

fix typos in 2.15.0 release notes

Signed-off-by: Jean Carlo Machado <contato@jeancarlomachado.com.br>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

bisect: fix memory leak when returning best elementMartin Ågren Sun, 5 Nov 2017 20:24:31 +0000 (21:24 +0100)

bisect: fix memory leak when returning best element

When `find_bisection()` returns a single list entry, it leaks the other
entries. Move the to-be-returned item to the front and free the
remainder.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

bisect: fix off-by-one error in `best_bisection_sorted()`Martin Ågren Sun, 5 Nov 2017 20:24:30 +0000 (21:24 +0100)

bisect: fix off-by-one error in `best_bisection_sorted()`

After we have sorted the `cnt`-many commits that we have selected, we
place them into the commit list. We then set `p->next` to NULL, but as
we do so, `p` is already pointing one beyond item number `cnt`. Indeed,
we check whether `p` is NULL before dereferencing it.

This only matters if there are TREESAME-commits. Since they should be
skipped, they are not included in `cnt` and we will hit the situation
where we set `p->next` to NULL. As a result, the list will be one longer
than it should be. The last commit in the list will be one which occurs
earlier, or which shouldn't be included.

Do not update `p` the very last round in the loop. This ensures that
after the loop, `p->next` points to the remainder of the list, and we
can set it to NULL. While we're here, free that remainder to fix a
memory leak.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

bisect: fix memory leak in `find_bisection()`Martin Ågren Sun, 5 Nov 2017 20:24:29 +0000 (21:24 +0100)

bisect: fix memory leak in `find_bisection()`

`find_bisection()` rebuilds the commit list it is given by reversing it
and skipping uninteresting commits. The uninteresting list entries are
leaked. Free them to fix the leak.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

bisect: change calling-convention of `find_bisection()`Martin Ågren Sun, 5 Nov 2017 20:24:28 +0000 (21:24 +0100)

bisect: change calling-convention of `find_bisection()`

This function takes a commit list and returns a commit list. The
returned list is built by modifying the original list. Thus the caller
should not use the original list again (and after the next commit fixes
a memory leak, it must not).

Change the function signature so that it takes a **list and has void
return type. That should make it harder to misuse this function.

While we're here, document this function.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

config: document blame configurationStefan Beller Fri, 3 Nov 2017 19:21:58 +0000 (12:21 -0700)

config: document blame configuration

The options are currently only referenced by the git-blame man page,
also explain them in git-config, which is the canonical page to
contain all config options.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

credential-libsecret: unlock locked secretsDennis Kaarsemaker Fri, 3 Nov 2017 20:44:49 +0000 (21:44 +0100)

credential-libsecret: unlock locked secrets

Credentials exposed by the secret service DBUS interface may be locked.
Setting the SECRET_SEARCH_UNLOCK flag will make the secret service
unlock these secrets, possibly prompting the user for credentials to do
so. Without this flag, the secret is simply not loaded.

Signed-off-by: Dennis Kaarsemaker <dennis@kaarsemaker.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

setup: avoid double slashes when looking for HEADJeff King Fri, 3 Nov 2017 12:58:02 +0000 (13:58 +0100)

setup: avoid double slashes when looking for HEAD

Andrew Baumann reported that when called outside of any Git worktree,
`git rev-parse --is-inside-work-tree` eventually tries to access
`//HEAD`, i.e. any `HEAD` file in the root directory, but with a double
slash.

This double slash is not only unintentional, but is allowed by the POSIX
standard to have a special meaning. And most notably on Windows, it
does, where it refers to a UNC path of the form `//server/share/`.

As a consequence, afore-mentioned `rev-parse` call not only looks for
the wrong thing, but it also causes serious delays, as Windows will try
to access a server called `HEAD`. Let's simply avoid the unintended
double slash.

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

mailmap: use Kaartic Sivaraam's new addressKaartic Sivaraam Fri, 3 Nov 2017 05:43:41 +0000 (11:13 +0530)

mailmap: use Kaartic Sivaraam's new address

Map the old address to the new, hopefully more permanent one.

Signed-off-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

imap-send: handle missing response codes gracefullyRené Scharfe Thu, 2 Nov 2017 17:27:05 +0000 (18:27 +0100)

imap-send: handle missing response codes gracefully

Response codes are optional. Exit parse_response_code() early if it's
passed a NULL string, indicating that we reached the end of the reply.
This avoids dereferencing said NULL pointer.

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

imap-send: handle NULL return of next_arg()René Scharfe Wed, 1 Nov 2017 17:03:20 +0000 (18:03 +0100)

imap-send: handle NULL return of next_arg()

next_arg() returns NULL if it runs out of arguments. Most call sites
already handle that gracefully. Check in the remaining cases as well.
Replace the NULL pointer with an empty string at the bottom of
get_cmd_result() -- it's nicely reported as an unexpected response a
few lines down. Error out explicitly at the remaining sites.

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

diff: --indent-heuristic is no longer experimentalCarlos Martín Nieto Sun, 29 Oct 2017 15:12:28 +0000 (16:12 +0100)

diff: --indent-heuristic is no longer experimental

This heuristic has been the default since 2.14 so we should not confuse our
users by saying that it's experimental and off by default.

Signed-off-by: Carlos Martín Nieto <cmn@dwim.me>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sequencer.c: check return value of close() in rewrite_f... Simon Ruderich Wed, 1 Nov 2017 14:45:42 +0000 (15:45 +0100)

sequencer.c: check return value of close() in rewrite_file()

Not checking close(2) can hide errors as not all errors are reported
during the write(2).

Signed-off-by: Simon Ruderich <simon@ruderich.org>
Reviewed-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mingw: document the standard handle redirectionJohannes Schindelin Wed, 1 Nov 2017 17:10:33 +0000 (18:10 +0100)

mingw: document the standard handle redirection

This feature has been in Git for Windows since v2.11.0(2), as an
experimental option. Now it is considered mature, and it is high time to
document it properly.

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

mingw: optionally redirect stderr/stdout via the same... Johannes Schindelin Wed, 1 Nov 2017 17:10:30 +0000 (18:10 +0100)

mingw: optionally redirect stderr/stdout via the same handle

The "2>&1" notation in Powershell and in Unix shells implies that stderr
is redirected to the same handle into which stdout is already written.

Let's use this special value to allow the same trick with
GIT_REDIRECT_STDERR and GIT_REDIRECT_STDOUT: if the former's value is
`2>&1`, then stderr will simply be written to the same handle as stdout.

The functionality was suggested by Jeff Hostetler.

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

mingw: add experimental feature to redirect standard... Johannes Schindelin Wed, 1 Nov 2017 17:10:25 +0000 (18:10 +0100)

mingw: add experimental feature to redirect standard handles

Particularly when calling Git from applications, such as Visual Studio's
Team Explorer, it is important that stdin/stdout/stderr are closed
properly. However, when spawning processes on Windows, those handles
must be marked as inheritable if we want to use them, but that flag is a
global flag and may very well be used by other spawned processes which
then do not know to close those handles.

Let's introduce a set of environment variables (GIT_REDIRECT_STDIN and
friends) that specify paths to files, or even better, named pipes (which
are similar to Unix sockets) and that are used by the spawned Git
process. This helps work around above-mentioned issue: those named
pipes will be opened in a non-inheritable way upon startup, and no
handles are passed around (and therefore no inherited handles need to be
closed by any spawned child).

This feature shipped with Git for Windows (marked as experimental) since
v2.11.0(2), so it has seen some serious testing in the meantime.

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

travis-ci: don't build Git for the static analysis jobSZEDER Gábor Wed, 1 Nov 2017 11:56:44 +0000 (12:56 +0100)

travis-ci: don't build Git for the static analysis job

The static analysis job on Travis CI builds Git ever since it was
introduced in d8245bb3f (travis-ci: add static analysis build job to
run coccicheck, 2017-04-11). However, Coccinelle, the only static
analysis tool in use, only needs Git's source code to work and it
doesn't care about built Git binaries at all.

Spare some of Travis CI's resources and don't build Git for the static
analysis job unnecessarily.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

travis-ci: fix running P4 and Git LFS tests in Linux... SZEDER Gábor Wed, 1 Nov 2017 11:55:35 +0000 (12:55 +0100)

travis-ci: fix running P4 and Git LFS tests in Linux build jobs

Linux build jobs on Travis CI skip the P4 and Git LFS tests since
commit 657343a60 (travis-ci: move Travis CI code into dedicated
scripts, 2017-09-10), claiming there are no P4 or Git LFS installed.

The reason is that P4 and Git LFS binaries are not installed to a
directory in the default $PATH, but their directories are prepended to
$PATH. This worked just fine before said commit, because $PATH was
set in a scriptlet embedded in our '.travis.yml', thus its new value
was visible during the rest of the build job. However, after these
embedded scriptlets were moved into dedicated scripts executed in
separate shell processes, any variable set in one of those scripts is
only visible in that single script but not in any of the others. In
this case, 'ci/install-dependencies.sh' downloads P4 and Git LFS and
modifies $PATH, but to no effect, because 'ci/run-tests.sh' only sees
Travis CI's default $PATH.

Move adjusting $PATH to 'ci/lib-travisci.sh', which is sourced in all
other 'ci/' scripts, so all those scripts will see the updated $PATH
value.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

grep: take the read-lock when adding a submoduleMartin Ågren Wed, 1 Nov 2017 20:45:06 +0000 (21:45 +0100)

grep: take the read-lock when adding a submodule

With --recurse-submodules, we add each submodule that we encounter to
the list of alternate object databases. With threading, our changes to
the list are not protected against races. Indeed, ThreadSanitizer
reports a race when we call `add_to_alternates_memory()` around the same
time that another thread is reading in the list through
`read_sha1_file()`.

Take the grep read-lock while adding the submodule. The lock is used to
serialize uses of non-thread-safe parts of Git's API, including
`read_sha1_file()`.

Helped-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Acked-by: Brandon Williams <bmwill@google.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sequencer: pass absolute GIT_DIR to exec commandsJacob Keller Tue, 31 Oct 2017 23:07:33 +0000 (16:07 -0700)

sequencer: pass absolute GIT_DIR to exec commands

When we replaced the old shell script based interactive rebase in
commmit 18633e1a22a6 ("rebase -i: use the rebase--helper builtin",
2017-02-09) we introduced a regression of functionality in that the
GIT_DIR would be sent to the environment of the exec command as-is.

This generally meant that it would be passed as "GIT_DIR=.git", which
causes problems for any exec command that wants to run git commands in
a subdirectory.

This isn't a very large regression, since it is not that likely that the
exec command will run a git command, and even less likely that it will
need to do so in a subdir. This regression was discovered by a build
system which uses git-describe to find the current version of the build
system, and happened to do so from the src/ sub directory of the
project.

Fix this by passing in the absolute path of the git directory into the
child environment.

Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

wincred: handle empty username/password correctlyJakub Bereżański Mon, 30 Oct 2017 17:20:44 +0000 (18:20 +0100)

wincred: handle empty username/password correctly

Empty (length 0) usernames and/or passwords, when saved in the Windows
Credential Manager, come back as null when reading the credential.

One use case for such empty credentials is with NTLM authentication, where
empty username and password instruct libcurl to authenticate using the
credentials of the currently logged-on user (single sign-on).

When locating the relevant credentials, make empty username match null.
When outputting the credentials, handle nulls correctly.

Signed-off-by: Jakub Bereżański <kuba@berezanscy.pl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t0302: check helper can handle empty credentialsJakub Bereżański Mon, 30 Oct 2017 17:20:12 +0000 (18:20 +0100)

t0302: check helper can handle empty credentials

Make sure the helper does not crash when blank username and password is
provided. If the helper can save such credentials, it should be able to
read them back.

Signed-off-by: Jakub Bereżański <kuba@berezanscy.pl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mingw: include the full version information in the... Johannes Schindelin Mon, 30 Oct 2017 17:19:42 +0000 (18:19 +0100)

mingw: include the full version information in the resources

This fixes https://github.com/git-for-windows/git/issues/723

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

sequencer: use O_TRUNC to truncate filesRené Scharfe Tue, 31 Oct 2017 09:58:16 +0000 (10:58 +0100)

sequencer: use O_TRUNC to truncate files

Cut off any previous content of the file to be rewritten by passing the
flag O_TRUNC to open(2) instead of calling ftruncate(2) at the end.
That's easier and shorter.

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

sequencer: factor out rewrite_file()René Scharfe Tue, 31 Oct 2017 09:54:21 +0000 (10:54 +0100)

sequencer: factor out rewrite_file()

Reduce code duplication by extracting a function for rewriting an
existing file.

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

t5580: add Cygwin supportAdam Dinwoodie Tue, 31 Oct 2017 13:19:03 +0000 (13:19 +0000)

t5580: add Cygwin support

t5580 tests that specifying Windows UNC paths works with Git. Cygwin
supports UNC paths, albeit only using forward slashes, not backslashes,
so run the compatible tests on Cygwin as well as MinGW.

The only complication is Cygwin's `pwd`, which returns a *nix-style
path, and that's not suitable for calculating the UNC path to the
current directory. Instead use Cygwin's `cygpath` utility to get the
Windows-style path.

Signed-off-by: Adam Dinwoodie <adam@dinwoodie.org>
Reviewed-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Git 2.15 v2.15.0Junio C Hamano Mon, 30 Oct 2017 05:00:44 +0000 (14:00 +0900)

Git 2.15

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

Merge tag 'l10n-2.15.0-rnd2.1' of git://github.com... Junio C Hamano Mon, 30 Oct 2017 00:32:54 +0000 (09:32 +0900)

Merge tag 'l10n-2.15.0-rnd2.1' of git://github.com/git-l10n/git-po

l10n for Git 2.15.0 round 2 with Catalan updates

* tag 'l10n-2.15.0-rnd2.1' of git://github.com/git-l10n/git-po:
l10n: Update Catalan translation

l10n: Update Catalan translationJordi Mas Wed, 25 Oct 2017 17:50:59 +0000 (19:50 +0200)

l10n: Update Catalan translation

Signed-off-by: Jordi Mas <jmas@softcatala.org>

diff: fix lstat() error handling in diff_populate_files... Andrey Okoshkin Fri, 27 Oct 2017 09:33:25 +0000 (12:33 +0300)

diff: fix lstat() error handling in diff_populate_filespec()

Add lstat() error handling not only for ENOENT case.
Otherwise uninitialised 'struct stat st' variable is used later in case of
lstat() non-ENOENT failure which leads to processing of rubbish values of
file mode ('S_ISLNK(st.st_mode)' check) or size ('xsize_t(st.st_size)').

Signed-off-by: Andrey Okoshkin <a.okoshkin@samsung.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Hopefully final batch before 2.15Junio C Hamano Sat, 28 Oct 2017 01:20:30 +0000 (10:20 +0900)

Hopefully final batch before 2.15

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

Merge branch 'sg/rev-list-doc-reorder-fix'Junio C Hamano Sat, 28 Oct 2017 01:18:42 +0000 (10:18 +0900)

Merge branch 'sg/rev-list-doc-reorder-fix'

Doc flow fix.

* sg/rev-list-doc-reorder-fix:
rev-list-options.txt: use correct directional reference

Merge branch 'sb/rev-parse-show-superproject-root'Junio C Hamano Sat, 28 Oct 2017 01:18:40 +0000 (10:18 +0900)

Merge branch 'sb/rev-parse-show-superproject-root'

Doc markup fix.

* sb/rev-parse-show-superproject-root:
docs: fix formatting of rev-parse's --show-superproject-working-tree

Merge branch 'ao/path-use-xmalloc'Junio C Hamano Sat, 28 Oct 2017 01:18:39 +0000 (10:18 +0900)

Merge branch 'ao/path-use-xmalloc'

A possible oom error is now caught as a fatal error, instead of
continuing and dereferencing NULL.

* ao/path-use-xmalloc:
path.c: use xmalloc() in add_to_trie()

Merge branch 'np/config-path-doc'Junio C Hamano Sat, 28 Oct 2017 01:18:39 +0000 (10:18 +0900)

Merge branch 'np/config-path-doc'

Doc update.

* np/config-path-doc:
config doc: clarify "git config --path" example

docs: fix formatting of rev-parse's --show-superproject... Sebastian Schuberth Thu, 26 Oct 2017 11:53:37 +0000 (11:53 +0000)

docs: fix formatting of rev-parse's --show-superproject-working-tree

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

rev-list-options.txt: use correct directional referenceSZEDER Gábor Thu, 26 Oct 2017 15:26:37 +0000 (17:26 +0200)

rev-list-options.txt: use correct directional reference

The descriptions of the options '--parents', '--children' and
'--graph' say "see 'History Simplification' below", although the
referred section is in fact above the description of these options.

Send readers in the right direction by saying "above" instead of
"below".

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'mh/ref-locking-fix'Junio C Hamano Thu, 26 Oct 2017 03:29:23 +0000 (12:29 +0900)

Merge branch 'mh/ref-locking-fix'

Transactions to update multiple references that involves a deletion
was quite broken in an error codepath and did not abort everything
correctly.

* mh/ref-locking-fix:
files_transaction_prepare(): fix handling of ref lock failure
t1404: add a bunch of tests of D/F conflicts

status: do not get confused by submodules in excluded... Johannes Schindelin Wed, 25 Oct 2017 20:40:40 +0000 (22:40 +0200)

status: do not get confused by submodules in excluded directories

We meticulously pass the `exclude` flag to the `treat_directory()`
function so that we can indicate that files in it are excluded rather
than untracked when recursing.

But we did not yet treat submodules the same way.

Because of that, `git status --ignored --untracked` with a submodule
`submodule` in a gitignored `tracked/` would show the submodule in the
"Untracked files" section, e.g.

On branch master
Untracked files:
(use "git add <file>..." to include in what will be committed)

tracked/submodule/

Ignored files:
(use "git add -f <file>..." to include in what will be committed)

tracked/submodule/initial.t

Instead, we would want it to show the submodule in the "Ignored files"
section:

On branch master
Ignored files:
(use "git add -f <file>..." to include in what will be committed)

tracked/submodule/

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

diff.c: get rid of duplicate implementationStefan Beller Wed, 25 Oct 2017 18:49:12 +0000 (11:49 -0700)

diff.c: get rid of duplicate implementation

The implementations in diff.c to detect moved lines needs to compare
strings and hash strings, which is implemented in that file, as well
as in the xdiff library.

Remove the rather recent implementation in diff.c and rely on the well
exercised code in the xdiff lib.

With this change the hash used for bucketing the strings for the moved
line detection changes from FNV32 (that is provided via the hashmaps
memhash) to DJB2 (which is used internally in xdiff). Benchmarks found
on the web[1] do not indicate that these hashes are different in
performance for readable strings.

[1] https://softwareengineering.stackexchange.com/questions/49550/which-hashing-algorithm-is-best-for-uniqueness-and-speed

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

xdiff-interface: export comparing and hashing stringsStefan Beller Wed, 25 Oct 2017 18:49:11 +0000 (11:49 -0700)

xdiff-interface: export comparing and hashing strings

This will turn out to be useful in a later patch.

xdl_recmatch is exported in xdiff/xutils.h, to be used by various
xdiff/*.c files, but not outside of xdiff/. This one makes it available
to the outside, too.

While at it, add documentation.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

path.c: use xmalloc() in add_to_trie()Andrey Okoshkin Tue, 24 Oct 2017 15:15:05 +0000 (18:15 +0300)

path.c: use xmalloc() in add_to_trie()

Add usage of xmalloc() instead of malloc() in add_to_trie() as xmalloc wraps
and checks memory allocation result.

Signed-off-by: Andrey Okoshkin <a.okoshkin@samsung.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

completion: add remaining flags to checkoutThomas Braun Tue, 24 Oct 2017 13:19:31 +0000 (15:19 +0200)

completion: add remaining flags to checkout

In the commits 1fc458d9 (builtin/checkout: add --recurse-submodules
switch, 2017-03-14), 08d595dc (checkout: add --ignore-skip-worktree-bits
in sparse checkout mode, 2013-04-13) and 32669671 (checkout: introduce
--detach synonym for "git checkout foo^{commit}", 2011-02-08) checkout
gained new flags but the completion was not updated, although these flags
are useful completions. Add them.

The flags --force and --ignore-other-worktrees are not added as they are
potentially dangerous.

The flags --progress and --no-progress are only useful for scripting and are
therefore also not included.

Signed-off-by: Thomas Braun <thomas.braun@virtuell-zuhause.de>
Reviewed-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

files_transaction_prepare(): fix handling of ref lock... Michael Haggerty Tue, 24 Oct 2017 15:16:25 +0000 (17:16 +0200)

files_transaction_prepare(): fix handling of ref lock failure

Since dc39e09942 (files_ref_store: use a transaction to update packed
refs, 2017-09-08), failure to lock a reference has been handled
incorrectly by `files_transaction_prepare()`. If
`lock_ref_for_update()` fails in the lock-acquisition loop of that
function, it sets `ret` then breaks out of that loop. Prior to
dc39e09942, that was OK, because the only thing following the loop was
the cleanup code. But dc39e09942 added another blurb of code between
the loop and the cleanup. That blurb sometimes resets `ret` to zero,
making the cleanup code think that the locking was successful.

Specifically, whenever

* One or more reference deletions have been processed successfully in
the lock-acquisition loop. (Processing the first such reference
causes a packed-ref transaction to be initialized.)

* Then `lock_ref_for_update()` fails for a subsequent reference. Such
a failure can happen for a number of reasons, such as the old SHA-1
not being correct, lock contention, etc. This causes a `break` out
of the lock-acquisition loop.

* The `packed-refs` lock is acquired successfully and
`ref_transaction_prepare()` succeeds for the packed-ref transaction.
This has the effect of resetting `ret` back to 0, and making the
cleanup code think that lock acquisition was successful.

In that case, any reference updates that were processed prior to
breaking out of the loop would be carried out (loose and packed), but
the reference that couldn't be locked and any subsequent references
would silently be ignored.

This can easily cause data loss if, for example, the user was trying
to push a new name for an existing branch while deleting the old name.
After the push, the branch could be left unreachable, and could even
subsequently be garbage-collected.

This problem was noticed in the context of deleting one reference and
creating another in a single transaction, when the two references D/F
conflict with each other, like

git update-ref --stdin <<EOF
delete refs/foo
create refs/foo/bar HEAD
EOF

This triggers the above bug because the deletion is processed
successfully for `refs/foo`, then the D/F conflict causes
`lock_ref_for_update()` to fail when `refs/foo/bar` is processed. In
this case the transaction *should* fail, but instead it causes
`refs/foo` to be deleted without creating `refs/foo`. This could
easily result in data loss.

The fix is simple: instead of just breaking out of the loop, jump
directly to the cleanup code. This fixes some tests in t1404 that were
added in the previous commit.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>