git
7 years agoMerge branch 'rv/grep-cleanup' into jch
Junio C Hamano [Fri, 23 Feb 2018 21:27:58 +0000 (13:27 -0800)] 
Merge branch 'rv/grep-cleanup' into jch

* rv/grep-cleanup:
  grep: simplify grep_oid and grep_file
  grep: move grep_source_init outside critical section

7 years agoMerge branch 'js/rebase-recreate-merge' into jch
Junio C Hamano [Fri, 23 Feb 2018 21:27:57 +0000 (13:27 -0800)] 
Merge branch 'js/rebase-recreate-merge' into jch

"git rebase" learned "--recreate-merges" to transplant the whole
topology of commit graph elsewhere.

Is this ready for 'next'?

* js/rebase-recreate-merge:
  rebase -i: introduce --recreate-merges=[no-]rebase-cousins
  pull: accept --rebase=recreate to recreate the branch topology
  sequencer: handle post-rewrite for merge commands
  sequencer: make refs generated by the `label` command worktree-local
  rebase: introduce the --recreate-merges option
  rebase-helper --make-script: introduce a flag to recreate merges
  sequencer: fast-forward merge commits, if possible
  sequencer: introduce the `merge` command
  sequencer: introduce new commands to reset the revision
  git-rebase--interactive: clarify arguments
  sequencer: make rearrange_squash() a bit more obvious
  sequencer: avoid using errno clobbered by rollback_lock_file()

7 years agoMerge branch 'jk/cached-commit-buffer' into jch
Junio C Hamano [Fri, 23 Feb 2018 21:27:57 +0000 (13:27 -0800)] 
Merge branch 'jk/cached-commit-buffer' into jch

Code clean-up.

* jk/cached-commit-buffer:
  revision: drop --show-all option
  commit: drop uses of get_cached_commit_buffer()

7 years agoMerge branch 'jk/test-helper-v-output-fix' into jch
Junio C Hamano [Fri, 23 Feb 2018 21:27:56 +0000 (13:27 -0800)] 
Merge branch 'jk/test-helper-v-output-fix' into jch

Test framework update.

* jk/test-helper-v-output-fix:
  t: send verbose test-helper output to fd 4

7 years agoMerge branch 'ms/non-ascii-ticks' into jch
Junio C Hamano [Fri, 23 Feb 2018 21:27:56 +0000 (13:27 -0800)] 
Merge branch 'ms/non-ascii-ticks' into jch

Doc markup fix.

* ms/non-ascii-ticks:
  Documentation/gitsubmodules.txt: avoid non-ASCII apostrophes

7 years agoMerge branch 'ld/p4-unshelve' into jch
Junio C Hamano [Fri, 23 Feb 2018 21:27:55 +0000 (13:27 -0800)] 
Merge branch 'ld/p4-unshelve' into jch

"git p4" learned to "unshelve" shelved commit from P4.

* ld/p4-unshelve:
  git-p4: add unshelve command

7 years agoMerge branch 'rs/strbuf-read-file-or-whine' into jch
Junio C Hamano [Fri, 23 Feb 2018 21:27:55 +0000 (13:27 -0800)] 
Merge branch 'rs/strbuf-read-file-or-whine' into jch

Code clean-up.

* rs/strbuf-read-file-or-whine:
  sequencer: factor out strbuf_read_file_or_whine()

7 years agoMerge branch 'ma/config-page-only-in-list-mode' into jch
Junio C Hamano [Fri, 23 Feb 2018 21:27:54 +0000 (13:27 -0800)] 
Merge branch 'ma/config-page-only-in-list-mode' into jch

In a way similar to how "git tag" learned to honor the pager
setting only in the list mode, "git config" learned to ignore the
pager setting when it is used for setting values (i.e. when the
purpose of the operation is not to "show").

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

7 years agoMerge branch 'ot/ref-filter-cleanup' into jch
Junio C Hamano [Fri, 23 Feb 2018 21:27:53 +0000 (13:27 -0800)] 
Merge branch 'ot/ref-filter-cleanup' into jch

* ot/ref-filter-cleanup:
  ref-filter: get rid of goto
  ref-filter: get rid of duplicate code

7 years agoMerge branch 'jc/allow-ff-merging-kept-tags' into jch
Junio C Hamano [Fri, 23 Feb 2018 21:27:53 +0000 (13:27 -0800)] 
Merge branch 'jc/allow-ff-merging-kept-tags' into jch

Since Git 1.7.9, "git merge" defaulted to --no-ff (i.e. even when
the side branch being merged is a descendant of the current commit,
create a merge commit instead of fast-forwarding) when merging a
tag object.  This was appropriate default for integrators who pull
signed tags from their downstream contributors, but caused an
unnecessary merges when used by downstream contributors who
habitually "catch up" their topic branches with tagged releases
from the upstream.  Update "git merge" to default to --no-ff only
when merging a tag object that does *not* sit at its usual place in
refs/tags/ hierarchy, and allow fast-forwarding otherwise, to
mitigate the problem.

* jc/allow-ff-merging-kept-tags:
  merge: allow fast-forward when merging a tracked tag

7 years agoMerge branch 'ab/simplify-perl-makefile' into jch
Junio C Hamano [Fri, 23 Feb 2018 21:27:52 +0000 (13:27 -0800)] 
Merge branch 'ab/simplify-perl-makefile' into jch

Hotfix for a topic already in 'master'.

* ab/simplify-perl-makefile:
  Makefile: generate Git(3pm) as dependency of the 'doc' and 'man' targets

7 years agoMerge branch 'ab/perl-fixes' into jch
Junio C Hamano [Fri, 23 Feb 2018 21:27:52 +0000 (13:27 -0800)] 
Merge branch 'ab/perl-fixes' into jch

Only the first few of a series of several small patches.

* ab/perl-fixes:
  perl: move CPAN loader wrappers to another namespace
  perl: *.pm files should not have the executable bit

7 years agoMerge branch 'sg/t6300-modernize' into jch
Junio C Hamano [Fri, 23 Feb 2018 21:27:51 +0000 (13:27 -0800)] 
Merge branch 'sg/t6300-modernize' into jch

Test update.

* sg/t6300-modernize:
  t6300-for-each-ref: fix "more than one quoting style" tests

7 years agoMerge branch 'sb/color-h-cleanup' into jch
Junio C Hamano [Fri, 23 Feb 2018 21:27:51 +0000 (13:27 -0800)] 
Merge branch 'sb/color-h-cleanup' into jch

Devdoc update.

