gitweb.git
Merge branch 'jc/doc-gc-prune-now'Junio C Hamano Fri, 16 Oct 2015 21:42:50 +0000 (14:42 -0700)

Merge branch 'jc/doc-gc-prune-now'

"git gc" is safe to run anytime only because it has the built-in
grace period to protect young objects. In order to run with no
grace period, the user must make sure that the repository is
quiescent.

* jc/doc-gc-prune-now:
Documentation/gc: warn against --prune=<now>

Merge branch 'sb/submodule-config-parse'Junio C Hamano Fri, 16 Oct 2015 21:42:49 +0000 (14:42 -0700)

Merge branch 'sb/submodule-config-parse'

Code simplification.

* sb/submodule-config-parse:
submodule-config: "goto" removal in parse_config()

Merge branch 'jk/filter-branch-use-of-sed-on-incomplete... Junio C Hamano Fri, 16 Oct 2015 21:42:47 +0000 (14:42 -0700)

Merge branch 'jk/filter-branch-use-of-sed-on-incomplete-line'

A recent "filter-branch --msg-filter" broke skipping of the commit
object header, which is fixed.

* jk/filter-branch-use-of-sed-on-incomplete-line:
filter-branch: remove multi-line headers in msg filter

Merge branch 'rd/test-path-utils'Junio C Hamano Fri, 16 Oct 2015 21:42:44 +0000 (14:42 -0700)

Merge branch 'rd/test-path-utils'

The normalize_ceiling_entry() function does not muck with the end
of the path it accepts, and the real world callers do rely on that,
but a test insisted that the function drops a trailing slash.

* rd/test-path-utils:
test-path-utils.c: remove incorrect assumption

Fourth batch for 2.7Junio C Hamano Thu, 15 Oct 2015 22:48:56 +0000 (15:48 -0700)

Fourth batch for 2.7

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

Merge branch 'ls/p4-lfs'Junio C Hamano Thu, 15 Oct 2015 22:43:52 +0000 (15:43 -0700)

Merge branch 'ls/p4-lfs'

Teach "git p4" to send large blobs outside the repository by
talking to Git LFS.

* ls/p4-lfs:
git-p4: add Git LFS backend for large file system
git-p4: add support for large file systems
git-p4: check free space during streaming
git-p4: add file streaming progress in verbose mode
git-p4: return an empty list if a list config has no values
git-p4: add gitConfigInt reader
git-p4: add optional type specifier to gitConfig reader

Merge branch 'js/gc-with-stale-symref'Junio C Hamano Thu, 15 Oct 2015 22:43:51 +0000 (15:43 -0700)

Merge branch 'js/gc-with-stale-symref'

"git gc" used to barf when a symbolic ref has gone dangling
(e.g. the branch that used to be your upstream's default when you
cloned from it is now gone, and you did "fetch --prune").

* js/gc-with-stale-symref:
pack-objects: do not get distracted by broken symrefs
gc: demonstrate failure with stale remote HEAD

Merge branch 'js/clone-dissociate'Junio C Hamano Thu, 15 Oct 2015 22:43:49 +0000 (15:43 -0700)

Merge branch 'js/clone-dissociate'

"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 'tk/doc-interpret-trailers-grammo'Junio C Hamano Thu, 15 Oct 2015 22:43:48 +0000 (15:43 -0700)

Merge branch 'tk/doc-interpret-trailers-grammo'

* tk/doc-interpret-trailers-grammo:
Documentation/interpret-trailers: Grammar fix

Merge branch 'es/worktree-add-cleanup'Junio C Hamano Thu, 15 Oct 2015 22:43:47 +0000 (15:43 -0700)

Merge branch 'es/worktree-add-cleanup'

A no-op code-health maintenance.

* es/worktree-add-cleanup:
t2026: rename worktree prune test

Merge branch 'dt/log-follow-config'Junio C Hamano Thu, 15 Oct 2015 22:43:46 +0000 (15:43 -0700)

Merge branch 'dt/log-follow-config'

Description of the "log.follow" configuration variable in "git log"
documentation is now also copied to "git config" documentation.

* dt/log-follow-config:
log: Update log.follow doc and add to config.txt

Merge branch 'cc/quote-comments'Junio C Hamano Thu, 15 Oct 2015 22:43:44 +0000 (15:43 -0700)

Merge branch 'cc/quote-comments'

A no-op code-health maintenance.

* cc/quote-comments:
quote: move comment before sq_quote_buf()
quote: fix broken sq_quote_buf() related comment

Merge branch 'gr/rebase-i-drop-warn'Junio C Hamano Thu, 15 Oct 2015 22:43:44 +0000 (15:43 -0700)

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

"git rebase -i" had a minor regression recently, which stopped
considering a line that begins with an indented '#' in its insn
sheet not a comment, which is now fixed.

* gr/rebase-i-drop-warn:
rebase-i: loosen over-eager check_bad_cmd check
rebase-i: explicitly accept tab as separator in commands

Merge branch 'mm/detach-at-HEAD-reflog'Junio C Hamano Thu, 15 Oct 2015 22:43:42 +0000 (15:43 -0700)

Merge branch 'mm/detach-at-HEAD-reflog'

After "git checkout --detach", "git status" reported a fairly
useless "HEAD detached at HEAD", instead of saying at which exact
commit.

* mm/detach-at-HEAD-reflog:
status: don't say 'HEAD detached at HEAD'
t3203: test 'detached at' after checkout --detach

Merge branch 'sa/send-email-smtp-batch-data-limit'Junio C Hamano Thu, 15 Oct 2015 22:43:41 +0000 (15:43 -0700)

Merge branch 'sa/send-email-smtp-batch-data-limit'

When "git send-email" wanted to talk over Net::SMTP::SSL,
Net::Cmd::datasend() did not like to be fed too many bytes at the
same time and failed to send messages. Send the payload one line
at a time to work around the problem.

* sa/send-email-smtp-batch-data-limit:
git-send-email.perl: Fixed sending of many/huge changes/patches

