git
6 years agoMerge branch 'sg/subtree-signed-commits' into pu origin/pu
Junio C Hamano [Fri, 23 Feb 2018 22:47:52 +0000 (14:47 -0800)] 
Merge branch 'sg/subtree-signed-commits' into pu

* sg/subtree-signed-commits:
  subtree: fix add and pull for GPG-signed commits

6 years agoMerge branch 'ds/commit-graph' into pu
Junio C Hamano [Fri, 23 Feb 2018 22:47:51 +0000 (14:47 -0800)] 
Merge branch 'ds/commit-graph' into pu

* ds/commit-graph:
  commit-graph: build graph from starting commits
  commit-graph: read only from specific pack-indexes
  commit: integrate commit graph with commit parsing
  commit-graph: close under reachability
  commit-graph: add core.commitGraph setting
  commit-graph: implement --delete-expired
  commit-graph: implement --set-latest
  commit-graph: implement git commit-graph read
  commit-graph: implement 'git-commit-graph write'
  commit-graph: implement write_commit_graph()
  commit-graph: create git-commit-graph builtin
  graph: add commit graph design document
  commit-graph: add format document

6 years agoMerge branch 'ot/cat-batch-format' into pu
Junio C Hamano [Fri, 23 Feb 2018 22:47:51 +0000 (14:47 -0800)] 
Merge branch 'ot/cat-batch-format' into pu

Teach "cat-file --batch" to reuse the formatting machinery shared
by for-each-ref, branch --list, and tag --list.

Allocates flex-array on stack, etc.
cf. <58b2bdcd-d621-fd21-ab4d-6a9478319b19@ramsayjones.plus.com>

* ot/cat-batch-format: (23 commits)
  cat-file: update of docs
  cat-file: tests for new atoms added
  for-each-ref: tests for new atoms added
  ref-filter: unifying formatting of cat-file opts
  ref-filter: make populate_value() internal again
  cat-file: reuse printing logic from ref-filter
  ref-filter: make valid_atom general again
  ref-filter: make cat_file_info independent
  cat-file: move skip_object_info into ref-filter
  ref_filter: add is_atom_used function
  ref-filter: get rid of mark_atom_in_object_info()
  cat-file: start reusing populate_value()
  ref-filter: rename field in ref_array_item stuct
  ref-filter: make populate_value() global
  cat-file: start use ref_array_item struct
  ref-filter: reuse parse_ref_filter_atom()
  cat-file: start migrating formatting to ref-filter
  cat-file: split expand_atom() into 2 functions
  cat-file: move struct expand_data into ref-filter
  ref-filter: make valid_atom as function parameter
  ...

6 years agoMerge branch 'ls/checkout-encoding' into pu
Junio C Hamano [Fri, 23 Feb 2018 22:47:50 +0000 (14:47 -0800)] 
Merge branch 'ls/checkout-encoding' into pu

The new "checkout-encoding" attribute can ask Git to convert the
contents to the specified encoding when checking out to the working
tree (and the other way around when checking in).

* ls/checkout-encoding:
  convert: add round trip check based on 'core.checkRoundtripEncoding'
  convert: add tracing for 'working-tree-encoding' attribute
  convert: add 'working-tree-encoding' attribute
  utf8: add function to detect a missing UTF-16/32 BOM
  utf8: add function to detect prohibited UTF-16/32 BOM
  strbuf: add xstrdup_toupper()
  strbuf: remove unnecessary NUL assignment in xstrdup_tolower()

6 years agoMerge branch 'nd/tilde-expand-opt-file-value' into pu
Junio C Hamano [Fri, 23 Feb 2018 22:47:50 +0000 (14:47 -0800)] 
Merge branch 'nd/tilde-expand-opt-file-value' into pu

"git cmd --opt=~u/path/to/file" did not tilde-expand "~u" part to
the path to the home directory of user 'u'

* nd/tilde-expand-opt-file-value:
  init-db: change --template type to OPTION_FILENAME
  parse-options: expand $HOME on filename options

