gitweb.git
Sync with Git 2.14.4Junio C Hamano Thu, 27 Sep 2018 18:20:22 +0000 (11:20 -0700)

Sync with Git 2.14.4

* maint-2.14:
Git 2.14.5
submodule-config: ban submodule paths that start with a dash
submodule-config: ban submodule urls that start with dash
submodule--helper: use "--" to signal end of clone options

Git 2.14.5 v2.14.5Junio C Hamano Thu, 27 Sep 2018 18:19:11 +0000 (11:19 -0700)

Git 2.14.5

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

submodule-config: ban submodule paths that start with... Jeff King Mon, 24 Sep 2018 08:39:55 +0000 (04:39 -0400)

submodule-config: ban submodule paths that start with a dash

We recently banned submodule urls that look like
command-line options. This is the matching change to ban
leading-dash paths.

As with the urls, this should not break any use cases that
currently work. Even with our "--" separator passed to
git-clone, git-submodule.sh gets confused. Without the code
portion of this patch, the clone of "-sub" added in t7417
would yield results like:

/path/to/git-submodule: 410: cd: Illegal option -s
/path/to/git-submodule: 417: cd: Illegal option -s
/path/to/git-submodule: 410: cd: Illegal option -s
/path/to/git-submodule: 417: cd: Illegal option -s
Fetched in submodule path '-sub', but it did not contain b56243f8f4eb91b2f1f8109452e659f14dd3fbe4. Direct fetching of that commit failed.

Moreover, naively adding such a submodule doesn't work:

$ git submodule add $url -sub
The following path is ignored by one of your .gitignore files:
-sub

even though there is no such ignore pattern (the test script
hacks around this with a well-placed "git mv").

Unlike leading-dash urls, though, it's possible that such a
path _could_ be useful if we eventually made it work. So
this commit should be seen not as recommending a particular
policy, but rather temporarily closing off a broken and
possibly dangerous code-path. We may revisit this decision
later.

There are two minor differences to the tests in t7416 (that
covered urls):

1. We don't have a "./-sub" escape hatch to make this
work, since the submodule code expects to be able to
match canonical index names to the path field (so you
are free to add submodule config with that path, but we
would never actually use it, since an index entry would
never start with "./").

2. After this patch, cloning actually succeeds. Since we
ignore the submodule.*.path value, we fail to find a
config stanza for our submodule at all, and simply
treat it as inactive. We still check for the "ignoring"
message.

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

submodule-config: ban submodule urls that start with... Jeff King Mon, 24 Sep 2018 08:36:30 +0000 (04:36 -0400)

submodule-config: ban submodule urls that start with dash

The previous commit taught the submodule code to invoke our
"git clone $url $path" with a "--" separator so that we
aren't confused by urls or paths that start with dashes.

However, that's just one code path. It's not clear if there
are others, and it would be an easy mistake to add one in
the future. Moreover, even with the fix in the previous
commit, it's quite hard to actually do anything useful with
such an entry. Any url starting with a dash must fall into
one of three categories:

- it's meant as a file url, like "-path". But then any
clone is not going to have the matching path, since it's
by definition relative inside the newly created clone. If
you spell it as "./-path", the submodule code sees the
"/" and translates this to an absolute path, so it at
least works (assuming the receiver has the same
filesystem layout as you). But that trick does not apply
for a bare "-path".

- it's meant as an ssh url, like "-host:path". But this
already doesn't work, as we explicitly disallow ssh
hostnames that begin with a dash (to avoid option
injection against ssh).

- it's a remote-helper scheme, like "-scheme::data". This
_could_ work if the receiver bends over backwards and
creates a funny-named helper like "git-remote--scheme".
But normally there would not be any helper that matches.

Since such a url does not work today and is not likely to do
anything useful in the future, let's simply disallow them
entirely. That protects the existing "git clone" path (in a
belt-and-suspenders way), along with any others that might
exist.

Our tests cover two cases:

