gitweb.git
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

t2020: test variations that matterJunio C Hamano Wed, 6 Dec 2017 16:10:07 +0000 (08:10 -0800)

t2020: test variations that matter

Because our test suite is not about validating the working of the
shell, it is pointless to test variations of how a literal string
'yes' is quoted when assigned to an environment variable.

Instead, test various ways to spell 'yes' (we use strcasecmp() so
uppercased and capitalized variant should work just like 'yes'
spelled in all lowercase) and make sure we take them as 'yes'. That
is more relevant in testing Git.

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

t4013: test new output from diff --abbrev --rawAnn T Ropea Sun, 3 Dec 2017 21:27:43 +0000 (22:27 +0100)

t4013: test new output from diff --abbrev --raw

Use newly-introduced finely-grained control to teach the diff-family to
honor the new environment GIT_PRINT_SHA1_ELLIPSIS and remove the
ellipses when it is not set.

Mentored-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Ann T Ropea <bedhanger@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

diff: diff_aligned_abbrev: remove ellipsis after abbrev... Ann T Ropea Sun, 3 Dec 2017 21:27:42 +0000 (22:27 +0100)

diff: diff_aligned_abbrev: remove ellipsis after abbreviated SHA-1 value

Neither Git nor the user are in need of this (visual) aid anymore, but
we must offer a transition period.

A follow-up patch (series) will rectify the situation by covering the
new output format as well as the backward compatible one.

Also, fix a typo: "abbbreviated" ---> "abbreviated".

Signed-off-by: Ann T Ropea <bedhanger@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t4013: prepare for upcoming "diff --raw --abbrev" outpu... Ann T Ropea Sun, 3 Dec 2017 21:27:41 +0000 (22:27 +0100)

t4013: prepare for upcoming "diff --raw --abbrev" output format change

Most of the t4013 tests go through a list of sample command lines,
and each of them is executed and its output compared with an
expected one stored in t4013/ directory. Allow these lines to begin
with a colon followed by magic word(s) so that test conditions can
easily be tweaked.

The expected use that will happen in later steps of this is to run
tests expecting the traditional output and run the same test without
the GIT_PRINT_SHA1_ELLIPSIS=yes environment exported for (perhaps
some of) them, which will have to expect different output. Since
all of the existing tests are meant to run with the environment,
use the magic word "noellipses" to cause the variable not to be set
and exported.

As this step does not add any new test with the magic word, all
tests still run with the environment variable, expecting the
traditional output, but it will change soon.

Based-on-patch-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Ann T Ropea <bedhanger@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

checkout: describe_detached_head: remove ellipsis after... Ann T Ropea Wed, 6 Dec 2017 00:20:42 +0000 (01:20 +0100)

checkout: describe_detached_head: remove ellipsis after committish

We do not want an ellipsis displayed following an (abbreviated) SHA-1
value.

The days when this was necessary to indicate the truncation to
lower-level Git commands and/or the user are bygone.

However, to ease the transition, the ellipsis will still be printed if
the user sets the environment variable GIT_PRINT_SHA1_ELLIPSIS to "yes".

Correct documentation with respect to what describe_detached_head prints
when GIT_PRINT_SHA1_ELLIPSIS is not set as indicated above.

Add tests for the old and new behaviour.

Signed-off-by: Ann T Ropea <bedhanger@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

hashmap: adjust documentation to reflect realityJohannes Schindelin Wed, 29 Nov 2017 23:51:41 +0000 (00:51 +0100)

hashmap: adjust documentation to reflect reality

The hashmap API is just complicated enough that even at least one
long-time Git contributor has to look up how to use it every time he
finds a new use case. When that happens, it is really useful if the
provided example code is correct...

While at it, "fix a memory leak", avoid statements before variable
declarations, fix a const -> no-const cast, several %l specifiers (which
want to be %ld), avoid using an undefined constant, call scanf()
correctly, use FLEX_ALLOC_STR() where appropriate, and adjust the style
here and there.

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

Documentation/git-clone: improve description for submod... Stefan Beller Tue, 5 Dec 2017 02:53:32 +0000 (18:53 -0800)

Documentation/git-clone: improve description for submodule recursing

There have been a few complaints on the mailing list that git-clone doesn't
respect the `submodule.recurse` setting, which every other command (that
potentially knows how to deal with submodules) respects. In case of clone
this is not beneficial to respect as the user may not want to obtain all
submodules (assuming a pathspec of '.').

Improve the documentation such that the pathspec is mentioned in the
synopsis to alleviate the confusion around the submodule recursion flag
in git-clone.

While at it clarify that the option can be given multiple times for complex
pathspecs.

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

t3404: add test case for abbreviated commandsLiam Beguin Tue, 5 Dec 2017 17:52:35 +0000 (12:52 -0500)

t3404: add test case for abbreviated commands

Make sure the todo list ends up using single-letter command
abbreviations when the rebase.abbreviateCommands is enabled.
This configuration option should not change anything else.

Signed-off-by: Liam Beguin <liambeguin@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase -i: learn to abbreviate command namesLiam Beguin Tue, 5 Dec 2017 17:52:34 +0000 (12:52 -0500)

rebase -i: learn to abbreviate command names

`git rebase -i` already know how to interpret single-letter command
names. Teach it to generate the todo list with these same abbreviated
names.

Based-on-patch-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Liam Beguin <liambeguin@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase -i -x: add exec commands via the rebase--helperLiam Beguin Tue, 5 Dec 2017 17:52:33 +0000 (12:52 -0500)

rebase -i -x: add exec commands via the rebase--helper

Recent work on `git-rebase--interactive` aims to convert shell code to
C. Even if this is most likely not a big performance enhancement, let's
convert it too since a coming change to abbreviate command names
requires it to be updated.