6 years agoMerge branch 'pw/add-p-recount' into pu
Junio C Hamano [Fri, 23 Feb 2018 22:47:49 +0000 (14:47 -0800)] 
Merge branch 'pw/add-p-recount' into pu

"git add -p" has been lazy in coalescing split patches before
passing the result to underlying "git apply", leading to corner
case bugs; the logic to prepare the patch to be applied after hunk
selections has been tightened.

* pw/add-p-recount:
  add -p: don't rely on apply's '--recount' option
  add -p: fix counting when splitting and coalescing
  add -p: calculate offset delta for edited patches
  add -p: adjust offsets of subsequent hunks when one is skipped
  t3701: add failing test for pathological context lines
  t3701: don't hard code sha1 hash values
  t3701: use test_write_lines and write_script
  t3701: indent here documents
  add -i: add function to format hunk header

6 years agoMerge branch 'pw/add-p-single' into pu
Junio C Hamano [Fri, 23 Feb 2018 22:47:49 +0000 (14:47 -0800)] 
Merge branch 'pw/add-p-single' into pu

"git add -p" used to offer "/" (look for a matching hunk) as a
choice, even there was only one hunk, which has been corrected.
Also the single-key help is now given only for keys that are
enabled (e.g. help for '/' won't be shown when there is only one
hunk).

* pw/add-p-single:
  add -p: improve error messages
  add -p: only bind search key if there's more than one hunk
  add -p: only display help for active keys

6 years agoMerge branch 'sb/blame-color' into pu
Junio C Hamano [Fri, 23 Feb 2018 22:47:48 +0000 (14:47 -0800)] 
Merge branch 'sb/blame-color' into pu

* sb/blame-color:
  builtin/blame: highlight recently changed lines
  builtin/blame: add option to color metadata fields separately
  builtin/blame: dim uninteresting metadata

6 years agoMerge branch 'av/fsmonitor-updates' into pu
Junio C Hamano [Fri, 23 Feb 2018 22:47:48 +0000 (14:47 -0800)] 
Merge branch 'av/fsmonitor-updates' into pu

Code clean-up on fsmonitor integration, plus optional utilization
of the fsmonitor data in diff-files.

* av/fsmonitor-updates:
  fsmonitor: use fsmonitor data in `git diff`
  fsmonitor: remove debugging lines from t/t7519-status-fsmonitor.sh
  fsmonitor: make output of test-dump-fsmonitor more concise
  fsmonitor: update helper tool, now that flags are filled later
  fsmonitor: stop inline'ing mark_fsmonitor_valid / _invalid
  dir.c: update comments to match argument name

6 years agoMerge branch 'np/send-email-header-parsing' into pu
Junio C Hamano [Fri, 23 Feb 2018 22:47:47 +0000 (14:47 -0800)] 
Merge branch 'np/send-email-header-parsing' into pu

Code refactoring.

Undecided but inclined to drop.  A "refactor" without the code that
benefit from the refactoring is hard to tell from code churn whose
only effect is potential to introduce bugs.

* np/send-email-header-parsing:
  send-email: extract email-parsing code into a subroutine

6 years agoMerge branch 'cc/require-tcl-tk-for-build' into pu
Junio C Hamano [Fri, 23 Feb 2018 22:47:46 +0000 (14:47 -0800)] 
Merge branch 'cc/require-tcl-tk-for-build' into pu

A first-time builder of Git may have installed neither tclsh nor
msgfmt, in which case git-gui and gitk part will fail and break the
build.  As a workaround, refuse to run a build when tclsh is not
installed and NO_TCLTK is not set.

Undecided.
I still feel that requring tclsh to be installed, with or without
"escape hatch" for experts, may be too heavy-handed.

* cc/require-tcl-tk-for-build:
  travis-ci: avoid new tcl/tk build requirement
  Makefile: check that tcl/tk is installed