1. A file url with "./" continues to work, showing that
there's an escape hatch for people with truly silly
repo names.

2. A url starting with "-" is rejected.

Note that we expect case (2) to fail, but it would have done
so even without this commit, for the reasons given above.
So instead of just expecting failure, let's also check for
the magic word "ignoring" on stderr. That lets us know that
we failed for the right reason.

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

submodule--helper: use "--" to signal end of clone... Jeff King Mon, 24 Sep 2018 08:32:15 +0000 (04:32 -0400)

submodule--helper: use "--" to signal end of clone options

When we clone a submodule, we call "git clone $url $path".
But there's nothing to say that those components can't begin
with a dash themselves, confusing git-clone into thinking
they're options. Let's pass "--" to make it clear what we
expect.

There's no test here, because it's actually quite hard to
make these names work, even with "git clone" parsing them
correctly. And we're going to restrict these cases even
further in future commits. So we'll leave off testing until
then; this is just the minimal fix to prevent us from doing
something stupid with a badly formed entry.

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

Git 2.15.2 v2.15.2Junio C Hamano Tue, 22 May 2018 05:15:59 +0000 (14:15 +0900)

Git 2.15.2

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

Sync with Git 2.14.4Junio C Hamano Tue, 22 May 2018 05:15:14 +0000 (14:15 +0900)

Sync with Git 2.14.4

* maint-2.14:
Git 2.14.4
Git 2.13.7
verify_path: disallow symlinks in .gitmodules
update-index: stat updated files earlier
verify_dotfile: mention case-insensitivity in comment
verify_path: drop clever fallthrough
skip_prefix: add case-insensitive variant
is_{hfs,ntfs}_dotgitmodules: add tests
is_ntfs_dotgit: match other .git files
is_hfs_dotgit: match other .git files
is_ntfs_dotgit: use a size_t for traversing string
submodule-config: verify submodule names as paths

Git 2.14.4 v2.14.4Junio C Hamano Tue, 22 May 2018 05:12:02 +0000 (14:12 +0900)

Git 2.14.4

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

Sync with Git 2.13.7Junio C Hamano Tue, 22 May 2018 05:10:49 +0000 (14:10 +0900)

Sync with Git 2.13.7

* maint-2.13:
Git 2.13.7
verify_path: disallow symlinks in .gitmodules
update-index: stat updated files earlier
verify_dotfile: mention case-insensitivity in comment
verify_path: drop clever fallthrough
skip_prefix: add case-insensitive variant
is_{hfs,ntfs}_dotgitmodules: add tests
is_ntfs_dotgit: match other .git files
is_hfs_dotgit: match other .git files
is_ntfs_dotgit: use a size_t for traversing string
submodule-config: verify submodule names as paths

Git 2.13.7 v2.13.7Junio C Hamano Tue, 22 May 2018 04:50:36 +0000 (13:50 +0900)

Git 2.13.7

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

Merge branch 'jk/submodule-fix-loose' into maint-2.13Junio C Hamano Tue, 22 May 2018 04:48:26 +0000 (13:48 +0900)

Merge branch 'jk/submodule-fix-loose' into maint-2.13

* jk/submodule-fix-loose:
verify_path: disallow symlinks in .gitmodules
update-index: stat updated files earlier
verify_dotfile: mention case-insensitivity in comment
verify_path: drop clever fallthrough
skip_prefix: add case-insensitive variant
is_{hfs,ntfs}_dotgitmodules: add tests
is_ntfs_dotgit: match other .git files
is_hfs_dotgit: match other .git files
is_ntfs_dotgit: use a size_t for traversing string
submodule-config: verify submodule names as paths

verify_path: disallow symlinks in .gitmodulesJeff King Sat, 5 May 2018 00:03:35 +0000 (20:03 -0400)

verify_path: disallow symlinks in .gitmodules

There are a few reasons it's not a good idea to make
.gitmodules a symlink, including:

1. It won't be portable to systems without symlinks.

2. It may behave inconsistently, since Git may look at
this file in the index or a tree without bothering to
resolve any symbolic links. We don't do this _yet_, but
the config infrastructure is there and it's planned for
the future.

With some clever code, we could make (2) work. And some
people may not care about (1) if they only work on one
platform. But there are a few security reasons to simply
disallow it:

a. A symlinked .gitmodules file may circumvent any fsck
checks of the content.

b. Git may read and write from the on-disk file without
sanity checking the symlink target. So for example, if
you link ".gitmodules" to "../oops" and run "git
submodule add", we'll write to the file "oops" outside
the repository.

Again, both of those are problems that _could_ be solved
with sufficient code, but given the complications in (1) and
(2), we're better off just outlawing it explicitly.

Note the slightly tricky call to verify_path() in
update-index's update_one(). There we may not have a mode if
we're not updating from the filesystem (e.g., we might just
be removing the file). Passing "0" as the mode there works
fine; since it's not a symlink, we'll just skip the extra
checks.

Signed-off-by: Jeff King <peff@peff.net>

update-index: stat updated files earlierJeff King Mon, 14 May 2018 15:00:56 +0000 (11:00 -0400)

update-index: stat updated files earlier

In the update_one(), we check verify_path() on the proposed
path before doing anything else. In preparation for having
verify_path() look at the file mode, let's stat the file
earlier, so we can check the mode accurately.

This is made a bit trickier by the fact that this function
only does an lstat in a few code paths (the ones that flow
down through process_path()). So we can speculatively do the
lstat() here and pass the results down, and just use a dummy
mode for cases where we won't actually be updating the index
from the filesystem.

Signed-off-by: Jeff King <peff@peff.net>

verify_dotfile: mention case-insensitivity in commentJeff King Tue, 15 May 2018 13:56:50 +0000 (09:56 -0400)

verify_dotfile: mention case-insensitivity in comment

We're more restrictive than we need to be in matching ".GIT"
on case-sensitive filesystems; let's make a note that this
is intentional.

Signed-off-by: Jeff King <peff@peff.net>

verify_path: drop clever fallthroughJeff King Sun, 13 May 2018 17:00:23 +0000 (13:00 -0400)

verify_path: drop clever fallthrough

We check ".git" and ".." in the same switch statement, and
fall through the cases to share the end-of-component check.
While this saves us a line or two, it makes modifying the
function much harder. Let's just write it out.

Signed-off-by: Jeff King <peff@peff.net>

skip_prefix: add case-insensitive variantJeff King Sun, 13 May 2018 16:57:14 +0000 (12:57 -0400)

skip_prefix: add case-insensitive variant

We have the convenient skip_prefix() helper, but if you want
to do case-insensitive matching, you're stuck doing it by
hand. We could add an extra parameter to the function to
let callers ask for this, but the function is small and
somewhat performance-critical. Let's just re-implement it
for the case-insensitive version.

Signed-off-by: Jeff King <peff@peff.net>

is_{hfs,ntfs}_dotgitmodules: add testsJohannes Schindelin Sat, 12 May 2018 20:16:51 +0000 (22:16 +0200)

is_{hfs,ntfs}_dotgitmodules: add tests

This tests primarily for NTFS issues, but also adds one example of an
HFS+ issue.

Thanks go to Congyi Wu for coming up with the list of examples where
NTFS would possibly equate the filename with `.gitmodules`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Jeff King <peff@peff.net>

is_ntfs_dotgit: match other .git filesJohannes Schindelin Fri, 11 May 2018 14:03:54 +0000 (16:03 +0200)

is_ntfs_dotgit: match other .git files

When we started to catch NTFS short names that clash with .git, we only
looked for GIT~1. This is sufficient because we only ever clone into an
empty directory, so .git is guaranteed to be the first subdirectory or
file in that directory.