Signed-off-by: Liam Beguin <liambeguin@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase -i: update functions to use a flags parameterLiam Beguin Tue, 5 Dec 2017 17:52:32 +0000 (12:52 -0500)

rebase -i: update functions to use a flags parameter

Update functions used in the rebase--helper so that they take a generic
'flags' parameter instead of a growing list of options.

Signed-off-by: Liam Beguin <liambeguin@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase -i: replace reference to sha1 with oidLiam Beguin Tue, 5 Dec 2017 17:52:31 +0000 (12:52 -0500)

rebase -i: replace reference to sha1 with oid

Since we are trying to abstract the hash function name elsewhere in the
code base, lets use OID instead of SHA-1 in the rebase--helper too.

Signed-off-by: Liam Beguin <liambeguin@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase -i: refactor transform_todo_idsLiam Beguin Tue, 5 Dec 2017 17:52:30 +0000 (12:52 -0500)

rebase -i: refactor transform_todo_ids

The transform_todo_ids function is a little hard to read. Lets try
to make it easier by using more of the strbuf API. Also, since we'll
soon be adding command abbreviations, let's rename the function so
it's name reflects that change.

Signed-off-by: Liam Beguin <liambeguin@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rev-list: support --no-filter argumentJeff Hostetler Tue, 5 Dec 2017 16:50:14 +0000 (16:50 +0000)

rev-list: support --no-filter argument

Teach rev-list to support --no-filter to override a
previous --filter=<filter_spec> argument. This is
to be consistent with commands that use OPT_PARSE
macros.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

list-objects-filter-options: support --no-filterJeff Hostetler Tue, 5 Dec 2017 16:50:13 +0000 (16:50 +0000)

list-objects-filter-options: support --no-filter

Teach opt_parse_list_objects_filter() to take --no-filter
option and to free the contents of struct filter_options.
This command line argument will be automatically inherited
by commands using OPT_PARSE_LIST_OBJECTS_FILTER(); this
includes pack-objects.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

list-objects-filter-options: fix 'keword' typo in commentChristian Couder Tue, 5 Dec 2017 16:50:12 +0000 (16:50 +0000)

list-objects-filter-options: fix 'keword' typo in comment

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

pathspec: only match across submodule boundaries when... Brandon Williams Tue, 5 Dec 2017 00:07:34 +0000 (16:07 -0800)

pathspec: only match across submodule boundaries when requested

Commit 74ed43711fd (grep: enable recurse-submodules to work on <tree>
objects, 2016-12-16) taught 'tree_entry_interesting()' to be able to
match across submodule boundaries in the presence of wildcards. This is
done by performing literal matching up to the first wildcard and then
punting to the submodule itself to perform more accurate pattern
matching. Instead of introducing a new flag to request this behavior,
commit 74ed43711fd overloaded the already existing 'recursive' flag in
'struct pathspec' to request this behavior.

This leads to a bug where whenever any other caller has the 'recursive'
flag set as well as a pathspec with wildcards that all submodules will
be indicated as matches. One simple example of this is:

git init repo
cd repo

git init submodule
git -C submodule commit -m initial --allow-empty

touch "[bracket]"
git add "[bracket]"
git commit -m bracket
git add submodule
git commit -m submodule

git rev-list HEAD -- "[bracket]"

Fix this by introducing the new flag 'recurse_submodules' in 'struct
pathspec' and using this flag to determine if matches should be allowed
to cross submodule boundaries.

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

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'ls/no-double-utf8-author-name' of ..... Junio C Hamano Tue, 5 Dec 2017 17:20:12 +0000 (09:20 -0800)

Merge branch 'ls/no-double-utf8-author-name' of ../git-gui into ls/git-gui-no-double-utf8-author-name

* 'ls/no-double-utf8-author-name' of ../git-gui:
git-gui: prevent double UTF-8 conversion

git-gui: prevent double UTF-8 conversionŁukasz Stelmach Tue, 5 Dec 2017 14:23:26 +0000 (15:23 +0100)

git-gui: prevent double UTF-8 conversion

Convert author's name and e-mail address from the UTF-8 (or any other)
encoding in load_last_commit function the same way commit message is
converted.

Amending commits in git-gui without such conversion breaks UTF-8
strings. For example, "\305\201ukasz" (as written by git cat-file) becomes
"\303\205\302\201ukasz" in an amended commit.

Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

strbuf: remove unused stripspace function aliasElijah Newren Wed, 29 Nov 2017 01:45:59 +0000 (17:45 -0800)

strbuf: remove unused stripspace function alias

In commit 63af4a8446 ("strbuf: make stripspace() part of strbuf",
2015-10-16), stripspace() was moved to strbuf and renamed to
strbuf_stripspace(). A "temporary" alias was added for the old name until
all topic branches had time to switch over. They have had time, so remove
the old alias.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

progress: drop delay-threshold codeLars Schneider Mon, 4 Dec 2017 22:07:00 +0000 (17:07 -0500)

progress: drop delay-threshold code

Since 180a9f2268 (provide a facility for "delayed" progress
reporting, 2007-04-20), the progress code has allowed
callers to skip showing progress if they have reached a
percentage-threshold of the total work before the delay
period passes.

But since 8aade107dd (progress: simplify "delayed" progress
API, 2017-08-19), that parameter is not available to outside
callers (we always passed zero after that commit, though
that was corrected in the previous commit to "100%").

Let's drop the threshold code, which never triggers in
any meaningful way.

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

progress: set default delay threshold to 100%, not 0%Jeff King Mon, 4 Dec 2017 22:05:23 +0000 (17:05 -0500)

progress: set default delay threshold to 100%, not 0%