6 years agoMerge branch 'mk/http-backend-content-length' into pu
Junio C Hamano [Fri, 23 Feb 2018 22:47:46 +0000 (14:47 -0800)] 
Merge branch 'mk/http-backend-content-length' into pu

The http-backend (used for smart-http transport) used to slurp the
whole input until EOF, without paying attention to CONTENT_LENGTH
that is supplied in the environment and instead expecting the Web
server to close the input stream.  This has been fixed.

* mk/http-backend-content-length:
  SQUASH???
  t5560-http-backend-noserver.sh: add CONTENT_LENGTH cases
  SQUASH???
  http-backend: respect CONTENT_LENGTH as specified by rfc3875

6 years agoMerge branch 'pb/bisect-helper-2' into pu
Junio C Hamano [Fri, 23 Feb 2018 22:47:45 +0000 (14:47 -0800)] 
Merge branch 'pb/bisect-helper-2' into pu

* pb/bisect-helper-2:
  t6030: make various test to pass GETTEXT_POISON tests
  bisect--helper: `bisect_start` shell function partially in C
  bisect--helper: `get_terms` & `bisect_terms` shell function in C
  bisect--helper: `bisect_next_check` shell function in C
  bisect--helper: `check_and_set_terms` shell function in C
  wrapper: move is_empty_file() and rename it as is_empty_or_missing_file()
  bisect--helper: `bisect_write` shell function in C
  bisect--helper: `bisect_reset` shell function in C

6 years agoMerge branch 'mg/merge-base-fork-point' into pu
Junio C Hamano [Fri, 23 Feb 2018 22:47:44 +0000 (14:47 -0800)] 
Merge branch 'mg/merge-base-fork-point' into pu

"merge-base --fork-point $branch $commit" is used to guess on which
commit among the commits that were once at the tip of the $branch the
$commit was built on top of, and it learns these historical tips from
the reflog of the $branch.  When the true fork-point is lost due to
pruning of old reflog entries, the command does not give any output,
because it has no way to guess correctly and does not want to mislead
the user with a wrong guess.

The command has been updated to give the best but not known to be
correct guess, based on a hope that a merge-base between $commit and a
virtual merge across all the reflog entries that still are available
for $branch may still be a closer to the true fork-point than the
merge-base between $commit and the current tip of the $branch.

This may have to be offered by an additional option, to allow the
users that are prepared to see a potentially incorrect guess to opt
into the feature, without affecting the current callers that may not
be prepared to accept a guess that is not known to be correct.

What's the doneness of this one?

* mg/merge-base-fork-point:
  merge-base: find fork-point outside partial reflog
  merge-base: return fork-point outside reflog
  t6010: test actual test output

6 years agoMerge branch 'jk/drop-ancient-curl' into pu
Junio C Hamano [Fri, 23 Feb 2018 22:47:43 +0000 (14:47 -0800)] 
Merge branch 'jk/drop-ancient-curl' into pu

Some code in http.c that has bitrot is being removed.

* jk/drop-ancient-curl:
  http: #error on too-old curl
  curl: remove ifdef'd code never used with curl >=7.19.4
  http: drop support for curl < 7.19.4
  http: drop support for curl < 7.16.0
  http: drop support for curl < 7.11.1

6 years agoMerge branch 'mg/status-in-progress-info' into pu
Junio C Hamano [Fri, 23 Feb 2018 22:47:42 +0000 (14:47 -0800)] 
Merge branch 'mg/status-in-progress-info' into pu

"git status" learns an option to report various operations
(e.g. "merging") that the user is in the middle of.

cf. <xmqqmvakcdqw.fsf@gitster.mtv.corp.google.com>

* mg/status-in-progress-info:
  status --short --inprogress: spell it as --in-progress
  status: show in-progress info for short status

6 years agoMerge branch 'bw/perl-timegm-timelocal-fix' into jch
Junio C Hamano [Fri, 23 Feb 2018 22:47:25 +0000 (14:47 -0800)] 
Merge branch 'bw/perl-timegm-timelocal-fix' into jch