Merge branch 'pt/am-builtin'Junio C Hamano Thu, 15 Oct 2015 22:43:40 +0000 (15:43 -0700)

Merge branch 'pt/am-builtin'

When "git am" was rewritten as a built-in, it stopped paying
attention to user.signingkey, which was fixed.

* pt/am-builtin:
am: configure gpg at startup

Merge branch 'nd/clone-linked-checkout'Junio C Hamano Thu, 15 Oct 2015 22:43:39 +0000 (15:43 -0700)

Merge branch 'nd/clone-linked-checkout'

It was not possible to use a repository-lookalike created by "git
worktree add" as a local source of "git clone".

* nd/clone-linked-checkout:
clone: better error when --reference is a linked checkout
clone: allow --local from a linked checkout
enter_repo: allow .git files in strict mode
enter_repo: avoid duplicating logic, use is_git_directory() instead
t0002: add test for enter_repo(), non-strict mode
path.c: delete an extra space

Merge branch 'js/icase-wt-detection'Junio C Hamano Thu, 15 Oct 2015 22:43:39 +0000 (15:43 -0700)

Merge branch 'js/icase-wt-detection'

On a case insensitive filesystems, setting GIT_WORK_TREE variable
using a random cases that does not agree with what the filesystem
thinks confused Git that it wasn't inside the working tree.

* js/icase-wt-detection:
setup: fix "inside work tree" detection on case-insensitive filesystems

Merge branch 'kn/for-each-branch'Junio C Hamano Thu, 15 Oct 2015 22:43:38 +0000 (15:43 -0700)

Merge branch 'kn/for-each-branch'

Update "git branch" that list existing branches, using the
ref-filter API that is shared with "git tag" and "git
for-each-ref".

* kn/for-each-branch:
branch: add '--points-at' option
branch.c: use 'ref-filter' APIs
branch.c: use 'ref-filter' data structures
branch: drop non-commit error reporting
branch: move 'current' check down to the presentation layer
branch: roll show_detached HEAD into regular ref_list
branch: bump get_head_description() to the top
branch: refactor width computation

Merge branch 'sb/perf-without-installed-git'Junio C Hamano Thu, 15 Oct 2015 22:43:37 +0000 (15:43 -0700)

Merge branch 'sb/perf-without-installed-git'

Performance-measurement tests did not work without an installed Git.

* sb/perf-without-installed-git:
t/perf: make runner work even if Git is not installed

Merge branch 'sb/http-flaky-test-fix'Junio C Hamano Thu, 15 Oct 2015 22:43:35 +0000 (15:43 -0700)

Merge branch 'sb/http-flaky-test-fix'

A test script for the HTTP service had a timing dependent bug,
which was fixed.

* sb/http-flaky-test-fix:
t5561: get rid of racy appending to logfile

Merge branch 'jc/fsck-dropped-errors'Junio C Hamano Thu, 15 Oct 2015 22:43:35 +0000 (15:43 -0700)

Merge branch 'jc/fsck-dropped-errors'

There were some classes of errors that "git fsck" diagnosed to its
standard error that did not cause it to exit with non-zero status.

* jc/fsck-dropped-errors:
fsck: exit with non-zero when problems are found

Merge branch 'ls/p4-translation-failure'Junio C Hamano Thu, 15 Oct 2015 22:43:34 +0000 (15:43 -0700)

Merge branch 'ls/p4-translation-failure'

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 'nd/gc-auto-background-fix'Junio C Hamano Thu, 15 Oct 2015 22:43:32 +0000 (15:43 -0700)

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

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 'mk/submodule-gitdir-path'Junio C Hamano Thu, 15 Oct 2015 22:43:31 +0000 (15:43 -0700)

Merge branch 'mk/submodule-gitdir-path'

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()

Third batch for 2.7Junio C Hamano Wed, 14 Oct 2015 21:31:23 +0000 (14:31 -0700)

Third batch for 2.7

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

Merge branch 'pt/pull-builtin'Junio C Hamano Wed, 14 Oct 2015 21:30:20 +0000 (14:30 -0700)

Merge branch 'pt/pull-builtin'

* pt/pull-builtin:
merge: grammofix in please-commit-before-merge message

Merge branch 'nd/ls-remote-does-not-have-u-option'Junio C Hamano Wed, 14 Oct 2015 21:30:19 +0000 (14:30 -0700)

Merge branch 'nd/ls-remote-does-not-have-u-option'

* nd/ls-remote-does-not-have-u-option:
ls-remote.txt: delete unsupported option

Merge branch 'jk/asciidoctor-section-heading-markup... Junio C Hamano Wed, 14 Oct 2015 21:30:17 +0000 (14:30 -0700)

Merge branch 'jk/asciidoctor-section-heading-markup-fix'

* jk/asciidoctor-section-heading-markup-fix:
Documentation: fix section header mark-up

Merge branch 'tk/typofix-connect-unknown-proto-error'Junio C Hamano Wed, 14 Oct 2015 21:30:16 +0000 (14:30 -0700)

Merge branch 'tk/typofix-connect-unknown-proto-error'

* tk/typofix-connect-unknown-proto-error:
connect: fix typo in result string of prot_name()

Merge branch 'jk/notes-dwim-doc'Junio C Hamano Wed, 14 Oct 2015 21:30:15 +0000 (14:30 -0700)

Merge branch 'jk/notes-dwim-doc'

The way how --ref/--notes to specify the notes tree reference are
DWIMmed was not clearly documented.

* jk/notes-dwim-doc:
notes: correct documentation of DWIMery for notes references

Documentation/gc: warn against --prune=<now>Junio C Hamano Wed, 14 Oct 2015 20:48:39 +0000 (13:48 -0700)

Documentation/gc: warn against --prune=<now>

"git gc" is safe to run anytime only because it has the built-in
grace period to protect objects that are created by other processes
that are waiting for ref updates to anchor them to the history. In
order to run with no grace period, the user must make sure that the
repository is quiescent.

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

submodule-config: "goto" removal in parse_config()Stefan Beller Mon, 12 Oct 2015 17:58:58 +0000 (10:58 -0700)