Commit 8aade107dd (progress: simplify "delayed" progress
API, 2017-08-19) dropped the parameter by which callers
could say "show my progress only if I haven't passed M%
progress after N seconds". The intent was to just show
nothing for 2 seconds, and then always progress after that.

But we flipped the logic in the wrapper: it sets M=0,
meaning that we'd almost _never_ show progress after 2
seconds, since we'd generally have made some progress. This
should have been 100%, not 0%.

We were fooled by existing calls like:

start_progress_delay("foo", 0, 0, 2);

which behaved this way. The trick is that the first "0"
there is "how many items total", and there zero means "we
don't know". And without knowing that, we cannot compute a
completed percent at all, and we ignored the threshold
parameter entirely! Modeling our wrapper after that broke
callers which pass a non-zero value for "total".

We can switch to the intended behavior by using "100" in the
wrapper call.

Reported-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sha1_file: use strbuf_add() instead of strbuf_addf()Derrick Stolee Mon, 4 Dec 2017 14:06:03 +0000 (09:06 -0500)

sha1_file: use strbuf_add() instead of strbuf_addf()

Replace use of strbuf_addf() with strbuf_add() when enumerating
loose objects in for_each_file_in_obj_subdir(). Since we already
check the length and hex-values of the string before consuming
the path, we can prevent extra computation by using the lower-
level method.

One consumer of for_each_file_in_obj_subdir() is the abbreviation
code. OID abbreviations use a cached list of loose objects (per
object subdirectory) to make repeated queries fast, but there is
significant cache load time when there are many loose objects.

Most repositories do not have many loose objects before repacking,
but in the GVFS case the repos can grow to have millions of loose
objects. Profiling 'git log' performance in GitForWindows on a
GVFS-enabled repo with ~2.5 million loose objects revealed 12% of
the CPU time was spent in strbuf_addf().

Add a new performance test to p4211-line-log.sh that is more
sensitive to this cache-loading. By limiting to 1000 commits, we
more closely resemble user wait time when reading history into a
pager.

For a copy of the Linux repo with two ~512 MB packfiles and ~572K
loose objects, running 'git log --oneline --parents --raw -1000'
had the following performance:

HEAD~1 HEAD
----------------------------------------
7.70(7.15+0.54) 7.44(7.09+0.29) -3.4%

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

refactor "dumb" terminal determinationLars Schneider Wed, 29 Nov 2017 14:37:51 +0000 (15:37 +0100)

refactor "dumb" terminal determination

Move the code to detect "dumb" terminals into a single location. This
avoids duplicating the terminal detection code yet again in a subsequent
commit.

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

rebase -i: set commit to null in exec commandsLiam Beguin Sun, 3 Dec 2017 22:17:15 +0000 (17:17 -0500)

rebase -i: set commit to null in exec commands

Make sure commit is set to NULL when parsing exec instructions
from the todo list. If not, we may try to access an uninitialized
address later while updating the todo list.

Signed-off-by: Liam Beguin <liambeguin@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation: use preferred name for the 'todo list... Liam Beguin Sun, 3 Dec 2017 22:17:14 +0000 (17:17 -0500)

Documentation: use preferred name for the 'todo list' script

Use "todo list" instead of "instruction list" or "todo-list" to
reduce further confusion regarding the name of this script.

Signed-off-by: Liam Beguin <liambeguin@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation: move rebase.* configs to new fileLiam Beguin Sun, 3 Dec 2017 22:17:13 +0000 (17:17 -0500)

Documentation: move rebase.* configs to new file

Move all rebase.* configuration variables to a separate file in order to
remove duplicates, and include it in config.txt and git-rebase.txt. The
new descriptions are mostly taken from config.txt as they are more
verbose.

Signed-off-by: Liam Beguin <liambeguin@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

print_sha1_ellipsis: introduce helperAnn T Ropea Sun, 3 Dec 2017 21:27:39 +0000 (22:27 +0100)

print_sha1_ellipsis: introduce helper

Introduce a helper print_sha1_ellipsis() that pays attention to the
GIT_PRINT_SHA1_ELLIPSIS environment variable, and prepare the tests to
unconditionally set it for the test pieces that will be broken once the code
stops showing the extra dots by default.

The removal of these dots is merely a plan at this step and has not happened
yet but soon will.

Document GIT_PRINT_SHA1_ELLIPSIS.

Signed-off-by: Ann T Ropea <bedhanger@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation: user-manual: limit usage of ellipsisAnn T Ropea Sun, 3 Dec 2017 21:27:38 +0000 (22:27 +0100)

Documentation: user-manual: limit usage of ellipsis

There is no need to use full 40-hex to identify the object names like
the examples hint at by omitting the tail part of an object name as if
that has to be spelled out but the example omits them only for brevity.
Give examples using abbreviated object names without ellipses just like
how people do in real life.

Signed-off-by: Ann T Ropea <bedhanger@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation: revisions: fix typo: "three dot" --... Ann T Ropea Sun, 3 Dec 2017 21:27:37 +0000 (22:27 +0100)

Documentation: revisions: fix typo: "three dot" ---> "three-dot" (in line with "two-dot").

Signed-off-by: Ann T Ropea <bedhanger@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

diffcore-rename: make diff-tree -l0 mean -l<large>Jonathan Tan Wed, 29 Nov 2017 20:11:54 +0000 (12:11 -0800)

diffcore-rename: make diff-tree -l0 mean -l<large>