* sb/color-h-cleanup:
  color.h: document and modernize header

7 years agogrep: simplify grep_oid and grep_file
Rasmus Villemoes [Fri, 23 Feb 2018 14:47:57 +0000 (15:47 +0100)] 
grep: simplify grep_oid and grep_file

In the NO_PTHREADS or !num_threads case, this doesn't change
anything. In the threaded case, note that grep_source_init duplicates
its third argument, so there is no need to keep [path]buf.buf alive
across the call of add_work().

Signed-off-by: Rasmus Villemoes <rv@rasmusvillemoes.dk>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agogrep: move grep_source_init outside critical section
Rasmus Villemoes [Fri, 23 Feb 2018 14:47:56 +0000 (15:47 +0100)] 
grep: move grep_source_init outside critical section

grep_source_init typically does three strdup()s, and in the threaded
case, the call from add_work() happens while holding grep_mutex.

We can thus reduce the time we hold grep_mutex by moving the
grep_source_init() call out of add_work(), and simply have add_work()
copy the initialized structure to the available slot in the todo
array.

This also simplifies the prototype of add_work(), since it no longer
needs to duplicate all the parameters of grep_source_init(). In the
callers of add_work(), we get to reduce the amount of code duplicated in
the threaded and non-threaded cases slightly (avoiding repeating the
long "GREP_SOURCE_OID, pathbuf.buf, path, oid" argument list); a
subsequent cleanup patch will make that even more so.

Signed-off-by: Rasmus Villemoes <rv@rasmusvillemoes.dk>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agorebase -i: introduce --recreate-merges=[no-]rebase-cousins
Johannes Schindelin [Fri, 23 Feb 2018 12:39:54 +0000 (13:39 +0100)] 
rebase -i: introduce --recreate-merges=[no-]rebase-cousins

This one is a bit tricky to explain, so let's try with a diagram:

        C
      /   \
A - B - E - F
  \   /
    D

To illustrate what this new mode is all about, let's consider what
happens upon `git rebase -i --recreate-merges B`, in particular to
the commit `D`. So far, the new branch structure would be:

       --- C' --
      /         \
A - B ------ E' - F'
      \    /
        D'

This is not really preserving the branch topology from before! The
reason is that the commit `D` does not have `B` as ancestor, and
therefore it gets rebased onto `B`.

This is unintuitive behavior. Even worse, when recreating branch
structure, most use cases would appear to want cousins *not* to be
rebased onto the new base commit. For example, Git for Windows (the
heaviest user of the Git garden shears, which served as the blueprint
for --recreate-merges) frequently merges branches from `next` early, and
these branches certainly do *not* want to be rebased. In the example
above, the desired outcome would look like this:

       --- C' --
      /         \
A - B ------ E' - F'
  \        /
   -- D' --

Let's introduce the term "cousins" for such commits ("D" in the
example), and let's not rebase them by default, introducing the new
"rebase-cousins" mode for use cases where they should be rebased.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agopull: accept --rebase=recreate to recreate the branch topology
Johannes Schindelin [Fri, 23 Feb 2018 12:39:26 +0000 (13:39 +0100)] 
pull: accept --rebase=recreate to recreate the branch topology

Similar to the `preserve` mode simply passing the `--preserve-merges`
option to the `rebase` command, the `recreate` mode simply passes the
`--recreate-merges` option.

This will allow users to conveniently rebase non-trivial commit
topologies when pulling new commits, without flattening them.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agosequencer: handle post-rewrite for merge commands
Johannes Schindelin [Fri, 23 Feb 2018 12:39:07 +0000 (13:39 +0100)] 
sequencer: handle post-rewrite for merge commands

In the previous patches, we implemented the basic functionality of the
`git rebase -i --recreate-merges` command, in particular the `merge`
command to create merge commits in the sequencer.

The interactive rebase is a lot more these days, though, than a simple
cherry-pick in a loop. For example, it calls the post-rewrite hook (if
any) after rebasing with a mapping of the old->new commits.

This patch implements the post-rewrite handling for the `merge` command
we just introduced. The other commands that were added recently (`label`
and `reset`) do not create new commits, therefore post-rewrite do not
need to handle them.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agosequencer: make refs generated by the `label` command worktree-local
Johannes Schindelin [Fri, 23 Feb 2018 12:38:44 +0000 (13:38 +0100)] 
sequencer: make refs generated by the `label` command worktree-local

This allows for rebases to be run in parallel in separate worktrees
(think: interrupted in the middle of one rebase, being asked to perform
a different rebase, adding a separate worktree just for that job).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agorebase: introduce the --recreate-merges option
Johannes Schindelin [Fri, 23 Feb 2018 12:38:24 +0000 (13:38 +0100)] 
rebase: introduce the --recreate-merges option

Once upon a time, this here developer thought: wouldn't it be nice if,
say, Git for Windows' patches on top of core Git could be represented as
a thicket of branches, and be rebased on top of core Git in order to
maintain a cherry-pick'able set of patch series?

The original attempt to answer this was: git rebase --preserve-merges.

However, that experiment was never intended as an interactive option,
and it only piggy-backed on git rebase --interactive because that
command's implementation looked already very, very familiar: it was
designed by the same person who designed --preserve-merges: yours truly.