submodule-config: "goto" removal in parse_config()

Many components in if/else if/... cascade jumped to a shared
clean-up with "goto release_return", but we can restructure the
function a bit and make them disappear, which reduces the line count
as well. Also reformat overlong lines and poorly indented ones
while at it.

The order of rules to verify the value for "ignore" used to be to
complain on multiple values first and then complain to boolean, but
swap the order to match how the values for "path" and "url" are
verified.

CC: Eric Sunshine <sunshine@sunshineco.com>
CC: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

filter-branch: remove multi-line headers in msg filterJames McCoy Fri, 9 Oct 2015 00:21:13 +0000 (20:21 -0400)

filter-branch: remove multi-line headers in msg filter

df062010 (filter-branch: avoid passing commit message through sed)
introduced a regression when filtering commits with multi-line headers,
if the header contains a blank line. An example of this is a gpg-signed
commit:

$ git cat-file commit signed-commit
tree 3d4038e029712da9fc59a72afbfcc90418451630
parent 110eac945dc1713b27bdf49e74e5805db66971f0
author A U Thor <author@example.com> 1112912413 -0700
committer C O Mitter <committer@example.com> 1112912413 -0700
gpgsig -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iEYEABECAAYFAlYXADwACgkQE7b1Hs3eQw23CACgldB/InRyDgQwyiFyMMm3zFpj
pUsAnA+f3aMUsd9mNroloSmlOgL6jIMO
=0Hgm
-----END PGP SIGNATURE-----

Adding gpg

As a consequence, "filter-branch --msg-filter cat" (which should leave the
commit message unchanged) spills the signature (after the internal blank
line) into the original commit message.

The reason is that although the signature is indented, making the line a
whitespace only line, the "read" call is splitting the line based on
the shell's IFS, which defaults to <space><tab><newline>. The leading
space is consumed and $header_line is empty, causing the "skip header
lines" loop to exit.

The rest of the commit object is then re-used as the rewritten commit
message, causing the new message to include the signature of the
original commit.

Set IFS to an empty string for the "read" call, thus disabling the word
splitting, which causes $header_line to be set to the non-empty value ' '.
This allows the loop to fully consume the header lines before
emitting the original, intact commit message.