In the documentation of diff-tree, it is stated that the -l option
"prevents rename/copy detection from running if the number of
rename/copy targets exceeds the specified number". The documentation
does not mention any special handling for the number 0, but the
implementation before commit 9f7e4bfa3b ("diff: remove silent clamp of
renameLimit", 2017-11-13) treated 0 as a special value indicating that
the rename limit is to be a very large number instead.

The commit 9f7e4bfa3b changed that behavior, treating 0 as 0. Revert
this behavior to what it was previously. This allows existing scripts
and tools that use "-l0" to continue working. The alternative (to have
"-l0" suppress rename detection) is probably much less useful, since
users can just refrain from specifying -M and/or -C to have the same
effect.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Sync with v2.15.1Junio C Hamano Tue, 28 Nov 2017 04:43:55 +0000 (13:43 +0900)

Sync with v2.15.1

RelNotes: the seventh batchJunio C Hamano Tue, 28 Nov 2017 04:43:32 +0000 (13:43 +0900)

RelNotes: the seventh batch

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

Merge branch 'rs/include-comments-before-the-function... Junio C Hamano Tue, 28 Nov 2017 04:41:50 +0000 (13:41 +0900)

Merge branch 'rs/include-comments-before-the-function-header'

"git grep -W", "git diff -W" and their friends learned a heuristic
to extend a pre-context beyond the line that matches the "function
pattern" (aka "diff.*.xfuncname") to include a comment block, if
exists, that immediately precedes it.

* rs/include-comments-before-the-function-header:
grep: show non-empty lines before functions with -W
grep: update boundary variable for pre-context
t7810: improve check of -W with user-defined function lines
xdiff: show non-empty lines before functions with -W
xdiff: factor out is_func_rec()
t4051: add test for comments preceding function lines

Merge branch 'ma/branch-list-paginate'Junio C Hamano Tue, 28 Nov 2017 04:41:49 +0000 (13:41 +0900)

Merge branch 'ma/branch-list-paginate'

"git branch --list" learned to show its output through the pager by
default when the output is going to a terminal, which is controlled
by the pager.branch configuration variable. This is similar to a
recent change to "git tag --list".

* ma/branch-list-paginate:
branch: change default of `pager.branch` to "on"
branch: respect `pager.branch` in list-mode only
t7006: add tests for how git branch paginates

Merge branch 'jc/branch-name-sanity'Junio C Hamano Tue, 28 Nov 2017 04:41:49 +0000 (13:41 +0900)

Merge branch 'jc/branch-name-sanity'

"git branch" and "git checkout -b" are now forbidden from creating
a branch whose name is "HEAD".

* jc/branch-name-sanity:
builtin/branch: remove redundant check for HEAD
branch: correctly reject refs/heads/{-dash,HEAD}
branch: split validate_new_branchname() into two
branch: streamline "attr_only" handling in validate_new_branchname()

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

repository: fix a sparse 'using integer as NULL pointer... Ramsay Jones Tue, 28 Nov 2017 03:01:19 +0000 (03:01 +0000)

repository: fix a sparse 'using integer as NULL pointer' warning

Commit 78a6766802 ("Integrate hash algorithm support with repo setup",
2017-11-12) added a 'const struct git_hash_algo *hash_algo' field to the
repository structure, without modifying the initializer of the 'the_repo'
variable. This does not actually introduce a bug, since the '0' initializer
for the 'ignore_env:1' bit-field is interpreted as a NULL pointer (hence
the warning), and the final field (now with no initializer) receives a
default '0'.

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Doc/checkout: checking out using @{-N} can lead to... Kaartic Sivaraam Mon, 27 Nov 2017 17:28:33 +0000 (22:58 +0530)

Doc/checkout: checking out using @{-N} can lead to detached state

@{-N} is a syntax for the N-th last "checkout" and not the N-th
last "branch". Therefore, in some cases using `git checkout @{-$N}`
DOES lead to a "detached HEAD" state. This can also be ensured by
the commit message of 75d6e552a (Documentation: @{-N} can refer to
a commit, 2014-01-19) which clearly specifies how @{-N} can be used
to refer not only to a branch but also to a commit.

Correct the misleading sentence which states that @{-N} doesn't
detach HEAD.

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

diff: support anchoring line(s)Jonathan Tan Mon, 27 Nov 2017 19:47:47 +0000 (11:47 -0800)

diff: support anchoring line(s)

Teach diff a new algorithm, one that attempts to prevent user-specified
lines from appearing as a deletion or addition in the end result. The
end user can use this by specifying "--anchored=<text>" one or more
times when using Git commands like "diff" and "show".

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-send-email: honor $PATH for sendmail binaryFlorian Klink Tue, 28 Nov 2017 00:49:04 +0000 (01:49 +0100)

git-send-email: honor $PATH for sendmail binary

This extends git-send-email to also consider sendmail binaries in $PATH
after checking the (fixed) list of /usr/sbin and /usr/lib, and before
falling back to localhost.

Signed-off-by: Florian Klink <flokli@flokli.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-status.txt: mention --no-optional-locksJeff King Mon, 27 Nov 2017 06:04:12 +0000 (01:04 -0500)

git-status.txt: mention --no-optional-locks

If you come to the documentation thinking "I do not want Git
to take any locks for my background processes", then you may
easily run across "--no-optional-locks" in git.txt.

But it's quite reasonable to hit a specific instance of the
problem: you have "git status" running in the background,
and you notice that it causes lock contention with other
processes. So you look in git-status.txt to see if there is
a way to disable it, but there's no mention of the flag.

Let's add a short note mentioning that status does indeed
touch the index (and why), with a pointer to the global
option. That can point users in the right direction and help
them make a more informed decision about what they're
disabling.

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

RelNotes: the sixth batch for 2.16Junio C Hamano Mon, 27 Nov 2017 02:16:50 +0000 (11:16 +0900)

RelNotes: the sixth batch for 2.16

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

Sync with maintJunio C Hamano Mon, 27 Nov 2017 02:15:09 +0000 (11:15 +0900)

Sync with maint

* maint:
A bit more fixes for 2.15.1
RelNotes: minor typo fixes in 2.15.1 draft

Merge branch 'sw/pull-ipv46-passthru'Junio C Hamano Mon, 27 Nov 2017 02:06:40 +0000 (11:06 +0900)

Merge branch 'sw/pull-ipv46-passthru'

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 'ks/rebase-no-git-foo'Junio C Hamano Mon, 27 Nov 2017 02:06:39 +0000 (11:06 +0900)

Merge branch 'ks/rebase-no-git-foo'

Mentions of "git-rebase" and "git-am" (dashed form) still remained
in end-user visible strings emitted by the "git rebase" command;
they have been corrected.

* ks/rebase-no-git-foo:
git-rebase: clean up dashed-usages in messages

Merge branch 'rs/config-write-section-fix'Junio C Hamano Mon, 27 Nov 2017 02:06:38 +0000 (11:06 +0900)

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

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

Merge branch 'ew/rebase-mboxrd'Junio C Hamano Mon, 27 Nov 2017 02:06:37 +0000 (11:06 +0900)

Merge branch 'ew/rebase-mboxrd'

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 'tb/add-renormalize'Junio C Hamano Mon, 27 Nov 2017 02:06:37 +0000 (11:06 +0900)

Merge branch 'tb/add-renormalize'

"git add --renormalize ." is a new and safer way to record the fact
that you are correcting the end-of-line convention and other
"convert_to_git()" glitches in the in-repository data.

* tb/add-renormalize:
add: introduce "--renormalize"

Merge branch 'tz/complete-branch-copy'Junio C Hamano Mon, 27 Nov 2017 02:06:37 +0000 (11:06 +0900)

Merge branch 'tz/complete-branch-copy'

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 'rs/apply-inaccurate-eof-with-incomplete... Junio C Hamano Mon, 27 Nov 2017 02:06:36 +0000 (11:06 +0900)

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

"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 'pw/sequencer-recover-from-unlockable... Junio C Hamano Mon, 27 Nov 2017 02:06:35 +0000 (11:06 +0900)

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

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 'sd/branch-copy'Junio C Hamano Mon, 27 Nov 2017 02:06:35 +0000 (11:06 +0900)

Merge branch 'sd/branch-copy'

Code clean-up.

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

Merge branch 'sb/test-cherry-pick-submodule-getting... Junio C Hamano Mon, 27 Nov 2017 02:06:34 +0000 (11:06 +0900)

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

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 'tz/notes-error-to-stderr'Junio C Hamano Mon, 27 Nov 2017 02:06:34 +0000 (11:06 +0900)

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

"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 'tz/redirect-fix'Junio C Hamano Mon, 27 Nov 2017 02:06:33 +0000 (11:06 +0900)

Merge branch 'tz/redirect-fix'

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 'rv/sendemail-tocmd-in-config-and-completion'Junio C Hamano Mon, 27 Nov 2017 02:06:32 +0000 (11:06 +0900)

Merge branch 'rv/sendemail-tocmd-in-config-and-completion'

Teach "sendemail.tocmd" to places that know about "sendemail.to",
like documentation and shell completion (in contrib/).

* rv/sendemail-tocmd-in-config-and-completion:
completion: add git config sendemail.tocmd
Documentation/config: add sendemail.tocmd to list preceding "See git-send-email(1)"

Merge branch 'jc/merge-base-fork-point-doc'Junio C Hamano Mon, 27 Nov 2017 02:06:32 +0000 (11:06 +0900)

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

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 'jc/ignore-cr-at-eol'Junio C Hamano Mon, 27 Nov 2017 02:06:31 +0000 (11:06 +0900)

Merge branch 'jc/ignore-cr-at-eol'

The "diff" family of commands learned to ignore differences in
carriage return at the end of line.

* jc/ignore-cr-at-eol:
diff: --ignore-cr-at-eol
xdiff: reassign xpparm_t.flags bits

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

t/README: document test_cmp_revThomas Gummerer Sun, 26 Nov 2017 20:21:00 +0000 (20:21 +0000)

t/README: document test_cmp_rev

test_cmp_rev is a useful function that's used in quite a few test
scripts. It is however not documented in t/README. Document it.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t/README: remove mention of adding copyright noticesThomas Gummerer Sun, 26 Nov 2017 20:20:59 +0000 (20:20 +0000)

t/README: remove mention of adding copyright notices

We generally no longer include copyright notices in new test scripts.
However t/README still mentions it as something to include at the top of
every new script.

Remove that mention as it's outdated.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

trace: remove trace key normalizationGennady Kupava Sun, 26 Nov 2017 20:11:18 +0000 (20:11 +0000)

trace: remove trace key normalization

Trace key normalization is not used, not strictly necessary,
complicates the code and would negatively affect compilation speed if
moved to header.

New trace_default_key key or existing separate marco could be used
instead of passing NULL as a key.

Signed-off-by: Gennady Kupava <gkupava@bloomberg.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

convert: tighten the safe autocrlf handlingTorsten Bögershausen Sun, 26 Nov 2017 12:20:52 +0000 (13:20 +0100)

convert: tighten the safe autocrlf handling

When a text file had been commited with CRLF and the file is commited
again, the CRLF are kept if .gitattributs has "text=auto".
This is done by analyzing the content of the blob stored in the index:
If a '\r' is found, Git assumes that the blob was commited with CRLF.

The simple search for a '\r' does not always work as expected:
A file is encoded in UTF-16 with CRLF and commited. Git treats it as binary.
Now the content is converted into UTF-8. At the next commit Git treats the
file as text, the CRLF should be converted into LF, but isn't.

Replace has_cr_in_index() with has_crlf_in_index(). When no '\r' is found,
0 is returned directly, this is the most common case.
If a '\r' is found, the content is analyzed more deeply.

Reported-By: Ashish Negi <ashishnegi33@gmail.com>
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

merge-recursive: ignore_case shouldn't reject intention... Elijah Newren Fri, 24 Nov 2017 19:59:01 +0000 (11:59 -0800)

merge-recursive: ignore_case shouldn't reject intentional removals

In commit ae352c7f3 (merge-recursive.c: fix case-changing merge bug,
2014-05-01), it was observed that removing files could be problematic on
case insensitive file systems, because we could end up removing files
that differed in case only rather than deleting the intended file --
something that happened when files were renamed on one branch in a way
that differed only in case. To avoid that problem, that commit added
logic to avoid removing files other than the one intended, rejecting the
removal if the files differed only in case.

Unfortunately, the logic it used didn't fully implement that condition as
stated above; instead it merely checked that a case-insensitive lookup of
the file that was requested resulted in finding a file in the index at
stage 0, not that the file found in the index actually differed in case.
Alternatively, one could view the implementation as making an implicit
assumption that the file we actually wanted to remove would never appear
in the index with a stage of 0, and thus that if we found a file with our
lookup, that it had to be a different file (but different in case only).

The net result of this implementation is that it can ignore more requests
than it should, leaving a file around in the working copy that should
have been removed. Make sure that the file found in the index actually
differs in case before silently ignoring the request to remove the file.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

worktree: make add <path> <branch> dwimThomas Gummerer Sun, 26 Nov 2017 19:43:54 +0000 (19:43 +0000)

worktree: make add <path> <branch> dwim

Currently 'git worktree add <path> <branch>', errors out when 'branch'
is not a local branch. It has no additional dwim'ing features that one
might expect.

Make it behave more like 'git checkout <branch>' when the branch doesn't
exist locally, but a remote tracking branch uniquely matches the desired
branch name, i.e. create a new branch from the remote tracking branch
and set the upstream to the remote tracking branch.

As 'git worktree add' currently just dies in this situation, there are
no backwards compatibility worries when introducing this feature.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

worktree: add --[no-]track option to the add subcommandThomas Gummerer Sun, 26 Nov 2017 19:43:53 +0000 (19:43 +0000)

worktree: add --[no-]track option to the add subcommand

Currently 'git worktree add' sets up tracking branches if '<branch>' is
a remote tracking branch, and doesn't set them up otherwise, as is the
default for 'git branch'.

This may or may not be what the user wants. Allow overriding this
behaviour with a --[no-]track flag that gets passed through to 'git
branch'.

We already respect branch.autoSetupMerge, as 'git worktree' just calls
'git branch' internally.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

worktree: add can be created from any commit-ishThomas Gummerer Sun, 26 Nov 2017 19:43:52 +0000 (19:43 +0000)

worktree: add can be created from any commit-ish

Currently 'git worktree add' is documented to take an optional <branch>
argument, which is checked out in the new worktree. However it is more
generally possible to use a commit-ish as the optional argument, and
check that out into the new worktree.

Document that this is a possibility, as new users of git worktree add
might find it helpful.

Reported-by: Randall S. Becker <rsbecker@nexbridge.com>
Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

checkout: factor out functions to new lib fileThomas Gummerer Sun, 26 Nov 2017 19:43:51 +0000 (19:43 +0000)

checkout: factor out functions to new lib file

Factor the functions out, so they can be re-used from other places. In
particular these functions will be re-used in builtin/worktree.c to make
git worktree add dwim more.

While there add some docs to the function.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

submodule--helper.c: i18n: add a missing space in messageJean-Noel Avila Sat, 25 Nov 2017 19:55:24 +0000 (20:55 +0100)

submodule--helper.c: i18n: add a missing space in message

The message spans over 2 lines but the C concatenation does not add
the needed space between the two lines.

Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

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>

doc: Mention info/attributes in gitrepository-layoutSteffen Prohaska Wed, 22 Nov 2017 08:58:14 +0000 (09:58 +0100)

doc: Mention info/attributes in gitrepository-layout

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

grep: fix segfault under -P + PCRE2 <=10.30 + (*NO_JIT)Ævar Arnfjörð Bjarmason Thu, 23 Nov 2017 14:16:58 +0000 (14:16 +0000)

grep: fix segfault under -P + PCRE2 <=10.30 + (*NO_JIT)

Fix a bug in the compilation of PCRE2 patterns under JIT (the most
common runtime configuration). Any pattern with a (*NO_JIT) verb would
segfault in any currently released PCRE2 version:

$ git grep -P '(*NO_JIT)hi.*there'
Segmentation fault

That this segfaulted was a bug in PCRE2 itself, after reporting it[1]
on pcre-dev it's been fixed in a yet-to-be-released version of
PCRE (presumably released first as 10.31). Now it'll die with:

$ git grep -P '(*NO_JIT)hi.*there'
fatal: pcre2_jit_match failed with error code -45: bad JIT option

But the cause of the bug is in our own code dating back to my
94da9193a6 ("grep: add support for PCRE v2", 2017-06-01).

As explained at more length in the comment being added here, it isn't
sufficient to just check pcre2_config() to see whether the JIT should
be used, pcre2_pattern_info() also has to be asked.

This is something I discovered myself when fiddling around with PCRE2
verbs in patterns passed to git. I don't expect that any user of git
has encountered this given the obscurity of passing PCRE2 verbs
through to the library, along with the relative obscurity of (*NO_JIT)
itself.

1. "How am I supposed to use PCRE2 JIT in the face of (*NO_JIT) ?"
(<CACBZZX5mMqDuWuFmi7sRBp3wH6CFyd-ghACukd=v0NN=rBMnJg@mail.gmail.com> &
https://lists.exim.org/lurker/thread/20171123.101502.7f0d38ca.en.html)
on the pcre-dev mailing list

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

test-lib: add LIBPCRE1 & LIBPCRE2 prerequisitesÆvar Arnfjörð Bjarmason Thu, 23 Nov 2017 14:16:57 +0000 (14:16 +0000)

test-lib: add LIBPCRE1 & LIBPCRE2 prerequisites

Add LIBPCRE1 and LIBPCRE2 prerequisites which are true when git is
compiled with USE_LIBPCRE1=YesPlease or USE_LIBPCRE2=YesPlease,
respectively.

The syntax of PCRE1 and PCRE2 isn't the same in all cases (see
pcresyntax(3) and pcre2syntax(3)). If test are added that test for
those they'll need to be guarded by these new prerequisites.

The subsequent patch will make use of LIBPCRE2, so LIBPCRE1 isn't
strictly needed for now, but let's add it for consistency and so that
checking for it doesn't have to be done with the less obvious "PCRE,
!LIBPCRE2", which while semantically the same is more confusing, and
would lead to bugs if PCRE v3 is ever released as the tests would mean
v1, not any non-v2 version.

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

stash: learn to parse -m/--message like commit doesPhil Hord Wed, 22 Nov 2017 21:20:30 +0000 (13:20 -0800)

stash: learn to parse -m/--message like commit does

`git stash push -m foo` uses "foo" as the message for the stash. But
`git stash push -m"foo"` does not parse successfully. Similarly
`git stash push --message="My stash message"` also fails. The stash
documentation doesn't suggest this syntax should work, but gitcli
does and my fingers have learned this pattern long ago for `commit`.

Teach `git stash` to parse -mFoo and --message=Foo the same as `git
commit` would do. Even though it's an internal function, add
similar support to create_stash() for consistency.

Signed-off-by: Phil Hord <phil.hord@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

hooks doc: clarify when receive-pack invokes its hooksJunio C Hamano Fri, 24 Nov 2017 02:10:58 +0000 (11:10 +0900)

hooks doc: clarify when receive-pack invokes its hooks

The text meant to say that receive-pack runs these hooks, and only
because receive-pack is not a command the end users use every day
(ever), as an explanation also meantioned that it is run in response
to 'git push', which is an end-user facing command readers hopefully
know about.

This unfortunately gave an incorrect impression that 'git push'
always result in the hook to run. If the refs push wanted to update
all already had the desired value, these hooks are not run.

Explicitly mention "... and updates reference(s)" as a precondition
to avoid this confusion.

Helped-by: Christoph Michelbach <michelbach94@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

completion: add --autostash and --no-autostash to pullAlbert Astals Cid Tue, 21 Nov 2017 14:39:28 +0000 (15:39 +0100)

completion: add --autostash and --no-autostash to pull

Ideally we should only autocomplete if pull has --rebase since
they only work with it but could not figure out how to do that
and the error message of doing git pull --autostash points out
that you need --rebase so i guess it's good enough

Signed-off-by: Albert Astals Cid <albert.astals.cid@kdab.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Git/Packet.pm: use 'if' instead of 'unless'Christian Couder Tue, 21 Nov 2017 16:09:39 +0000 (17:09 +0100)

Git/Packet.pm: use 'if' instead of 'unless'

The code is more understandable with 'if' instead of 'unless'.

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

Git/Packet: clarify that packet_required_key_val_read... Christian Couder Tue, 21 Nov 2017 16:09:38 +0000 (17:09 +0100)

Git/Packet: clarify that packet_required_key_val_read allows EOF

The function calls itself "required", but it does not die when it
sees an unexpected EOF.

Let's rename it to "packet_key_val_read()".

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

Merge branch 'jn/reproducible-build' of ../git-gui... Junio C Hamano Wed, 22 Nov 2017 05:57:52 +0000 (14:57 +0900)

Merge branch 'jn/reproducible-build' of ../git-gui into jn/reproducible-build

* 'jn/reproducible-build' of ../git-gui:
git-gui: sort entries in optimized tclIndex

generate-cmdlist: avoid non-deterministic outputJonathan Nieder Sat, 2 Jul 2016 00:32:00 +0000 (17:32 -0700)

generate-cmdlist: avoid non-deterministic output

Non-determinism makes it harder for build tools to discover when a
target needs to be rebuilt.

generate-cmdlist.sh stores the full path in a comment:

/* Automatically generated by /build/git-agojiD/git-2.15.0/generate-cmdlist.sh */

Use the file name alone instead.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pack-objects: add list-objects filteringJeff Hostetler Tue, 21 Nov 2017 20:58:52 +0000 (20:58 +0000)

pack-objects: add list-objects filtering

Teach pack-objects to use the filtering provided by the
traverse_commit_list_filtered() interface to omit unwanted
objects from the resulting packfile.

Filtering requires the use of the "--stdout" option.

Add t5317 test.

In the future, we will introduce a "partial clone" mechanism
wherein an object in a repo, obtained from a remote, may
reference a missing object that can be dynamically fetched from
that remote once needed. This "partial clone" mechanism will
have a way, sometimes slow, of determining if a missing link
is one of the links expected to be produced by this mechanism.

This patch introduces handling of missing objects to help
debugging and development of the "partial clone" mechanism,
and once the mechanism is implemented, for a power user to
perform operations that are missing-object aware without
incurring the cost of checking if a missing link is expected.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Reviewed-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rev-list: add list-objects filtering supportJeff Hostetler Tue, 21 Nov 2017 20:58:51 +0000 (20:58 +0000)

rev-list: add list-objects filtering support

Teach rev-list to use the filtering provided by the
traverse_commit_list_filtered() interface to omit
unwanted objects from the result.

Object filtering is only allowed when one of the "--objects*"
options are used.

When the "--filter-print-omitted" option is used, the omitted
objects are printed at the end. These are marked with a "~".
This option can be combined with "--quiet" to get a list of
just the omitted objects.

Add t6112 test.

In the future, we will introduce a "partial clone" mechanism
wherein an object in a repo, obtained from a remote, may
reference a missing object that can be dynamically fetched from
that remote once needed. This "partial clone" mechanism will
have a way, sometimes slow, of determining if a missing link
is one of the links expected to be produced by this mechanism.

This patch introduces handling of missing objects to help
debugging and development of the "partial clone" mechanism,
and once the mechanism is implemented, for a power user to
perform operations that are missing-object aware without
incurring the cost of checking if a missing link is expected.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Reviewed-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

list-objects: filter objects in traverse_commit_listJeff Hostetler Tue, 21 Nov 2017 20:58:50 +0000 (20:58 +0000)

list-objects: filter objects in traverse_commit_list

Create traverse_commit_list_filtered() and add filtering
interface to allow certain objects to be omitted from the
traversal.

Update traverse_commit_list() to be a wrapper for the above
with a null filter to minimize the number of callers that
needed to be changed.

Object filtering will be used in a future commit by rev-list
and pack-objects for partial clone and fetch to omit unwanted
objects from the result.

traverse_bitmap_commit_list() does not work with filtering.
If a packfile bitmap is present, it will not be used. It
should be possible to extend such support in the future (at
least to simple filters that do not require object pathnames),
but that is beyond the scope of this patch series.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Reviewed-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

oidset: add iterator methods to oidsetJeff Hostetler Tue, 21 Nov 2017 20:58:49 +0000 (20:58 +0000)

oidset: add iterator methods to oidset

Add the usual iterator methods to oidset.
Add oidset_remove().

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Reviewed-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

oidmap: add oidmap iterator methodsJeff Hostetler Tue, 21 Nov 2017 20:58:48 +0000 (20:58 +0000)

oidmap: add oidmap iterator methods

Add the usual map iterator functions to oidmap.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Reviewed-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

dir: allow exclusions from blob in addition to fileJeff Hostetler Tue, 21 Nov 2017 20:58:47 +0000 (20:58 +0000)

dir: allow exclusions from blob in addition to file

Refactor add_excludes() to separate the reading of the
exclude file into a buffer and the parsing of the buffer
into exclude_list items.

Add add_excludes_from_blob_to_list() to allow an exclude
file be specified with an OID without assuming a local
worktree or index exists.

Refactor read_skip_worktree_file_from_index() and add
do_read_blob() to eliminate duplication of preliminary
processing of blob contents.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Reviewed-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-gui: sort entries in optimized tclIndexAnders Kaseorg Wed, 16 Nov 2016 21:37:17 +0000 (16:37 -0500)

git-gui: sort entries in optimized tclIndex

auto_mkindex expands wildcards in directory order, which depends on
the underlying filesystem. To improve build reproducibility, sort the
list of *.tcl files in the Makefile.

The unoptimized loading case was previously fixed in gitgui-0.21.0~14
(git-gui: sort entries in tclIndex, 2015-01-26).

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

doc: prefer 'stash push' over 'stash save'Phil Hord Tue, 21 Nov 2017 23:05:23 +0000 (15:05 -0800)

doc: prefer 'stash push' over 'stash save'

Although `git stash save` was deprecated recently, some parts of the
documentation still refer to it instead of `push`.

Signed-off-by: Phil Hord <phil.hord@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Tests: clean up submodule recursive helpersJonathan Tan Tue, 21 Nov 2017 22:12:56 +0000 (14:12 -0800)

Tests: clean up submodule recursive helpers

This continues the work in commit d3b5a49 ("Tests: clean up and document
submodule helpers", 2017-11-08).

Factor out the commonalities from
test_submodule_switch_recursing_with_args() and
test_submodule_forced_switch_recursing_with_args() in
lib-submodule-update.sh, and document their usage. Some tests differ
slightly in their test assertions; I have used the superset of those
assertions in that case.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

log: add option to choose which refs to decorateRafael Ascensão Tue, 21 Nov 2017 21:33:41 +0000 (21:33 +0000)

log: add option to choose which refs to decorate

When `log --decorate` is used, git will decorate commits with all
available refs. While in most cases this may give the desired effect,
under some conditions it can lead to excessively verbose output.

Introduce two command line options, `--decorate-refs=<pattern>` and
`--decorate-refs-exclude=<pattern>` to allow the user to select which
refs are used in decoration.

When "--decorate-refs=<pattern>" is given, only the refs that match the
pattern are used in decoration. The refs that match the pattern when
"--decorate-refs-exclude=<pattern>" is given, are never used in
decoration.

These options follow the same convention for mixing negative and
positive patterns across the system, assuming that the inclusive default
is to match all refs available.

(1) if there is no positive pattern given, pretend as if an
inclusive default positive pattern was given;

(2) for each candidate, reject it if it matches no positive
pattern, or if it matches any one of the negative patterns.

The rules for what is considered a match are slightly different from the
rules used elsewhere.

Commands like `log --glob` assume a trailing '/*' when glob chars are
not present in the pattern. This makes it difficult to specify a single
ref. On the other hand, commands like `describe --match --all` allow
specifying exact refs, but do not have the convenience of allowing
"shorthand refs" like 'refs/heads' or 'heads' to refer to
'refs/heads/*'.

The commands introduced in this patch consider a match if:

(a) the pattern contains globs chars,
and regular pattern matching returns a match.

(b) the pattern does not contain glob chars,
and ref '<pattern>' exists, or if ref exists under '<pattern>/'

This allows both behaviours (allowing single refs and shorthand refs)
yet remaining compatible with existent commands.

Helped-by: Kevin Daudt <me@ikke.info>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Rafael Ascensão <rafa.almas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>