Some time later, some other developer (I am looking at you, Andreas!
;-)) decided that it would be a good idea to allow --preserve-merges to
be combined with --interactive (with caveats!) and the Git maintainer
(well, the interim Git maintainer during Junio's absence, that is)
agreed, and that is when the glamor of the --preserve-merges design
started to fall apart rather quickly and unglamorously.

The reason? In --preserve-merges mode, the parents of a merge commit (or
for that matter, of *any* commit) were not stated explicitly, but were
*implied* by the commit name passed to the `pick` command.

This made it impossible, for example, to reorder commits. Not to mention
to flatten the branch topology or, deity forbid, to split topic branches
into two.

Alas, these shortcomings also prevented that mode (whose original
purpose was to serve Git for Windows' needs, with the additional hope
that it may be useful to others, too) from serving Git for Windows'
needs.

Five years later, when it became really untenable to have one unwieldy,
big hodge-podge patch series of partly related, partly unrelated patches
in Git for Windows that was rebased onto core Git's tags from time to
time (earning the undeserved wrath of the developer of the ill-fated
git-remote-hg series that first obsoleted Git for Windows' competing
approach, only to be abandoned without maintainer later) was really
untenable, the "Git garden shears" were born [*1*/*2*]: a script,
piggy-backing on top of the interactive rebase, that would first
determine the branch topology of the patches to be rebased, create a
pseudo todo list for further editing, transform the result into a real
todo list (making heavy use of the `exec` command to "implement" the
missing todo list commands) and finally recreate the patch series on
top of the new base commit.

That was in 2013. And it took about three weeks to come up with the
design and implement it as an out-of-tree script. Needless to say, the
implementation needed quite a few years to stabilize, all the while the
design itself proved itself sound.

With this patch, the goodness of the Git garden shears comes to `git
rebase -i` itself. Passing the `--recreate-merges` option will generate
a todo list that can be understood readily, and where it is obvious
how to reorder commits. New branches can be introduced by inserting
`label` commands and calling `merge <label>`. And once this mode will
have become stable and universally accepted, we can deprecate the design
mistake that was `--preserve-merges`.

Link *1*:
https://github.com/msysgit/msysgit/blob/master/share/msysGit/shears.sh
Link *2*:
https://github.com/git-for-windows/build-extra/blob/master/shears.sh

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agorebase-helper --make-script: introduce a flag to recreate merges
Johannes Schindelin [Fri, 23 Feb 2018 12:38:01 +0000 (13:38 +0100)] 
rebase-helper --make-script: introduce a flag to recreate merges

The sequencer just learned new commands intended to recreate branch
structure (similar in spirit to --preserve-merges, but with a
substantially less-broken design).

Let's allow the rebase--helper to generate todo lists making use of
these commands, triggered by the new --recreate-merges option. For a
commit topology like this (where the HEAD points to C):

- A - B - C
    \   /
      D

the generated todo list would look like this:

# branch D
pick 0123 A
label branch-point
pick 1234 D
label D

reset branch-point
pick 2345 B
merge -C 3456 D # C

To keep things simple, we first only implement support for merge commits
with exactly two parents, leaving support for octopus merges to a later
patch in this patch series.

As a special, hard-coded label, all merge-recreating todo lists start with
the command `label onto` so that we can later always refer to the revision
onto which everything is rebased.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agosequencer: fast-forward merge commits, if possible
Johannes Schindelin [Fri, 23 Feb 2018 12:37:42 +0000 (13:37 +0100)] 
sequencer: fast-forward merge commits, if possible

Just like with regular `pick` commands, if we are trying to recreate a
merge commit, we now test whether the parents of said commit match HEAD
and the commits to be merged, and fast-forward if possible.

This is not only faster, but also avoids unnecessary proliferation of
new objects.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agosequencer: introduce the `merge` command
Johannes Schindelin [Fri, 23 Feb 2018 12:37:22 +0000 (13:37 +0100)] 
sequencer: introduce the `merge` command

This patch is part of the effort to reimplement `--preserve-merges` with
a substantially improved design, a design that has been developed in the
Git for Windows project to maintain the dozens of Windows-specific patch
series on top of upstream Git.

The previous patch implemented the `label` and `reset` commands to label
commits and to reset to labeled commits. This patch adds the `merge`
command, with the following syntax:

merge [-C <commit>] <rev> # <oneline>

The <commit> parameter in this instance is the *original* merge commit,
whose author and message will be used for the merge commit that is about
to be created.

The <rev> parameter refers to the (possibly rewritten) revision to
merge. Let's see an example of a todo list:

label onto

# Branch abc
reset onto
pick deadbeef Hello, world!
label abc

reset onto
pick cafecafe And now for something completely different
merge -C baaabaaa abc # Merge the branch 'abc' into master

To edit the merge commit's message (a "reword" for merges, if you will),
use `-c` (lower-case) instead of `-C`; this convention was borrowed from
`git commit` that also supports `-c` and `-C` with similar meanings.

To create *new* merges, i.e. without copying the commit message from an
existing commit, simply omit the `-C <commit>` parameter (which will
open an editor for the merge message):

merge abc

This comes in handy when splitting a branch into two or more branches.

Note: this patch only adds support for recursive merges, to keep things
simple. Support for octopus merges will be added later in a separate
patch series, support for merges using strategies other than the
recursive merge is left for the future.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agosequencer: introduce new commands to reset the revision
Johannes Schindelin [Fri, 23 Feb 2018 12:37:01 +0000 (13:37 +0100)] 
sequencer: introduce new commands to reset the revision

In the upcoming commits, we will teach the sequencer to recreate merges.
This will be done in a very different way from the unfortunate design of
`git rebase --preserve-merges` (which does not allow for reordering
commits, or changing the branch topology).

The main idea is to introduce new todo list commands, to support
labeling the current revision with a given name, resetting the current
revision to a previous state, and  merging labeled revisions.

This idea was developed in Git for Windows' Git garden shears (that are
used to maintain the "thicket of branches" on top of upstream Git), and
this patch is part of the effort to make it available to a wider
audience, as well as to make the entire process more robust (by
implementing it in a safe and portable language rather than a Unix shell
script).

This commit implements the commands to label, and to reset to, given
revisions. The syntax is:

label <name>
reset <name>

Internally, the `label <name>` command creates the ref
`refs/rewritten/<name>`. This makes it possible to work with the labeled
revisions interactively, or in a scripted fashion (e.g. via the todo
list command `exec`).

These temporary refs are removed upon sequencer_remove_state(), so that
even a `git rebase --abort` cleans them up.

We disallow '#' as label because that character will be used as separator
in the upcoming `merge` command.

Later in this patch series, we will mark the `refs/rewritten/` refs as
worktree-local, to allow for interactive rebases to be run in parallel in
worktrees linked to the same repository.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMerge branch 'ab/fetch-prune' into jch
Junio C Hamano [Thu, 22 Feb 2018 21:04:47 +0000 (13:04 -0800)] 
Merge branch 'ab/fetch-prune' into jch

Clarify how configured fetch refspecs interact with the "--prune"
option of "git fetch", and also add a handy short-hand for getting
rid of stale tags that are locally held.

* ab/fetch-prune:
  fetch: make the --prune-tags work with <url>
  fetch: add a --prune-tags option and fetch.pruneTags config
  fetch tests: add scaffolding for the new fetch.pruneTags
  git-fetch & config doc: link to the new PRUNING section
  git remote doc: correct dangerous lies about what prune does
  git fetch doc: add a new section to explain the ins & outs of pruning
  fetch tests: fetch <url> <spec> as well as fetch [<remote>]
  fetch tests: expand case/esac for later change
  fetch tests: double quote a variable for interpolation
  fetch tests: test --prune and refspec interaction
  fetch tests: add a tag to be deleted to the pruning tests
  fetch tests: re-arrange arguments for future readability
  fetch tests: refactor in preparation for testing tag pruning
  remote: add a macro for "refs/tags/*:refs/tags/*"
  fetch: stop accessing "remote" variable indirectly
  fetch: trivially refactor assignment to ref_nr
  fetch: don't redundantly NULL something calloc() gave us

7 years agoMerge branch 'sm/mv-dry-run-update' into jch
Junio C Hamano [Thu, 22 Feb 2018 21:04:46 +0000 (13:04 -0800)] 
Merge branch 'sm/mv-dry-run-update' into jch

Code clean-up.

* sm/mv-dry-run-update:
  mv: remove unneeded 'if (!show_only)'
  t7001: add test case for --dry-run

7 years agoMerge branch 'nd/parseopt-completion' into jch
Junio C Hamano [Thu, 22 Feb 2018 21:04:45 +0000 (13:04 -0800)] 
Merge branch 'nd/parseopt-completion' into jch

Teach parse-options API an option to help the completion script,
and make use of the mechanism in command line completion.

* nd/parseopt-completion: (41 commits)
  completion: use __gitcomp_builtin in _git_worktree
  completion: use __gitcomp_builtin in _git_tag
  completion: use __gitcomp_builtin in _git_status
  completion: use __gitcomp_builtin in _git_show_branch
  completion: use __gitcomp_builtin in _git_rm
  completion: use __gitcomp_builtin in _git_revert
  completion: use __gitcomp_builtin in _git_reset
  completion: use __gitcomp_builtin in _git_replace
  remote: force completing --mirror= instead of --mirror
  completion: use __gitcomp_builtin in _git_remote
  completion: use __gitcomp_builtin in _git_push
  completion: use __gitcomp_builtin in _git_pull
  completion: use __gitcomp_builtin in _git_notes
  completion: use __gitcomp_builtin in _git_name_rev
  completion: use __gitcomp_builtin in _git_mv
  completion: use __gitcomp_builtin in _git_merge_base
  completion: use __gitcomp_builtin in _git_merge
  completion: use __gitcomp_builtin in _git_ls_remote
  completion: use __gitcomp_builtin in _git_ls_files
  completion: use __gitcomp_builtin in _git_init
  ...

7 years agoMerge branch 'nm/tag-edit' into jch
Junio C Hamano [Thu, 22 Feb 2018 21:04:45 +0000 (13:04 -0800)] 
Merge branch 'nm/tag-edit' into jch

"git tag" learned an explicit "--edit" option that allows the
message given via "-m" and "-F" to be further edited.

* nm/tag-edit:
  tag: add --edit option

7 years agoMerge branch 'bp/untracked-cache-noflush' into jch
Junio C Hamano [Thu, 22 Feb 2018 21:04:44 +0000 (13:04 -0800)] 
Merge branch 'bp/untracked-cache-noflush' into jch

Writing out the index file when the only thing that changed in it
is the untracked cache information is often wasteful, and this has
been optimized out.

* bp/untracked-cache-noflush:
  dir.c: don't flag the index as dirty for changes to the untracked cache

7 years agoMerge branch 'tg/worktree-add-existing-branch' into jch
Junio C Hamano [Thu, 22 Feb 2018 21:04:44 +0000 (13:04 -0800)] 
Merge branch 'tg/worktree-add-existing-branch' into jch

"git worktree add" learned to check out an existing branch.

* tg/worktree-add-existing-branch:
  worktree: teach "add" to check out existing branches
  worktree: be clearer when "add" dwim-ery kicks in
  worktree: improve message when creating a new worktree

7 years agoMerge branch 'en/rename-directory-detection' into jch
Junio C Hamano [Thu, 22 Feb 2018 21:04:43 +0000 (13:04 -0800)] 
Merge branch 'en/rename-directory-detection' into jch

Rename detection logic in "diff" family that is used in "merge" has
learned to guess when all of x/a, x/b and x/c have moved to z/a,
z/b and z/c, it is likely that x/d added in the meantime would also
want to move to z/d by taking the hint that the entire directory
'x' moved to 'z'.  A bug causing dirty files involved in a rename
to be overwritten during merge has also been fixed as part of this
work.

* en/rename-directory-detection: (29 commits)
  merge-recursive: ensure we write updates for directory-renamed file
  merge-recursive: avoid spurious rename/rename conflict from dir renames
  directory rename detection: new testcases showcasing a pair of bugs
  merge-recursive: fix remaining directory rename + dirty overwrite cases
  merge-recursive: fix overwriting dirty files involved in renames
  merge-recursive: avoid clobbering untracked files with directory renames
  merge-recursive: apply necessary modifications for directory renames
  merge-recursive: when comparing files, don't include trees
  merge-recursive: check for file level conflicts then get new name
  merge-recursive: add computation of collisions due to dir rename & merging
  merge-recursive: check for directory level conflicts
  merge-recursive: add get_directory_renames()
  merge-recursive: make a helper function for cleanup for handle_renames
  merge-recursive: split out code for determining diff_filepairs
  merge-recursive: make !o->detect_rename codepath more obvious
  merge-recursive: fix leaks of allocated renames and diff_filepairs
  merge-recursive: introduce new functions to handle rename logic
  merge-recursive: move the get_renames() function
  directory rename detection: tests for handling overwriting dirty files
  directory rename detection: tests for handling overwriting untracked files
  ...

7 years agoMerge branch 'nd/rebase-show-current-patch' into jch
Junio C Hamano [Thu, 22 Feb 2018 21:04:43 +0000 (13:04 -0800)] 
Merge branch 'nd/rebase-show-current-patch' into jch

The new "--show-current-patch" option gives an end-user facing way
to get the diff being applied when "git rebase" (and "git am")
stops with a conflict.

* nd/rebase-show-current-patch:
  rebase: introduce and use pseudo-ref REBASE_HEAD
  rebase: add --show-current-patch
  am: add --show-current-patch

7 years agoMerge branch 'pc/submodule-helper-foreach' into jch
Junio C Hamano [Thu, 22 Feb 2018 21:04:42 +0000 (13:04 -0800)] 
Merge branch 'pc/submodule-helper-foreach' into jch

* pc/submodule-helper-foreach:
  submodule: port submodule subcommand 'foreach' from shell to C
  submodule foreach: document variable '$displaypath'
  submodule foreach: clarify the '$toplevel' variable documentation
  submodule foreach: document '$sm_path' instead of '$path'
  submodule foreach: correct '$path' in nested submodules from a subdirectory

7 years agoMerge branch 'nd/diff-stat-with-summary' into jch
Junio C Hamano [Thu, 22 Feb 2018 21:04:42 +0000 (13:04 -0800)] 
Merge branch 'nd/diff-stat-with-summary' into jch

* nd/diff-stat-with-summary:
  diff: add --stat-with-summary
  diff.c: refactor pprint_rename() to use strbuf

7 years agoMerge branch 'bw/c-plus-plus' into jch
Junio C Hamano [Thu, 22 Feb 2018 21:04:41 +0000 (13:04 -0800)] 
Merge branch 'bw/c-plus-plus' into jch

Avoid using identifiers that clash with C++ keywords.  Even though
it is not a goal to compile Git with C++ compilers, changes like
this help use of code analysis tools that targets C++ on our
codebase.

* bw/c-plus-plus: (37 commits)
  replace: rename 'new' variables
  trailer: rename 'template' variables
  tempfile: rename 'template' variables
  wrapper: rename 'template' variables
  environment: rename 'namespace' variables
  diff: rename 'template' variables
  environment: rename 'template' variables
  init-db: rename 'template' variables
  unpack-trees: rename 'new' variables
  trailer: rename 'new' variables
  submodule: rename 'new' variables
  split-index: rename 'new' variables
  remote: rename 'new' variables
  ref-filter: rename 'new' variables
  read-cache: rename 'new' variables
  line-log: rename 'new' variables
  imap-send: rename 'new' variables
  http: rename 'new' variables
  entry: rename 'new' variables
  diffcore-delta: rename 'new' variables
  ...

7 years agoDocumentation/gitsubmodules.txt: avoid non-ASCII apostrophes
Motoki Seki [Thu, 22 Feb 2018 08:52:25 +0000 (08:52 +0000)] 
Documentation/gitsubmodules.txt: avoid non-ASCII apostrophes

In gitsubmodules.txt, a few non-ASCII apostrophes are used to spell
possessive, e.g. "submodule's".  These unfortunately are not
rendered at https://git-scm.com/docs/gitsubmodules correctly by the
renderer used there.

Use ASCII apostrophes instead to work around the problem.  It also
is good to be consistent, as there are possessives spelled with
ASCII apostrophes.

Signed-off-by: Motoki Seki <marmot.motoki@gmail.com>
Acked-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agosequencer: factor out strbuf_read_file_or_whine()
René Scharfe [Thu, 22 Feb 2018 19:29:25 +0000 (20:29 +0100)] 
sequencer: factor out strbuf_read_file_or_whine()

Reduce code duplication by factoring out a function that reads an entire
file into a strbuf, or reports errors on stderr if something goes wrong.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agogit-p4: add unshelve command
Luke Diamand [Thu, 22 Feb 2018 09:50:22 +0000 (09:50 +0000)] 
git-p4: add unshelve command

This can be used to "unshelve" a shelved P4 commit into
a git commit.

For example:

  $ git p4 unshelve 12345

The resulting commit ends up in the branch:
   refs/remotes/p4/unshelved/12345

Signed-off-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agot: send verbose test-helper output to fd 4
Jeff King [Thu, 22 Feb 2018 06:48:37 +0000 (01:48 -0500)] 
t: send verbose test-helper output to fd 4

Test helper functions like test_must_fail may produce
messages to stderr when they see a problem. When the tests
are run with "--verbose", this ends up on the test script's
stderr, and the user can read it.

But there's a problem. Some tests record stderr as part of
the test, like:

  test_must_fail git foo 2>output &&
  test_i18ngrep expected.message output

In this case the error text goes into "output". This makes
the --verbose output less useful (it also means we might
accidentally match it in the second, though in practice we
tend to produce these messages only on error, so we'd abort
the test when the first command fails).

Let's instead send this user-facing output directly to
descriptor 4, which always points to the original stderr (or
/dev/null in non-verbose mode). And it's already forbidden
to redirect descriptor 4, since we use it for BASH_XTRACEFD,
as explained in 9be795fbce (t5615: avoid re-using descriptor
4, 2017-12-08).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agorevision: drop --show-all option
Jeff King [Wed, 21 Feb 2018 23:27:24 +0000 (18:27 -0500)] 
revision: drop --show-all option

This was an undocumented debugging aid that does not seem to
have come in handy in the past decade, judging from its lack
of mentions on the mailing list.

Let's drop it in the name of simplicity. This is morally a
revert of 3131b71301 (Add "--show-all" revision walker flag
for debugging, 2008-02-09), but note that I did leave in the
mapping of UNINTERESTING to "^" in get_revision_mark(). I
don't think this would be possible to trigger with the
current code, but it's the only sensible marker.

We'll skip the usual deprecation period because this was
explicitly a debugging aid that was never documented.

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agocommit: drop uses of get_cached_commit_buffer()
Jeff King [Wed, 21 Feb 2018 23:13:38 +0000 (18:13 -0500)] 
commit: drop uses of get_cached_commit_buffer()

The "--show-all" revision option shows UNINTERESTING
commits. Some of these commits may be unparsed when we try
to show them (since we may or may not need to walk their
parents to fulfill the request).

Commit 3131b71301 (Add "--show-all" revision walker flag for
debugging, 2008-02-09) resolved this by just skipping
pretty-printing for commits without their object contents
cached, saying:

  Because we now end up listing commits we may not even have been parsed
  at all "show_log" and "show_commit" need to protect against commits
  that don't have a commit buffer entry.

That was the easy fix to avoid the pretty-printer segfaulting,
but:

  1. It doesn't work for all formats. E.g., --oneline
     prints the oid for each such commit but not a trailing
     newline, leading to jumbled output.

  2. It only affects some commits, depending on whether we
     happened to parse them or not (so if they were at the
     tip of an UNINTERESTING starting point, or if we
     happened to traverse over them, you'd see more data).

  3. It unncessarily ties the decision to show the verbose
     header to whether the commit buffer was cached. That
     makes it harder to change the logic around caching
     (e.g., if we could traverse without actually loading
     the full commit objects).

These days it's safe to feed such a commit to the
pretty-print code. Since be5c9fb904 (logmsg_reencode: lazily
load missing commit buffers, 2013-01-26), we'll load it on
demand in such a case. So let's just always show the verbose
headers.

This does change the behavior of plumbing, but:

  a. The --show-all option was explicitly introduced as a
     debugging aid, and was never documented (and has rarely
     even been mentioned on the list by git devs).

  b. Avoiding the commits was already not deterministic due
     to (2) above. So the caller might have seen full
     headers for these commits anyway, and would need to be
     prepared for it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoreplace: rename 'new' variables
Brandon Williams [Wed, 14 Feb 2018 18:59:59 +0000 (10:59 -0800)] 
replace: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agotrailer: rename 'template' variables
Brandon Williams [Wed, 14 Feb 2018 18:59:58 +0000 (10:59 -0800)] 
trailer: rename 'template' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agotempfile: rename 'template' variables
Brandon Williams [Wed, 14 Feb 2018 18:59:57 +0000 (10:59 -0800)] 
tempfile: rename 'template' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agowrapper: rename 'template' variables
Brandon Williams [Wed, 14 Feb 2018 18:59:56 +0000 (10:59 -0800)] 
wrapper: rename 'template' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoenvironment: rename 'namespace' variables
Brandon Williams [Wed, 14 Feb 2018 18:59:55 +0000 (10:59 -0800)] 
environment: rename 'namespace' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agodiff: rename 'template' variables
Brandon Williams [Wed, 14 Feb 2018 18:59:54 +0000 (10:59 -0800)] 
diff: rename 'template' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoenvironment: rename 'template' variables
Brandon Williams [Wed, 14 Feb 2018 18:59:53 +0000 (10:59 -0800)] 
environment: rename 'template' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoinit-db: rename 'template' variables
Brandon Williams [Wed, 14 Feb 2018 18:59:52 +0000 (10:59 -0800)] 
init-db: rename 'template' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agounpack-trees: rename 'new' variables
Brandon Williams [Wed, 14 Feb 2018 18:59:51 +0000 (10:59 -0800)] 
unpack-trees: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agotrailer: rename 'new' variables
Brandon Williams [Wed, 14 Feb 2018 18:59:50 +0000 (10:59 -0800)] 
trailer: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agosubmodule: rename 'new' variables
Brandon Williams [Wed, 14 Feb 2018 18:59:49 +0000 (10:59 -0800)] 
submodule: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agosplit-index: rename 'new' variables
Brandon Williams [Wed, 14 Feb 2018 18:59:48 +0000 (10:59 -0800)] 
split-index: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoremote: rename 'new' variables
Brandon Williams [Wed, 14 Feb 2018 18:59:47 +0000 (10:59 -0800)] 
remote: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoref-filter: rename 'new' variables
Brandon Williams [Wed, 14 Feb 2018 18:59:46 +0000 (10:59 -0800)] 
ref-filter: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoread-cache: rename 'new' variables
Brandon Williams [Wed, 14 Feb 2018 18:59:45 +0000 (10:59 -0800)] 
read-cache: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoline-log: rename 'new' variables
Brandon Williams [Wed, 14 Feb 2018 18:59:44 +0000 (10:59 -0800)] 
line-log: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoimap-send: rename 'new' variables
Brandon Williams [Wed, 14 Feb 2018 18:59:43 +0000 (10:59 -0800)] 
imap-send: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agohttp: rename 'new' variables
Brandon Williams [Wed, 14 Feb 2018 18:59:42 +0000 (10:59 -0800)] 
http: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoentry: rename 'new' variables
Brandon Williams [Wed, 14 Feb 2018 18:59:41 +0000 (10:59 -0800)] 
entry: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agodiffcore-delta: rename 'new' variables
Brandon Williams [Wed, 14 Feb 2018 18:59:40 +0000 (10:59 -0800)] 
diffcore-delta: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agodiff: rename 'new' variables
Brandon Williams [Wed, 14 Feb 2018 18:59:39 +0000 (10:59 -0800)] 
diff: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agodiff-lib: rename 'new' variable
Brandon Williams [Wed, 14 Feb 2018 18:59:38 +0000 (10:59 -0800)] 
diff-lib: rename 'new' variable

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agocommit: rename 'new' variables
Brandon Williams [Wed, 14 Feb 2018 18:59:37 +0000 (10:59 -0800)] 
commit: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agocombine-diff: rename 'new' variables
Brandon Williams [Wed, 14 Feb 2018 18:59:36 +0000 (10:59 -0800)] 
combine-diff: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoremote: rename 'new' variables
Brandon Williams [Wed, 14 Feb 2018 18:59:35 +0000 (10:59 -0800)] 
remote: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoreflog: rename 'new' variables
Brandon Williams [Wed, 14 Feb 2018 18:59:34 +0000 (10:59 -0800)] 
reflog: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agopack-redundant: rename 'new' variables
Brandon Williams [Wed, 14 Feb 2018 18:59:33 +0000 (10:59 -0800)] 
pack-redundant: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agohelp: rename 'new' variables
Brandon Williams [Wed, 14 Feb 2018 18:59:32 +0000 (10:59 -0800)] 
help: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agocheckout: rename 'new' variables
Brandon Williams [Wed, 14 Feb 2018 18:59:31 +0000 (10:59 -0800)] 
checkout: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoapply: rename 'new' variables
Brandon Williams [Wed, 14 Feb 2018 18:59:30 +0000 (10:59 -0800)] 
apply: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoapply: rename 'try' variables
Brandon Williams [Wed, 14 Feb 2018 18:59:29 +0000 (10:59 -0800)] 
apply: rename 'try' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agodiff: rename 'this' variables
Brandon Williams [Wed, 14 Feb 2018 18:59:28 +0000 (10:59 -0800)] 
diff: rename 'this' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoconfig: change default of `pager.config` to "on"
Martin Ågren [Wed, 21 Feb 2018 18:51:44 +0000 (19:51 +0100)] 
config: change default of `pager.config` to "on"

This is similar to ff1e72483 (tag: change default of `pager.tag` to
"on", 2017-08-02) and is safe now that we do not consider `pager.config`
at all when we are not listing or getting configuration. This change
will help with listing large configurations, but will not hurt users of
`git config --edit` as it would have before the previous commit.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoconfig: respect `pager.config` in list/get-mode only
Martin Ågren [Wed, 21 Feb 2018 18:51:43 +0000 (19:51 +0100)] 
config: respect `pager.config` in list/get-mode only

Similar to de121ffe5 (tag: respect `pager.tag` in list-mode only,
2017-08-02), use the DELAY_PAGER_CONFIG-mechanism to only respect
`pager.config` when we are listing or "get"ing config.

We have several getters and some are guaranteed to give at most one line
of output. Paging all getters including those could be convenient from a
documentation point-of-view. The downside would be that a misconfigured
or not so modern pager might wait for user interaction before
terminating. Let's instead respect the config for precisely those
getters which may produce more than one line of output.

`--get-urlmatch` may or may not produce multiple lines of output,
depending on the exact usage. Let's not try to recognize the two modes,
but instead make `--get-urlmatch` always respect the config. Analyzing
the detailed usage might be trivial enough here, but could establish a
precedent that we will never be able to enforce throughout the codebase
and that will just open a can of worms.

This fixes the failing test added in the previous commit. Also adapt the
test for whether `git config foo.bar bar` and `git config --get foo.bar`
respects `pager.config`.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agot7006: add tests for how git config paginates
Martin Ågren [Wed, 21 Feb 2018 18:51:42 +0000 (19:51 +0100)] 
t7006: add tests for how git config paginates

The next couple of commits will change how `git config` handles
`pager.config`, similar to how de121ffe5 (tag: respect `pager.tag` in
list-mode only, 2017-08-02) and ff1e72483 (tag: change default of
`pager.tag` to "on", 2017-08-02) changed `git tag`. Similar work has
also been done to `git branch`.

Add tests in this area to make sure that we don't regress and so that
the upcoming commits can be made clearer by adapting the tests. Add
tests for simple config-setting, `--edit`, `--get`, `--get-urlmatch`,
`get-all`, and `--list`. Those represent a fair portion of the various
options that will be affected by the next two commits.

Use `test_expect_failure` to document that we currently respect the
pager-configuration with `--edit`. The current behavior is buggy since
the pager interferes with the editor and makes the end result completely
broken. See also b3ee740c8 (t7006: add tests for how git tag paginates,
2017-08-02).

The next commit will teach simple config-setting and `--get` to ignore
`pager.config`. Test the current behavior as "success", not "failure",
since the currently expected behavior according to documentation would
be to page. The next commit will change that expectation by updating the
documentation on `git config` and will redefine those successful tests.

Remove the test added in commit 3ba7e6e29a (config: run
setup_git_directory_gently() sooner, 2010-08-05) since it has some
overlap with these. We could leave it or tweak it, or place new tests
like these next to it, but let's instead make the tests for `git config`
as similar as possible to the ones for `git tag` and `git branch`, and
place them after those.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMerge branch 'bw/protocol-v2' into jch
Junio C Hamano [Wed, 21 Feb 2018 21:18:52 +0000 (13:18 -0800)] 
Merge branch 'bw/protocol-v2' into jch

The beginning of the next-gen transfer protocol.

* bw/protocol-v2: (35 commits)
  remote-curl: don't request v2 when pushing
  remote-curl: implement stateless-connect command
  http: don't always add Git-Protocol header
  http: allow providing extra headers for http requests
  remote-curl: store the protocol version the server responded with
  remote-curl: create copy of the service name
  pkt-line: add packet_buf_write_len function
  transport-helper: introduce stateless-connect
  transport-helper: refactor process_connect_service
  transport-helper: remove name parameter
  connect: don't request v2 when pushing
  connect: refactor git_connect to only get the protocol version once
  fetch-pack: support shallow requests
  upload-pack: support shallow requests
  fetch-pack: perform a fetch using v2
  upload-pack: introduce fetch server command
  push: pass ref patterns when pushing
  fetch: pass ref patterns when fetching
  ls-remote: pass ref patterns when requesting a remote's refs
  transport: convert transport_get_remote_refs to take a list of ref patterns
  ...

7 years agoMerge branch 'nd/worktree-move' into jch
Junio C Hamano [Wed, 21 Feb 2018 21:18:51 +0000 (13:18 -0800)] 
Merge branch 'nd/worktree-move' into jch

"git worktree" learned move and remove subcommands.

* nd/worktree-move:
  worktree remove: allow it when $GIT_WORK_TREE is already gone
  worktree remove: new command
  worktree move: refuse to move worktrees with submodules
  worktree move: accept destination as directory
  worktree move: new command
  worktree.c: add update_worktree_location()
  worktree.c: add validate_worktree()

7 years agoMerge branch 'xz/send-email-batch-size' into jch
Junio C Hamano [Wed, 21 Feb 2018 21:18:51 +0000 (13:18 -0800)] 
Merge branch 'xz/send-email-batch-size' into jch

"git send-email" learned to complain when the batch-size option is
not defined when the relogin-delay option is, since these two are
mutually required.

* xz/send-email-batch-size:
  send-email: error out when relogin delay is missing

7 years agoMerge branch 'cl/send-email-reply-to' into jch
Junio C Hamano [Wed, 21 Feb 2018 21:18:50 +0000 (13:18 -0800)] 
Merge branch 'cl/send-email-reply-to' into jch

"git send-email" learned "--reply-to=<address>" option.

* cl/send-email-reply-to:
  send-email: support separate "Reply-To" address
  send-email: rename variables for "In-reply-to" to $foo_in_reply_to

7 years agoMerge branch 'sg/travis-build-during-script-phase' into jch
Junio C Hamano [Wed, 21 Feb 2018 21:18:50 +0000 (13:18 -0800)] 
Merge branch 'sg/travis-build-during-script-phase' into jch

So... what do we want to do with this thing?

* sg/travis-build-during-script-phase:
  travis-ci: build Git during the 'script' phase

7 years agoMerge branch 'jh/status-no-ahead-behind' into jch
Junio C Hamano [Wed, 21 Feb 2018 21:18:49 +0000 (13:18 -0800)] 
Merge branch 'jh/status-no-ahead-behind' into jch

"git status" can spend a lot of cycles to compute the relation
between the current branch and its upstream, which can now be
disabled with "--no-ahead-behind" option.

At v5; is this ready for 'next'?

* jh/status-no-ahead-behind:
  status: support --no-ahead-behind in long format
  status: update short status to respect --no-ahead-behind
  status: add --[no-]ahead-behind to status and commit for V2 format.
  stat_tracking_info: return +1 when branches not equal

7 years agoMerge branch 'bw/doc-submodule-recurse-config-with-clone' into jch
Junio C Hamano [Wed, 21 Feb 2018 21:18:48 +0000 (13:18 -0800)] 
Merge branch 'bw/doc-submodule-recurse-config-with-clone' into jch

* bw/doc-submodule-recurse-config-with-clone:
  submodule: indicate that 'submodule.recurse' doesn't apply to clone

7 years ago### match next
Junio C Hamano [Wed, 21 Feb 2018 20:46:50 +0000 (12:46 -0800)] 
### match next

7 years agoMerge branch 'nd/am-quit' into jch
Junio C Hamano [Wed, 21 Feb 2018 20:46:50 +0000 (12:46 -0800)] 
Merge branch 'nd/am-quit' into jch

"git am" has learned "--quit" option, in addition to the existing
"--abort" option; having the pair mirrors a few other commands like
"rebase" and "cherry-pick".

* nd/am-quit:
  am: support --quit

7 years agoMerge branch 'es/worktree-add-post-checkout-hook' into jch
Junio C Hamano [Wed, 21 Feb 2018 20:46:49 +0000 (12:46 -0800)] 
Merge branch 'es/worktree-add-post-checkout-hook' into jch

"git worktree add" learned to run the post-checkout hook, just like
"git clone" runs it upon the initial checkout.

* es/worktree-add-post-checkout-hook:
  worktree: add: fix 'post-checkout' not knowing new worktree location

7 years agoMerge branch 'sb/status-doc-fix' into jch
Junio C Hamano [Wed, 21 Feb 2018 20:46:49 +0000 (12:46 -0800)] 
Merge branch 'sb/status-doc-fix' into jch

Docfix.

* sb/status-doc-fix:
  Documentation/git-status: clarify status table for porcelain mode

7 years agoMerge branch 'tk/apply-dev-null-verify-name-fix' into jch
Junio C Hamano [Wed, 21 Feb 2018 20:46:48 +0000 (12:46 -0800)] 
Merge branch 'tk/apply-dev-null-verify-name-fix' into jch

Many places in "git apply" knew that "/dev/null" that signals
"there is no such file on this side of the diff" can be followed by
whitespace and garbage when parsing a patch, except for one, which
made an otherwise valid patch (e.g. ones from subversion) rejected.

* tk/apply-dev-null-verify-name-fix:
  apply: handle Subversion diffs with /dev/null gracefully
  apply: demonstrate a problem applying svn diffs

7 years agoMerge branch 'gs/test-unset-xdg-cache-home' into jch
Junio C Hamano [Wed, 21 Feb 2018 20:46:47 +0000 (12:46 -0800)] 
Merge branch 'gs/test-unset-xdg-cache-home' into jch

* gs/test-unset-xdg-cache-home:
  test-lib.sh: unset XDG_CACHE_HOME

7 years agoMerge branch 'tg/worktree-create-tracking' into jch
Junio C Hamano [Wed, 21 Feb 2018 20:46:45 +0000 (12:46 -0800)] 
Merge branch 'tg/worktree-create-tracking' into jch

Hotfix for a recent topic.

* tg/worktree-create-tracking:
  git-worktree.txt: fix indentation of example and text of 'add' command
  git-worktree.txt: fix missing ")" typo

7 years agoMerge branch 'tz/do-not-clean-spec-file' into jch
Junio C Hamano [Wed, 21 Feb 2018 20:46:45 +0000 (12:46 -0800)] 
Merge branch 'tz/do-not-clean-spec-file' into jch

We no longer create any *.spec file, so "make clean" should not
remove it.

* tz/do-not-clean-spec-file:
  Makefile: remove *.spec from clean target

7 years agoMerge branch 'jk/push-options-via-transport-fix' into jch
Junio C Hamano [Wed, 21 Feb 2018 20:46:44 +0000 (12:46 -0800)] 
Merge branch 'jk/push-options-via-transport-fix' into jch

"git push" over http transport did not unquote the push-options
correctly.

* jk/push-options-via-transport-fix:
  remote-curl: unquote incoming push-options
  t5545: factor out http repository setup

7 years agoMerge branch 'bp/fsmonitor' into jch
Junio C Hamano [Wed, 21 Feb 2018 20:46:43 +0000 (12:46 -0800)] 
Merge branch 'bp/fsmonitor' into jch

Doc update for a recently added feature.

* bp/fsmonitor:
  fsmonitor: update documentation to remove reference to invalid config settings

7 years agoMerge branch 'jk/sq-dequote-on-bogus-input' into jch
Junio C Hamano [Wed, 21 Feb 2018 20:46:42 +0000 (12:46 -0800)] 
Merge branch 'jk/sq-dequote-on-bogus-input' into jch

Code to unquote single-quoted string (used in the parser for
configuration files, etc.) did not diagnose bogus input correctly
and produced bogus results instead.

* jk/sq-dequote-on-bogus-input:
  sq_dequote: fix extra consumption of source string

7 years agoMerge branch 'jk/test-hashmap-updates' into jch
Junio C Hamano [Wed, 21 Feb 2018 20:46:41 +0000 (12:46 -0800)] 
Merge branch 'jk/test-hashmap-updates' into jch

Code clean-up.

* jk/test-hashmap-updates:
  test-hashmap: use "unsigned int" for hash storage
  test-hashmap: simplify alloc_test_entry
  test-hashmap: use strbuf_getline rather than fgets
  test-hashmap: use xsnprintf rather than snprintf
  test-hashmap: check allocation computation for overflow
  test-hashmap: use ALLOC_ARRAY rather than bare malloc

7 years agoMerge branch 'rd/typofix' into jch
Junio C Hamano [Wed, 21 Feb 2018 20:46:41 +0000 (12:46 -0800)] 
Merge branch 'rd/typofix' into jch

Typofix.

* rd/typofix:
  Correct mispellings of ".gitmodule" to ".gitmodules"
  t/: correct obvious typo "detahced"

7 years agoMerge branch 'bc/doc-interpret-trailers-grammofix' into jch
Junio C Hamano [Wed, 21 Feb 2018 20:46:41 +0000 (12:46 -0800)] 
Merge branch 'bc/doc-interpret-trailers-grammofix' into jch

Docfix.

* bc/doc-interpret-trailers-grammofix:
  docs/interpret-trailers: fix agreement error

7 years agoMerge branch 'as/ll-i18n' into jch
Junio C Hamano [Wed, 21 Feb 2018 20:46:40 +0000 (12:46 -0800)] 
Merge branch 'as/ll-i18n' into jch

Some messages in low level start-up codepath have been i18n-ized.

* as/ll-i18n:
  Mark messages for translations

7 years agoMerge branch 'sg/doc-test-must-fail-args' into jch
Junio C Hamano [Wed, 21 Feb 2018 20:46:39 +0000 (12:46 -0800)] 
Merge branch 'sg/doc-test-must-fail-args' into jch

Devdoc update.

* sg/doc-test-must-fail-args:
  t: document 'test_must_fail ok=<signal-name>'