[jc: this is literally based on MJG's suggestion]

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: James McCoy <vega.james@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-multimail: update to release 1.2.0Matthieu Moy Sun, 11 Oct 2015 18:43:20 +0000 (20:43 +0200)

git-multimail: update to release 1.2.0

The changes are described in CHANGES.

Contributions-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Contributions-by: Elijah Newren <newren@palantir.com>
Contributions-by: Edward d'Auvergne <edward@nmr-relax.com>
Contributions-by: Vadim Zeitlin <vadim@zeitlins.org>
Contributions-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Contributions-by: Michael Haggerty <mhagger@alum.mit.edu>
Contributions-by: Elijah Newren <newren@gmail.com>
Contributions-by: Richard Hansen <rhansen@rhansen.org>
Contributions-by: Job Snijders <job@instituut.net>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

test-path-utils.c: remove incorrect assumptionRay Donnelly Thu, 1 Oct 2015 19:04:17 +0000 (20:04 +0100)

test-path-utils.c: remove incorrect assumption

In normalize_ceiling_entry(), we test that normalized paths end with
slash, *unless* the path to be normalized was already the root
directory.

However, normalize_path_copy() does not even enforce this condition.

Even worse: on Windows, the root directory gets translated into a
Windows directory by the Bash before being passed to `git.exe` (or
`test-path-utils.exe`), which means that we cannot even know whether
the path that was passed to us was the root directory to begin with.

This issue has already caused endless hours of trying to "fix" the
MSYS2 runtime, only to break other things due to MSYS2 ensuring that
the converted path maintains the same state as the input path with
respect to any final '/'.

So let's just forget about this test. It is non-essential to Git's
operation, anyway.

Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Ray Donnelly <mingw.android@gmail.com>

pack-objects: do not get distracted by broken symrefsJohannes Schindelin Mon, 28 Sep 2015 14:01:25 +0000 (16:01 +0200)

pack-objects: do not get distracted by broken symrefs

It is quite possible for, say, a remote HEAD to become broken, e.g.
when the default branch was renamed.

We should still be able to pack our objects when such a thing happens;
simply ignore broken symrefs (because they cannot matter for the packing
process anyway).

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

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

quote: move comment before sq_quote_buf()Christian Couder Wed, 7 Oct 2015 22:05:50 +0000 (00:05 +0200)

quote: move comment before sq_quote_buf()

A big comment at the beginning of quote.c is really
related to sq_quote_buf(), so let's move it in front
of this function.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

quote: fix broken sq_quote_buf() related commentChristian Couder Wed, 7 Oct 2015 22:05:49 +0000 (00:05 +0200)

quote: fix broken sq_quote_buf() related comment

Since 77d604c (Enhanced sq_quote(), 10 Oct 2005), the
comment at the beginning of quote.c is broken.
Let's fix it.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Second batch for 2.7Junio C Hamano Wed, 7 Oct 2015 20:38:43 +0000 (13:38 -0700)

Second batch for 2.7

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

Merge branch 'ls/p4-path-encoding'Junio C Hamano Wed, 7 Oct 2015 20:38:19 +0000 (13:38 -0700)

Merge branch 'ls/p4-path-encoding'

"git p4" learned to reencode the pathname it uses to communicate
with the p4 depot with a new option.

* ls/p4-path-encoding:
git-p4: use replacement character for non UTF-8 characters in paths
git-p4: improve path encoding verbose output
git-p4: add config git-p4.pathEncoding

Merge branch 'gb/filter-branch-progress'Junio C Hamano Wed, 7 Oct 2015 20:38:18 +0000 (13:38 -0700)

Merge branch 'gb/filter-branch-progress'

Give progress meter to "git filter-branch".

* gb/filter-branch-progress:
filter-branch: make report-progress more readable
filter-branch: add passed/remaining seconds on progress

Merge branch 'nd/ignore-then-not-ignore'Junio C Hamano Wed, 7 Oct 2015 20:38:17 +0000 (13:38 -0700)

Merge branch 'nd/ignore-then-not-ignore'

Allow a later "!/abc/def" to override an earlier "/abc" that
appears in the same .gitignore file to make it easier to express
"everything in /abc directory is ignored, except for ...".

* nd/ignore-then-not-ignore:
dir.c: don't exclude whole dir prematurely if neg pattern may match
dir.c: make last_exclude_matching_from_list() run til the end

Merge branch 'ti/glibc-stdio-mutex-from-signal-handler'Junio C Hamano Wed, 7 Oct 2015 20:38:16 +0000 (13:38 -0700)

Merge branch 'ti/glibc-stdio-mutex-from-signal-handler'

Allocation related functions and stdio are unsafe things to call
inside a signal handler, and indeed killing the pager can cause
glibc to deadlock waiting on allocation mutex as our signal handler
tries to free() some data structures in wait_for_pager(). Reduce
these unsafe calls.

* ti/glibc-stdio-mutex-from-signal-handler:
pager: don't use unsafe functions in signal handlers

Documentation/interpret-trailers: Grammar fixTobias Klauser Wed, 7 Oct 2015 16:46:22 +0000 (18:46 +0200)

Documentation/interpret-trailers: Grammar fix

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

clone --dissociate: avoid locking pack filesJohannes Schindelin Tue, 6 Oct 2015 13:18:47 +0000 (15:18 +0200)

clone --dissociate: avoid locking pack files

When `git clone` is asked to dissociate the repository from the
reference repository whose objects were used, it is quite possible that
the pack files need to be repacked. In that case, the pack files need to
be deleted that were originally hard-links to the reference repository's
pack files.

On platforms where a file cannot be deleted if another process still
holds a handle on it, we therefore need to take pains to release all
pack files and indexes before dissociating.

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

The test case to demonstrate the breakage technically does not need to
be run on Linux or MacOSX. It won't hurt, either, though.

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

sha1_file.c: add a function to release all packsJohannes Schindelin Tue, 6 Oct 2015 13:18:34 +0000 (15:18 +0200)

sha1_file.c: add a function to release all packs

On Windows, files that are in use cannot be removed or renamed. That
means that we have to release pack files when we are about to, say,
repack them. Let's introduce a convenient function to close all the
pack files and their idx files.

While at it, we consolidate the close windows/close fd/close index
stanza in `free_pack_by_name()` into the `close_pack()` function that
is used by the new `close_all_packs()` function to avoid repeated code.

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

t2026: rename worktree prune testMichael J Gruber Tue, 6 Oct 2015 10:12:21 +0000 (12:12 +0200)

t2026: rename worktree prune test

Linked checkouts are known under the name worktree, now. Rename the test
accordingly.

Specifically, this avoids the confusion that t2026 is actually not about
pruning in or with linked checkouts aka worktress but about pruning
worktrees, i.e. about "git worktree prune" rather than "git prune".

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

log: Update log.follow doc and add to config.txtEric N. Vander Weele Wed, 7 Oct 2015 01:14:33 +0000 (21:14 -0400)

log: Update log.follow doc and add to config.txt

Documentation/config.txt does not include the documentation for
log.follow that is in Documentation/git-log.txt. This commit adds the
log.follow documentation to config.txt and also updates the wording to
be consistent with the format that is followed by other boolean
configuration variables.

Signed-off-by: Eric N. Vander Weele <ericvw@gmail.com>
Acked-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase-i: loosen over-eager check_bad_cmd checkMatthieu Moy Thu, 1 Oct 2015 08:18:42 +0000 (10:18 +0200)

rebase-i: loosen over-eager check_bad_cmd check

804098bb (git rebase -i: add static check for commands and SHA-1,
2015-06-29) tried to check all insns before running any in the todo
list, but it did so by implementing its own parser that is a lot
stricter than necessary. We used to allow lines that are indented
(including comment lines), and we used to allow a whitespace between
the insn and the commit object name to be HT, among other things,
that are flagged as an invalid line by mistake.

Fix this by using the same tokenizer that is used to parse the todo
list file in the new check.

Whether it's a good thing to accept indented comments is
debatable (other commands like "git commit" do not accept them), but we
already accepted them in the past, and some people and scripts rely on
this behavior. Also, a line starting with space followed by a '#' cannot
have any meaning other than being a comment, hence it doesn't harm to
accept them as comments.

Largely based on patch by: Junio C Hamano <gitster@pobox.com>

[jc: updated test with quickfix from Torsten Bögershausen]

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

gc: demonstrate failure with stale remote HEADJohannes Schindelin Mon, 28 Sep 2015 14:01:13 +0000 (16:01 +0200)

gc: demonstrate failure with stale remote HEAD

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

sha1_file: consolidate code to close a pack's file... Johannes Schindelin Mon, 5 Oct 2015 20:30:24 +0000 (22:30 +0200)

sha1_file: consolidate code to close a pack's file descriptor

There was a lot of repeated code to close the file descriptor of
a given pack. Let's just refactor this code into a single function.

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

t5700: demonstrate a Windows file locking issue with... Johannes Schindelin Mon, 5 Oct 2015 20:29:59 +0000 (22:29 +0200)

t5700: demonstrate a Windows file locking issue with `git clone --dissociate`

On Windows, dissociating from a reference can fail very easily due to
pack files that are still in use when they want to be removed.

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

Start cycle toward 2.7Junio C Hamano Mon, 5 Oct 2015 19:58:10 +0000 (12:58 -0700)

Start cycle toward 2.7

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

Sync with 2.6.1Junio C Hamano Mon, 5 Oct 2015 19:46:27 +0000 (12:46 -0700)

Sync with 2.6.1

Merge branch 'mm/keyid-docs'Junio C Hamano Mon, 5 Oct 2015 19:30:26 +0000 (12:30 -0700)

Merge branch 'mm/keyid-docs'

Very small number of options take a parameter that is optional
(which is not a great UI element as they can only appear at the end
of the command line). Add notice to documentation of each and
every one of them.

* mm/keyid-docs:
Documentation: explain optional arguments better
Documentation/grep: fix documentation of -O
Documentation: use 'keyid' consistently, not 'key-id'

Merge branch 'bb/remote-get-url'Junio C Hamano Mon, 5 Oct 2015 19:30:25 +0000 (12:30 -0700)

Merge branch 'bb/remote-get-url'

"git remote" learned "get-url" subcommand to show the URL for a
given remote name used for fetching and pushing.

* bb/remote-get-url:
remote: add get-url subcommand

Merge branch 'jk/blame-first-parent'Junio C Hamano Mon, 5 Oct 2015 19:30:24 +0000 (12:30 -0700)

Merge branch 'jk/blame-first-parent'

"git blame --first-parent v1.0..v2.0" was not rejected but did not
limit the blame to commits on the first parent chain.

* jk/blame-first-parent:
blame: handle --first-parent

Merge branch 'jw/make-arflags-customizable'Junio C Hamano Mon, 5 Oct 2015 19:30:23 +0000 (12:30 -0700)

Merge branch 'jw/make-arflags-customizable'

The Makefile always runs the library archiver with hardcoded "crs"
options, which was inconvenient for exotic platforms on which
people want to use programs with totally different set of command
line options.

* jw/make-arflags-customizable:
Makefile: allow $(ARFLAGS) specified from the command line

Merge branch 'jk/rebase-no-autostash'Junio C Hamano Mon, 5 Oct 2015 19:30:21 +0000 (12:30 -0700)

Merge branch 'jk/rebase-no-autostash'

There was no way to defeat a configured rebase.autostash variable
from the command line, as "git rebase --no-autostash" was missing.

* jk/rebase-no-autostash:
Documentation/git-rebase: fix --no-autostash formatting
rebase: support --no-autostash

Merge branch 'jk/make-findstring-makeflags-fix'Junio C Hamano Mon, 5 Oct 2015 19:30:20 +0000 (12:30 -0700)

Merge branch 'jk/make-findstring-makeflags-fix'

Customization to change the behaviour with "make -w" and "make -s"
in our Makefile was broken when they were used together.

* jk/make-findstring-makeflags-fix:
Makefile: fix MAKEFLAGS tests with multiple flags

Merge branch 'sb/submodule-helper'Junio C Hamano Mon, 5 Oct 2015 19:30:19 +0000 (12:30 -0700)

Merge branch 'sb/submodule-helper'

The infrastructure to rewrite "git submodule" in C is being built
incrementally. Let's polish these early parts well enough and make
them graduate to 'next' and 'master', so that the more involved
follow-up can start cooking on a solid ground.

* sb/submodule-helper:
submodule: rewrite `module_clone` shell function in C
submodule: rewrite `module_name` shell function in C
submodule: rewrite `module_list` shell function in C

Merge branch 'kn/for-each-tag'Junio C Hamano Mon, 5 Oct 2015 19:30:18 +0000 (12:30 -0700)

Merge branch 'kn/for-each-tag'

The "ref-filter" code was taught about many parts of what "tag -l"
does and then "tag -l" is being reimplemented in terms of "ref-filter".

* kn/for-each-tag:
tag.c: implement '--merged' and '--no-merged' options
tag.c: implement '--format' option
tag.c: use 'ref-filter' APIs
tag.c: use 'ref-filter' data structures
ref-filter: add option to match literal pattern
ref-filter: add support to sort by version
ref-filter: add support for %(contents:lines=X)
ref-filter: add option to filter out tags, branches and remotes
ref-filter: implement an `align` atom
ref-filter: introduce match_atom_name()
ref-filter: introduce handler function for each atom
utf8: add function to align a string into given strbuf
ref-filter: introduce ref_formatting_state and ref_formatting_stack
ref-filter: move `struct atom_value` to ref-filter.c
strtoul_ui: reject negative values

Merge branch 'jk/test-lint-forbid-when-finished-in... Junio C Hamano Mon, 5 Oct 2015 19:30:17 +0000 (12:30 -0700)

Merge branch 'jk/test-lint-forbid-when-finished-in-subshell'

Because "test_when_finished" in our test framework queues the
clean-up tasks to be done in a shell variable, it should not be
used inside a subshell. Add a mechanism to allow 'bash' to catch
such uses, and fix the ones that were found.

* jk/test-lint-forbid-when-finished-in-subshell:
test-lib-functions: detect test_when_finished in subshell
t7800: don't use test_config in a subshell
test-lib-functions: support "test_config -C <dir> ..."
t5801: don't use test_when_finished in a subshell
t7610: don't use test_config in a subshell

Merge branch 'jk/interpret-trailers-outside-a-repository'Junio C Hamano Mon, 5 Oct 2015 19:30:16 +0000 (12:30 -0700)

Merge branch 'jk/interpret-trailers-outside-a-repository'

Allow "git interpret-trailers" to run outside of a Git repository.

* jk/interpret-trailers-outside-a-repository:
interpret-trailers: allow running outside a repository

Merge branch 'as/subtree-with-spaces'Junio C Hamano Mon, 5 Oct 2015 19:30:15 +0000 (12:30 -0700)

Merge branch 'as/subtree-with-spaces'

Update "git subtree" (in contrib/) so that it can take whitespaces
in the pathnames, not only in the in-tree pathname but the name of
the directory that the repository is in.

* as/subtree-with-spaces:
contrib/subtree: respect spaces in a repository path
t7900-subtree: test the "space in a subdirectory name" case

Merge branch 'jk/connect-clear-env'Junio C Hamano Mon, 5 Oct 2015 19:30:14 +0000 (12:30 -0700)

Merge branch 'jk/connect-clear-env'

The ssh transport, just like any other transport over the network,
did not clear GIT_* environment variables, but it is possible to
use SendEnv and AcceptEnv to leak them to the remote invocation of
Git, which is not a good idea at all. Explicitly clear them just
like we do for the local transport.

* jk/connect-clear-env:
git_connect: clarify conn->use_shell flag
git_connect: clear GIT_* environment for ssh

Merge branch 'jk/date-local'Junio C Hamano Mon, 5 Oct 2015 19:30:12 +0000 (12:30 -0700)

Merge branch 'jk/date-local'

"git log --date=local" used to only show the normal (default)
format in the local timezone. The command learned to take 'local'
as an instruction to use the local timezone with other formats,
e.g. "git show --date=rfc-local".

* jk/date-local:
t6300: add tests for "-local" date formats
t6300: make UTC and local dates different
date: make "local" orthogonal to date format
date: check for "local" before anything else
t6300: add test for "raw" date format
t6300: introduce test_date() helper
fast-import: switch crash-report date to iso8601
Documentation/rev-list: don't list date formats
Documentation/git-for-each-ref: don't list date formats
Documentation/config: don't list date formats
Documentation/blame-options: don't list date formats

Merge branch 'dt/refs-bisection'Junio C Hamano Mon, 5 Oct 2015 19:30:11 +0000 (12:30 -0700)

Merge branch 'dt/refs-bisection'

Move the refs used during a "git bisect" session to per-worktree
hierarchy refs/worktree/* so that independent bisect sessions can
be done in different worktrees.

* dt/refs-bisection:
refs: make refs/bisect/* per-worktree
path: optimize common dir checking
refs: clean up common_list

Merge branch 'nk/stash-show-config'Junio C Hamano Mon, 5 Oct 2015 19:30:10 +0000 (12:30 -0700)

Merge branch 'nk/stash-show-config'

Users who are too busy to type three extra keystrokes to ask for
"git stash show -p" can now set stash.showPatch configuration
varible to true to always see the actual patch, not just the list
of paths affected with feel for the extent of damage via diffstat.

* nk/stash-show-config:
stash: allow "stash show" diff output configurable

Merge branch 'jk/async-pkt-line'Junio C Hamano Mon, 5 Oct 2015 19:30:09 +0000 (12:30 -0700)

Merge branch 'jk/async-pkt-line'

The debugging infrastructure for pkt-line based communication has
been improved to mark the side-band communication specifically.

* jk/async-pkt-line:
pkt-line: show packets in async processes as "sideband"
run-command: provide in_async query function

Merge branch 'jh/quiltimport-explicit-series-file'Junio C Hamano Mon, 5 Oct 2015 19:30:08 +0000 (12:30 -0700)

Merge branch 'jh/quiltimport-explicit-series-file'

"quiltimport" allows to specify the series file by honoring the
$QUILT_SERIES environment and also --series command line option.

* jh/quiltimport-explicit-series-file:
git-quiltimport: add commandline option --series <file>

Merge branch 'ld/p4-import-labels'Junio C Hamano Mon, 5 Oct 2015 19:30:07 +0000 (12:30 -0700)

Merge branch 'ld/p4-import-labels'

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 'ad/bisect-terms'Junio C Hamano Mon, 5 Oct 2015 19:30:06 +0000 (12:30 -0700)

Merge branch 'ad/bisect-terms'

The use of 'good/bad' in "git bisect" made it confusing to use when
hunting for a state change that is not a regression (e.g. bugfix).
The command learned 'old/new' and then allows the end user to
say e.g. "bisect start --term-old=fast --term=new=slow" to find a
performance regression.

Michael's idea to make 'good/bad' more intelligent does have
certain attractiveness ($gname/272867), and makes some of the work
on this topic a moot point.

* ad/bisect-terms:
bisect: allow setting any user-specified in 'git bisect start'
bisect: add 'git bisect terms' to view the current terms
bisect: add the terms old/new
bisect: sanity check on terms

Merge branch 'jc/rerere'Junio C Hamano Mon, 5 Oct 2015 19:30:04 +0000 (12:30 -0700)

Merge branch 'jc/rerere'

Code clean-up and minor fixes.

* jc/rerere: (21 commits)
rerere: un-nest merge() further
rerere: use "struct rerere_id" instead of "char *" for conflict ID
rerere: call conflict-ids IDs
rerere: further clarify do_rerere_one_path()
rerere: further de-dent do_plain_rerere()
rerere: refactor "replay" part of do_plain_rerere()
rerere: explain the remainder
rerere: explain "rerere forget" codepath
rerere: explain the primary codepath
rerere: explain MERGE_RR management helpers
rerere: fix benign off-by-one non-bug and clarify code
rerere: explain the rerere I/O abstraction
rerere: do not leak mmfile[] for a path with multiple stage #1 entries
rerere: stop looping unnecessarily
rerere: drop want_sp parameter from is_cmarker()
rerere: report autoupdated paths only after actually updating them
rerere: write out each record of MERGE_RR in one go
rerere: lift PATH_MAX limitation
rerere: plug conflict ID leaks
rerere: handle conflicts with multiple stage #1 entries
...

Merge branch 'kn/for-each-tag-branch'Junio C Hamano Mon, 5 Oct 2015 19:30:02 +0000 (12:30 -0700)

Merge branch 'kn/for-each-tag-branch'

Some features from "git tag -l" and "git branch -l" have been made
available to "git for-each-ref" so that eventually the unified
implementation can be shared across all three, in a follow-up
series or two.

* kn/for-each-tag-branch:
for-each-ref: add '--contains' option
ref-filter: implement '--contains' option
parse-options.h: add macros for '--contains' option
parse-option: rename parse_opt_with_commit()
for-each-ref: add '--merged' and '--no-merged' options
ref-filter: implement '--merged' and '--no-merged' options
ref-filter: add parse_opt_merge_filter()
for-each-ref: add '--points-at' option
ref-filter: implement '--points-at' option
tag: libify parse_opt_points_at()
t6302: for-each-ref tests for ref-filter APIs

git-p4: add Git LFS backend for large file systemLars Schneider Sat, 26 Sep 2015 07:55:04 +0000 (09:55 +0200)

git-p4: add Git LFS backend for large file system

Add example implementation including test cases for the large file
system using Git LFS.

Pushing files to the Git LFS server is not tested.

Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: add support for large file systemsLars Schneider Sat, 26 Sep 2015 07:55:03 +0000 (09:55 +0200)

git-p4: add support for large file systems

Perforce repositories can contain large (binary) files. Migrating these
repositories to Git generates very large local clones. External storage
systems such as Git LFS [1], Git Fat [2], Git Media [3], git-annex [4]
try to address this problem.

Add a generic mechanism to detect large files based on extension,
uncompressed size, and/or compressed size.

[1] https://git-lfs.github.com/
[2] https://github.com/jedbrown/git-fat
[3] https://github.com/alebedev/git-media
[4] https://git-annex.branchable.com/

Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Conflicts:
Documentation/git-p4.txt
git-p4.py
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: check free space during streamingLars Schneider Sat, 26 Sep 2015 07:55:02 +0000 (09:55 +0200)

git-p4: check free space during streaming

git-p4 will just halt if there is not enough disk space while
streaming content from P4 to Git. Add a check to ensure at least
4 times (arbitrarily chosen) the size of a streamed file is available.

Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: add file streaming progress in verbose modeLars Schneider Sat, 26 Sep 2015 07:55:01 +0000 (09:55 +0200)

git-p4: add file streaming progress in verbose mode

If a file is streamed from P4 to Git then the verbose mode prints
continuously the progress as percentage like this:
//depot/file.bin 20% (10 MB)

Upon completion the progress is overwritten with depot source, local
file and size like this:
//depot/file.bin --> local/file.bin (10 MB)

Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: return an empty list if a list config has no... Lars Schneider Sat, 26 Sep 2015 07:55:00 +0000 (09:55 +0200)

git-p4: return an empty list if a list config has no values

Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: add gitConfigInt readerLars Schneider Sat, 26 Sep 2015 07:54:59 +0000 (09:54 +0200)

git-p4: add gitConfigInt reader

Add a git config reader for integer variables. Please note that the
git config implementation automatically supports k, m, and g suffixes.

Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: add optional type specifier to gitConfig readerLars Schneider Sat, 26 Sep 2015 07:54:58 +0000 (09:54 +0200)

git-p4: add optional type specifier to gitConfig reader

The functions "gitConfig" and "gitConfigBool" are almost identical.
Make "gitConfig" more generic by adding an optional type specifier.
Use the type specifier "--bool" with "gitConfig" to implement
"gitConfigBool. This prepares the implementation of other type
specifiers such as "--int".

Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Acked-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

merge: grammofix in please-commit-before-merge messageAlex Henrie Fri, 2 Oct 2015 04:25:33 +0000 (22:25 -0600)

merge: grammofix in please-commit-before-merge message

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase-i: explicitly accept tab as separator in commandsMatthieu Moy Thu, 1 Oct 2015 08:18:41 +0000 (10:18 +0200)

rebase-i: explicitly accept tab as separator in commands

The git-rebase-todo is parsed several times with different parsers. In
principle, the user input is normalized by transform_todo_ids and
further parsing can be stricter.

In case the user wrote

pick deadbeef<TAB>commit message

the parser of transform_todo_ids was considering the sha1 to be
"deadbeef<TAB>commit", and was leaving the tab in the transformed sheet.
In practice, this went unnoticed since the actual command interpretation
was done later in do_next which did accept the tab as a separator.

Make it explicit in the code of transform_todo_ids that tabs are
accepted. This way, code that mimicks it will also accept tabs as
separator.

A similar construct appears in skip_unnecessary_picks, but this one
comes after transform_todo_ids, hence reads the normalized format, so it
needs not be changed.

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

status: don't say 'HEAD detached at HEAD'Matthieu Moy Sun, 27 Sep 2015 15:13:42 +0000 (17:13 +0200)

status: don't say 'HEAD detached at HEAD'

After using "git checkout --detach", the reflog is left with an entry
like

checkout: moving from ... to HEAD

This message is parsed to generate the 'HEAD detached at' message in
'git branch' and 'git status', which leads to the not-so-useful message
'HEAD detached at HEAD'.

Instead, when parsing such reflog entry, resolve HEAD to the
corresponding commit in the reflog, so that the message becomes 'HEAD
detached at $sha1'.

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

t3203: test 'detached at' after checkout --detachMatthieu Moy Sun, 27 Sep 2015 15:13:41 +0000 (17:13 +0200)

t3203: test 'detached at' after checkout --detach

This currently fails: the output is 'HEAD detached at HEAD'.

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

am: configure gpg at startupRenee Margaret McConahy Wed, 30 Sep 2015 17:49:44 +0000 (13:49 -0400)

am: configure gpg at startup

The new builtin am ignores the user.signingkey variable: gpg is being
called with the committer details as the key ID, which may not be
correct. git_gpg_config is responsible for handling that variable and is
expected to be called on initialization by any modules that use gpg.

Signed-off-by: Renee Margaret McConahy <nepella@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-send-email.perl: Fixed sending of many/huge changes... Stefan Agner Wed, 30 Sep 2015 07:26:09 +0000 (09:26 +0200)

git-send-email.perl: Fixed sending of many/huge changes/patches

Sometimes sending huge patches/commits fail with

[Net::SMTP::SSL] Connection closed at /usr/lib/git-core/git-send-email
line 1320.

Running the command with --smtp-debug=1 yields to

Net::SMTP::SSL: Net::Cmd::datasend(): unexpected EOF on command channel:
at /usr/lib/git-core/git-send-email line 1320.
[Net::SMTP::SSL] Connection closed at /usr/lib/git-core/git-send-email
line 1320.

Stefan described it in his mail like this:

It seems to me that there is a size limit, after cutting down the patch
to ~16K, sending started to work. I cut it twice, once by removing lines
from the head and once from the bottom, in both cases at the size of
around 16K I could send the patch.

See also original report:
http://permalink.gmane.org/gmane.comp.version-control.git/274569

Reported-by: Juston Li <juston.h.li@gmail.com>
Tested-by: Markos Chandras <hwoarang@gentoo.org>
Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Git 2.6.1 v2.6.1Junio C Hamano Tue, 29 Sep 2015 02:19:27 +0000 (19:19 -0700)

Git 2.6.1

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

Sync with v2.5.4Junio C Hamano Tue, 29 Sep 2015 02:16:54 +0000 (19:16 -0700)

Sync with v2.5.4

Git 2.5.4 v2.5.4Junio C Hamano Mon, 28 Sep 2015 22:26:49 +0000 (15:26 -0700)

Git 2.5.4

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

Sync with 2.4.10Junio C Hamano Mon, 28 Sep 2015 22:33:56 +0000 (15:33 -0700)

Sync with 2.4.10

Git 2.4.10 v2.4.10Junio C Hamano Mon, 28 Sep 2015 22:29:54 +0000 (15:29 -0700)

Git 2.4.10

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

Sync with 2.3.10Junio C Hamano Mon, 28 Sep 2015 22:28:26 +0000 (15:28 -0700)

Sync with 2.3.10

Git 2.3.10 v2.3.10Junio C Hamano Mon, 28 Sep 2015 22:00:37 +0000 (15:00 -0700)

Git 2.3.10

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

Merge branch 'jk/xdiff-memory-limits' into maint-2.3Junio C Hamano Mon, 28 Sep 2015 21:59:28 +0000 (14:59 -0700)

Merge branch 'jk/xdiff-memory-limits' into maint-2.3

merge-file: enforce MAX_XDIFF_SIZE on incoming filesJeff King Fri, 25 Sep 2015 21:58:09 +0000 (17:58 -0400)

merge-file: enforce MAX_XDIFF_SIZE on incoming files

The previous commit enforces MAX_XDIFF_SIZE at the
interfaces to xdiff: xdi_diff (which calls xdl_diff) and
ll_xdl_merge (which calls xdl_merge).

But we have another direct call to xdl_merge in
merge-file.c. If it were written today, this probably would
just use the ll_merge machinery. But it predates that code,
and uses slightly different options to xdl_merge (e.g.,
ZEALOUS_ALNUM).

We could try to abstract out an xdi_merge to match the
existing xdi_diff, but even that is difficult. Rather than
simply report error, we try to treat large files as binary,
and that distinction would happen outside of xdi_merge.

The simplest fix is to just replicate the MAX_XDIFF_SIZE
check in merge-file.c.

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

xdiff: reject files larger than ~1GBJeff King Thu, 24 Sep 2015 23:12:45 +0000 (19:12 -0400)

xdiff: reject files larger than ~1GB

The xdiff code is not prepared to handle extremely large
files. It uses "int" in many places, which can overflow if
we have a very large number of lines or even bytes in our
input files. This can cause us to produce incorrect diffs,
with no indication that the output is wrong. Or worse, we
may even underallocate a buffer whose size is the result of
an overflowing addition.

We're much better off to tell the user that we cannot diff
or merge such a large file. This patch covers both cases,
but in slightly different ways:

1. For merging, we notice the large file and cleanly fall
back to a binary merge (which is effectively "we cannot
merge this").

2. For diffing, we make the binary/text distinction much
earlier, and in many different places. For this case,
we'll use the xdi_diff as our choke point, and reject
any diff there before it hits the xdiff code.

This means in most cases we'll die() immediately after.
That's not ideal, but in practice we shouldn't
generally hit this code path unless the user is trying
to do something tricky. We already consider files
larger than core.bigfilethreshold to be binary, so this
code would only kick in when that is circumvented
(either by bumping that value, or by using a
.gitattribute to mark a file as diffable).

In other words, we can avoid being "nice" here, because
there is already nice code that tries to do the right
thing. We are adding the suspenders to the nice code's
belt, so notice when it has been worked around (both to
protect the user from malicious inputs, and because it
is better to die() than generate bogus output).

The maximum size was chosen after experimenting with feeding
large files to the xdiff code. It's just under a gigabyte,
which leaves room for two obvious cases:

- a diff3 merge conflict result on files of maximum size X
could be 3*X plus the size of the markers, which would
still be only about 3G, which fits in a 32-bit int.

- some of the diff code allocates arrays of one int per
record. Even if each file consists only of blank lines,
then a file smaller than 1G will have fewer than 1G
records, and therefore the int array will fit in 4G.

Since the limit is arbitrary anyway, I chose to go under a
gigabyte, to leave a safety margin (e.g., we would not want
to overflow by allocating "(records + 1) * sizeof(int)" or
similar.

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

react to errors in xdi_diffJeff King Thu, 24 Sep 2015 23:12:23 +0000 (19:12 -0400)

react to errors in xdi_diff

When we call into xdiff to perform a diff, we generally lose
the return code completely. Typically by ignoring the return
of our xdi_diff wrapper, but sometimes we even propagate
that return value up and then ignore it later. This can
lead to us silently producing incorrect diffs (e.g., "git
log" might produce no output at all, not even a diff header,
for a content-level diff).

In practice this does not happen very often, because the
typical reason for xdiff to report failure is that it
malloc() failed (it uses straight malloc, and not our
xmalloc wrapper). But it could also happen when xdiff
triggers one our callbacks, which returns an error (e.g.,
outf() in builtin/rerere.c tries to report a write failure
in this way). And the next patch also plans to add more
failure modes.

Let's notice an error return from xdiff and react
appropriately. In most of the diff.c code, we can simply
die(), which matches the surrounding code (e.g., that is
what we do if we fail to load a file for diffing in the
first place). This is not that elegant, but we are probably
better off dying to let the user know there was a problem,
rather than simply generating bogus output.

We could also just die() directly in xdi_diff, but the
callers typically have a bit more context, and can provide a
better message (and if we do later decide to pass errors up,
we're one step closer to doing so).

There is one interesting case, which is in diff_grep(). Here
if we cannot generate the diff, there is nothing to match,
and we silently return "no hits". This is actually what the
existing code does already, but we make it a little more
explicit.

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