* bw/perl-timegm-timelocal-fix:
  perl: call timegm and timelocal with 4-digit year

6 years agoperl: call timegm and timelocal with 4-digit year
Bernhard M. Wiedemann [Fri, 23 Feb 2018 17:20:45 +0000 (18:20 +0100)] 
perl: call timegm and timelocal with 4-digit year

Amazingly, timegm(gmtime(0)) is only 0 before 2020 because perl's
timegm deviates from GNU timegm(3) in how it handles years.

man Time::Local says

 Whenever possible, use an absolute four digit year instead.

with a detailed explanation about ambiguity of 2-digit years above that.

Even though this ambiguity is error-prone with >50% of users getting it
wrong, it has been like this for 20+ years, so we just use 4-digit years
everywhere to be on the safe side.

We add some extra logic to cvsimport because it allows 2-digit year
input and interpreting an 18 as 1918 can be avoided easily and safely.

Signed-off-by: Bernhard M. Wiedemann <bwiedemann@suse.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosubtree: fix add and pull for GPG-signed commits
Stephen R Guglielmo [Fri, 23 Feb 2018 20:41:25 +0000 (15:41 -0500)] 
subtree: fix add and pull for GPG-signed commits

If log.showsignature is true (or --show-signature is passed) while
performing a `subtree add` or `subtree pull`, the command fails.

toptree_for_commit() calls `log` and passes the output to `commit-tree`.
If this output shows the GPG signature data, `commit-tree` throws a
fatal error.

This commit fixes the issue by adding --no-show-signature to `log` calls
in a few places, as well as using the more appropriate `rev-parse`
instead where possible.

Signed-off-by: Stephen R Guglielmo <srg@guglielmo.us>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'jk/strbuf-read-file-close-error' into jch
Junio C Hamano [Fri, 23 Feb 2018 22:21:03 +0000 (14:21 -0800)] 
Merge branch 'jk/strbuf-read-file-close-error' into jch

* jk/strbuf-read-file-close-error:
  strbuf_read_file(): preserve errno across close() call

6 years agostrbuf_read_file(): preserve errno across close() call
Jeff King [Fri, 23 Feb 2018 07:00:54 +0000 (02:00 -0500)] 
strbuf_read_file(): preserve errno across close() call

If we encounter a read error, the user may want to report it
by looking at errno. However, our close() call may clobber
errno, leading to confusing results. Let's save and restore
it in the error case.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'ps/contains-id-error-message' into jch
Junio C Hamano [Fri, 23 Feb 2018 21:27:59 +0000 (13:27 -0800)] 
Merge branch 'ps/contains-id-error-message' into jch

* ps/contains-id-error-message:
  ref-filter: make "--contains <id>" less chatty if <id> is invalid

6 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

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

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

6 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

6 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

6 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

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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 years agoref-filter: make "--contains <id>" less chatty if <id> is invalid
Paul-Sebastian Ungureanu [Fri, 23 Feb 2018 16:25:57 +0000 (18:25 +0200)] 
ref-filter: make "--contains <id>" less chatty if <id> is invalid

Some git commands which use --contains <id> print the whole
help text if <id> is invalid. It should only show the error
message instead.

This patch applies to "git tag", "git branch", "git for-each-ref".

This bug was a side effect of looking up the commit in option
parser callback. When a error occurs in the option parser, the
full usage is shown. To fix this bug, the part related to
looking up the commit was moved outside of the option parser
to the ref-filter module.

Basically, the option parser only parses strings that represent
commits and the ref-filter performs the commit look-up. If an
error occurs during the option parsing, then it must be an invalid
argument and the user should be informed of usage, but if a error
occurs during ref-filtering, then it is a problem with the
argument.

Signed-off-by: Paul-Sebastian Ungureanu <ungureanupaulsebastian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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

6 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

6 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
  ...

6 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

6 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

6 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

6 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
  ...

6 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

6 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

6 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

6 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
  ...

6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>