However, even with a fresh clone, .gitmodules is *not* necessarily the
first file to be written that would want the NTFS short name GITMOD~1: a
malicious repository can add .gitmodul0000 and friends, which sorts
before `.gitmodules` and is therefore checked out *first*. For that
reason, we have to test not only for ~1 short names, but for others,
too.

It's hard to just adapt the existing checks in is_ntfs_dotgit(): since
Windows 2000 (i.e., in all Windows versions still supported by Git),
NTFS short names are only generated in the <prefix>~<number> form up to
number 4. After that, a *different* prefix is used, calculated from the
long file name using an undocumented, but stable algorithm.

For example, the short name of .gitmodules would be GITMOD~1, but if it
is taken, and all of ~2, ~3 and ~4 are taken, too, the short name
GI7EBA~1 will be used. From there, collisions are handled by
incrementing the number, shortening the prefix as needed (until ~9999999
is reached, in which case NTFS will not allow the file to be created).

We'd also want to handle .gitignore and .gitattributes, which suffer
from a similar problem, using the fall-back short names GI250A~1 and
GI7D29~1, respectively.

To accommodate for that, we could reimplement the hashing algorithm, but
it is just safer and simpler to provide the known prefixes. This
algorithm has been reverse-engineered and described at
https://usn.pw/blog/gen/2015/06/09/filenames/, which is defunct but
still available via https://web.archive.org/.

These can be recomputed by running the following Perl script:

-- snip --
use warnings;
use strict;

sub compute_short_name_hash ($) {
my $checksum = 0;
foreach (split('', $_[0])) {
$checksum = ($checksum * 0x25 + ord($_)) & 0xffff;
}

$checksum = ($checksum * 314159269) & 0xffffffff;
$checksum = 1 + (~$checksum & 0x7fffffff) if ($checksum & 0x80000000);
$checksum -= (($checksum * 1152921497) >> 60) * 1000000007;

return scalar reverse sprintf("%x", $checksum & 0xffff);
}

print compute_short_name_hash($ARGV[0]);
-- snap --

E.g., running that with the argument ".gitignore" will
result in "250a" (which then becomes "gi250a" in the code).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Jeff King <peff@peff.net>

is_hfs_dotgit: match other .git filesJeff King Wed, 2 May 2018 19:23:45 +0000 (15:23 -0400)

is_hfs_dotgit: match other .git files

Both verify_path() and fsck match ".git", ".GIT", and other
variants specific to HFS+. Let's allow matching other
special files like ".gitmodules", which we'll later use to
enforce extra restrictions via verify_path() and fsck.

Signed-off-by: Jeff King <peff@peff.net>

is_ntfs_dotgit: use a size_t for traversing stringJeff King Sun, 13 May 2018 16:09:42 +0000 (12:09 -0400)

is_ntfs_dotgit: use a size_t for traversing string

We walk through the "name" string using an int, which can
wrap to a negative value and cause us to read random memory
before our array (e.g., by creating a tree with a name >2GB,
since "int" is still 32 bits even on most 64-bit platforms).
Worse, this is easy to trigger during the fsck_tree() check,
which is supposed to be protecting us from malicious
garbage.

Note one bit of trickiness in the existing code: we
sometimes assign -1 to "len" at the end of the loop, and
then rely on the "len++" in the for-loop's increment to take
it back to 0. This is still legal with a size_t, since
assigning -1 will turn into SIZE_MAX, which then wraps
around to 0 on increment.

Signed-off-by: Jeff King <peff@peff.net>

submodule-config: verify submodule names as pathsJeff King Mon, 30 Apr 2018 07:25:25 +0000 (03:25 -0400)

submodule-config: verify submodule names as paths

Submodule "names" come from the untrusted .gitmodules file,
but we blindly append them to $GIT_DIR/modules to create our
on-disk repo paths. This means you can do bad things by
putting "../" into the name (among other things).

Let's sanity-check these names to avoid building a path that
can be exploited. There are two main decisions:

1. What should the allowed syntax be?

It's tempting to reuse verify_path(), since submodule
names typically come from in-repo paths. But there are
two reasons not to:

a. It's technically more strict than what we need, as
we really care only about breaking out of the
$GIT_DIR/modules/ hierarchy. E.g., having a
submodule named "foo/.git" isn't actually
dangerous, and it's possible that somebody has
manually given such a funny name.

b. Since we'll eventually use this checking logic in
fsck to prevent downstream repositories, it should
be consistent across platforms. Because
verify_path() relies on is_dir_sep(), it wouldn't
block "foo\..\bar" on a non-Windows machine.

2. Where should we enforce it? These days most of the
.gitmodules reads go through submodule-config.c, so
I've put it there in the reading step. That should
cover all of the C code.

We also construct the name for "git submodule add"
inside the git-submodule.sh script. This is probably
not a big deal for security since the name is coming
from the user anyway, but it would be polite to remind
them if the name they pick is invalid (and we need to
expose the name-checker to the shell anyway for our
test scripts).

This patch issues a warning when reading .gitmodules
and just ignores the related config entry completely.
This will generally end up producing a sensible error,
as it works the same as a .gitmodules file which is
missing a submodule entry (so "submodule update" will
barf, but "git clone --recurse-submodules" will print
an error but not abort the clone.

There is one minor oddity, which is that we print the
warning once per malformed config key (since that's how
the config subsystem gives us the entries). So in the
new test, for example, the user would see three
warnings. That's OK, since the intent is that this case
should never come up outside of malicious repositories
(and then it might even benefit the user to see the
message multiple times).

Credit for finding this vulnerability and the proof of
concept from which the test script was adapted goes to
Etienne Stalmans.

Signed-off-by: Jeff King <peff@peff.net>

Prepare for 2.15.2Junio C Hamano Wed, 6 Dec 2017 17:10:35 +0000 (09:10 -0800)

Prepare for 2.15.2

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

Merge branch 'jc/merge-base-fork-point-doc' into maintJunio C Hamano Wed, 6 Dec 2017 17:09:05 +0000 (09:09 -0800)

Merge branch 'jc/merge-base-fork-point-doc' into maint

Clarify and enhance documentation for "merge-base --fork-point", as
it was clear what it computed but not why/what for.

* jc/merge-base-fork-point-doc:
merge-base --fork-point doc: clarify the example and failure modes

Merge branch 'tz/redirect-fix' into maintJunio C Hamano Wed, 6 Dec 2017 17:09:04 +0000 (09:09 -0800)

Merge branch 'tz/redirect-fix' into maint

A few scripts (both in production and tests) incorrectly redirected
their error output. These have been corrected.

* tz/redirect-fix:
rebase: fix stderr redirect in apply_autostash()
t/lib-gpg: fix gpgconf stderr redirect to /dev/null

Merge branch 'tz/notes-error-to-stderr' into maintJunio C Hamano Wed, 6 Dec 2017 17:09:04 +0000 (09:09 -0800)

Merge branch 'tz/notes-error-to-stderr' into maint

"git notes" sent its error message to its standard output stream,
which was corrected.

* tz/notes-error-to-stderr:
notes: send "Automatic notes merge failed" messages to stderr

Merge branch 'sb/test-cherry-pick-submodule-getting... Junio C Hamano Wed, 6 Dec 2017 17:09:03 +0000 (09:09 -0800)

Merge branch 'sb/test-cherry-pick-submodule-getting-in-a-way' into maint

The three-way merge performed by "git cherry-pick" was confused
when a new submodule was added in the meantime, which has been
fixed (or "papered over").

* sb/test-cherry-pick-submodule-getting-in-a-way:
merge-recursive: handle addition of submodule on our side of history
t/3512: demonstrate unrelated submodule/file conflict as cherry-pick failure

Merge branch 'pw/sequencer-recover-from-unlockable... Junio C Hamano Wed, 6 Dec 2017 17:09:03 +0000 (09:09 -0800)

Merge branch 'pw/sequencer-recover-from-unlockable-index' into maint

The sequencer machinery (used by "git cherry-pick A..B", and "git
rebase -i", among other things) would have lost a commit if stopped
due to an unlockable index file, which has been fixed.

* pw/sequencer-recover-from-unlockable-index:
sequencer: reschedule pick if index can't be locked

Merge branch 'rs/apply-inaccurate-eof-with-incomplete... Junio C Hamano Wed, 6 Dec 2017 17:09:03 +0000 (09:09 -0800)

Merge branch 'rs/apply-inaccurate-eof-with-incomplete-line' into maint

"git apply --inaccurate-eof" when used with "--ignore-space-change"
triggered an internal sanity check, which has been fixed.

* rs/apply-inaccurate-eof-with-incomplete-line:
apply: update line lengths for --inaccurate-eof

Merge branch 'tz/complete-branch-copy' into maintJunio C Hamano Wed, 6 Dec 2017 17:09:02 +0000 (09:09 -0800)

Merge branch 'tz/complete-branch-copy' into maint

Command line completion (in contrib/) has been taught about the
"--copy" option of "git branch".

* tz/complete-branch-copy:
completion: add '--copy' option to 'git branch'

Merge branch 'ew/rebase-mboxrd' into maintJunio C Hamano Wed, 6 Dec 2017 17:09:01 +0000 (09:09 -0800)

Merge branch 'ew/rebase-mboxrd' into maint

When "git rebase" prepared an mailbox of changes and fed it to "git
am" to replay them, it was confused when a stray "From " happened
to be in the log message of one of the replayed changes. This has
been corrected.

* ew/rebase-mboxrd:
rebase: use mboxrd format to avoid split errors

Merge branch 'sd/branch-copy' into maintJunio C Hamano Wed, 6 Dec 2017 17:09:01 +0000 (09:09 -0800)

Merge branch 'sd/branch-copy' into maint

Code clean-up.

* sd/branch-copy:
config: avoid "write_in_full(fd, buf, len) != len" pattern

Merge branch 'sw/pull-ipv46-passthru' into maintJunio C Hamano Wed, 6 Dec 2017 17:09:00 +0000 (09:09 -0800)

Merge branch 'sw/pull-ipv46-passthru' into maint

Contrary to the documentation, "git pull -4/-6 other-args" did not
ask the underlying "git fetch" to go over IPv4/IPv6, which has been
corrected.

* sw/pull-ipv46-passthru:
pull: pass -4/-6 option to 'git fetch'

Merge branch 'bc/submitting-patches-in-asciidoc' into... Junio C Hamano Wed, 6 Dec 2017 17:08:59 +0000 (09:08 -0800)

Merge branch 'bc/submitting-patches-in-asciidoc' into maint

The SubmittingPatches document has been converted to produce an
HTML version via AsciiDoc/Asciidoctor.

* bc/submitting-patches-in-asciidoc:
Documentation: convert SubmittingPatches to AsciiDoc
Documentation: enable compat-mode for Asciidoctor

Merge branch 'mh/avoid-rewriting-packed-refs' into... Junio C Hamano Wed, 6 Dec 2017 17:08:20 +0000 (09:08 -0800)

Merge branch 'mh/avoid-rewriting-packed-refs' into maint

Recent update to the refs infrastructure implementation started
rewriting packed-refs file more often than before; this has been
optimized again for most trivial cases.

* mh/avoid-rewriting-packed-refs:
files-backend: don't rewrite the `packed-refs` file unnecessarily
t1409: check that `packed-refs` is not rewritten unnecessarily

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

pull: pass -4/-6 option to 'git fetch'Shuyu Wei Sun, 19 Nov 2017 11:01:32 +0000 (19:01 +0800)

pull: pass -4/-6 option to 'git fetch'

The -4/-6 option should be passed through to 'git fetch' to be
consistent with the man page.

Signed-off-by: Wei Shuyu <wsy@dogben.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

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>

rebase: use mboxrd format to avoid split errorsEric Wong Sat, 18 Nov 2017 01:01:16 +0000 (01:01 +0000)

rebase: use mboxrd format to avoid split errors

The mboxrd format allows the use of embedded "From " lines in
commit messages without being misinterpreted by mailsplit

Reported-by: Florian Weimer <fweimer@redhat.com>
Signed-off-by: Eric Wong <e@80x24.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

apply: update line lengths for --inaccurate-eofRené Scharfe Thu, 16 Nov 2017 18:50:31 +0000 (19:50 +0100)

apply: update line lengths for --inaccurate-eof

Some diff implementations don't report missing newlines at the end of
files. Applying such a patch can cause a newline character to be
added inadvertently. The option --inaccurate-eof of git apply can be
used to remove trailing newlines if needed.

apply_one_fragment() cuts it off from the buffers for preimage and
postimage. Before it does, it builds an array with the lengths of each
line for both. Make sure to update the length of the last line in
these line info structures as well to keep them consistent with their
respective buffer.

Without this fix the added test fails; git apply dies and reports:

fatal: BUG: caller miscounted postlen: asked 1, orig = 1, used = 2

That sanity check is only called if whitespace changes are ignored.

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>

completion: add '--copy' option to 'git branch'Todd Zullinger Thu, 16 Nov 2017 17:09:06 +0000 (12:09 -0500)

completion: add '--copy' option to 'git branch'

In 52d59cc645 (branch: add a --copy (-c) option to go with --move (-m),
2017-06-18), `git branch` learned a `--copy` option. Include it when
providing command completions.

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

sequencer: reschedule pick if index can't be lockedPhillip Wood Wed, 15 Nov 2017 10:41:25 +0000 (10:41 +0000)

sequencer: reschedule pick if index can't be locked

If the index cannot be locked in do_recursive_merge(), issue an
error message and go on to the error recovery codepath, instead of
dying. When the commit cannot be picked, it needs to be rescheduled
when performing an interactive rebase, but just dying there won't
allow that to happen, and when the user runs 'git rebase --continue'
rather than 'git rebase --abort', the commit gets silently dropped.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>

config: avoid "write_in_full(fd, buf, len) != len"... Phillip Wood Wed, 15 Nov 2017 12:40:43 +0000 (12:40 +0000)

config: avoid "write_in_full(fd, buf, len) != len" pattern

As explained in commit 06f46f237 (avoid "write_in_full(fd, buf, len)
!= len" pattern, 2017–09–13) the return value of write_in_full() is
either -1 or the requested number of bytes. As such comparing the
return value to an unsigned value such as strbuf.len will fail to
catch errors. Change the code to use the preferred '< 0' check.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

merge-recursive: handle addition of submodule on our... Elijah Newren Tue, 14 Nov 2017 17:31:24 +0000 (09:31 -0800)

merge-recursive: handle addition of submodule on our side of history

The code for a newly added path assumed that the path was a normal file,
and thus checked for there being a directory still being in the way of
the file. Note that since unpack_trees() does path-in-the-way checks
already, the only way for there to be a directory in the way at this
point in the code, is if there is some kind of D/F conflict in the merge.

For a submodule addition on HEAD's side of history, the submodule would
have already been present. This means that we do expect there to be a
directory present but should not consider it to be "in the way"; instead,
it's the expected submodule. So, when there's a submodule addition from
HEAD's side, don't bother checking the working copy for a directory in
the way.

Signed-off-by: Elijah Newren <newren@gmail.com>
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

notes: send "Automatic notes merge failed" messages... Todd Zullinger Tue, 14 Nov 2017 16:17:52 +0000 (11:17 -0500)

notes: send "Automatic notes merge failed" messages to stderr

All other error messages from notes use stderr. Do the same when
alerting users of an unresolved notes merge.

Fix the output redirection in t3310 and t3320 as well. Previously, the
tests directed output to a file, but stderr was either not captured or
not sent to the file due to the order of the redirection operators.

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

rebase: fix stderr redirect in apply_autostash()Todd Zullinger Mon, 13 Nov 2017 21:20:09 +0000 (16:20 -0500)

rebase: fix stderr redirect in apply_autostash()

The intention is to ignore all output from the 'git stash apply' call.
Adjust the order of the redirection to ensure that both stdout and
stderr are redirected to /dev/null.

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

t/lib-gpg: fix gpgconf stderr redirect to /dev/nullTodd Zullinger Mon, 13 Nov 2017 21:07:45 +0000 (16:07 -0500)

t/lib-gpg: fix gpgconf stderr redirect to /dev/null

In 29ff1f8f74 (t: lib-gpg: flush gpg agent on startup, 2017-07-20), a
call to gpgconf was added to kill the gpg-agent. The intention was to
ignore all output from the call, but the order of the redirection needs
to be switched to ensure that both stdout and stderr are redirected to
/dev/null. Without this, gpgconf from gnupg-2.0 releases would output
'gpgconf: invalid option "--kill"' each time it was called.

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

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>

Documentation: convert SubmittingPatches to AsciiDocbrian m. carlson Sun, 12 Nov 2017 22:07:18 +0000 (22:07 +0000)

Documentation: convert SubmittingPatches to AsciiDoc

The SubmittingPatches document is often cited by outside parties as an
example of good practices to follow, including logical, independent
commits; patch sign-offs; and sending patches to a mailing list.
Currently, people who want to cite a particular section tend to either
refer to it by name and let the interested party search through the
document to find it, or link to a given line number on GitHub and hope
the file doesn't change.

Instead, convert the document to AsciiDoc. Build it as part of the
technical documentation, since it is likely of interest to the same
group of people. Provide stable links to the sections which outside
parties are likely to want to link to. Make some minor structural
changes to organize it so that it can be formatted sanely.

Since the makefile needs a .txt extension in order to build with the
rest of the documentation, simply copy the file. Ignore the temporary
file so it doesn't get checked in accidentally, and remove it as part of
the clean process. Do this instead of renaming the file so that people
who have already linked to the documentation (who we're trying to help)
don't find their links broken. Avoid symlinking since Windows will not
like that.

This allows us to render the document as part of the website for the
benefit of others who wish to link to it as well as providing a more
nicely formatted display for our community and potential contributors.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.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>

t/3512: demonstrate unrelated submodule/file conflict... Stefan Beller Sat, 11 Nov 2017 00:04:43 +0000 (16:04 -0800)

t/3512: demonstrate unrelated submodule/file conflict as cherry-pick failure

Signed-off-by: Stefan Beller <sbeller@google.com>
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>

merge-base --fork-point doc: clarify the example and... Junio C Hamano Thu, 9 Nov 2017 02:49:45 +0000 (11:49 +0900)

merge-base --fork-point doc: clarify the example and failure modes

The illustrated history used to explain the `--fork-point` mode
named three keypoint commits B3, B2 and B1 from the oldest to the
newest, which was hard to read. Relabel them to B0, B1, B2. Also
illustrate the history after the rebase using the `--fork-point`
facility was made.

The text already mentions use of reflog, but the description is not
clear what benefit we are trying to gain by using reflog. Clarify
that it is to find the commits that were known to be at the tip of
the remote-tracking branch. This in turn necessitates users to know
the ramifications of the underlying assumptions, namely, expiry of
reflog entries will make it impossible to determine which commits
were at the tip of the remote-tracking branches and we fail when in
doubt (instead of giving a random and incorrect result without even
warning). Another limitation is that it won't be useful if you did
not fork from the tip of a remote-tracking branch but from in the
middle.

Describe them.

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>