git
5 years agoMerge branch 'tz/doc-apostrophe-no-longer-needed'
Junio C Hamano [Thu, 25 Apr 2019 07:41:21 +0000 (16:41 +0900)] 
Merge branch 'tz/doc-apostrophe-no-longer-needed'

Doc formatting fix.

* tz/doc-apostrophe-no-longer-needed:
  Documentation/git-show-branch: avoid literal {apostrophe}

5 years agoMerge branch 'sg/blame-in-bare-start-at-head'
Junio C Hamano [Thu, 25 Apr 2019 07:41:21 +0000 (16:41 +0900)] 
Merge branch 'sg/blame-in-bare-start-at-head'

"git blame -- path" in a non-bare repository starts blaming from
the working tree, and the same command in a bare repository errors
out because there is no working tree by definition.  The command
has been taught to instead start blaming from the commit at HEAD,
which is more useful.

* sg/blame-in-bare-start-at-head:
  blame: default to HEAD in a bare repo when no start commit is given

5 years agoMerge branch 'tg/ls-files-debug-format-fix'
Junio C Hamano [Thu, 25 Apr 2019 07:41:20 +0000 (16:41 +0900)] 
Merge branch 'tg/ls-files-debug-format-fix'

Debugging code fix.

* tg/ls-files-debug-format-fix:
  ls-files: use correct format string

5 years agoMerge branch 'po/describe-not-necessarily-7'
Junio C Hamano [Thu, 25 Apr 2019 07:41:20 +0000 (16:41 +0900)] 
Merge branch 'po/describe-not-necessarily-7'

Docfix.

* po/describe-not-necessarily-7:
  describe doc: remove '7-char' abbreviation reference

5 years agoMerge branch 'po/rerere-doc-fmt'
Junio C Hamano [Thu, 25 Apr 2019 07:41:19 +0000 (16:41 +0900)] 
Merge branch 'po/rerere-doc-fmt'

Docfix.

* po/rerere-doc-fmt:
  rerere doc: quote `rerere.enabled`

5 years agoMerge branch 'sg/overlong-progress-fix'
Junio C Hamano [Thu, 25 Apr 2019 07:41:19 +0000 (16:41 +0900)] 
Merge branch 'sg/overlong-progress-fix'

Updating the display with progress message has been cleaned up to
deal better with overlong messages.

* sg/overlong-progress-fix:
  progress: break too long progress bar lines
  progress: clear previous progress update dynamically
  progress: assemble percentage and counters in a strbuf before printing
  progress: make display_progress() return void

5 years agoMerge branch 'jt/batch-fetch-blobs-in-diff'
Junio C Hamano [Thu, 25 Apr 2019 07:41:19 +0000 (16:41 +0900)] 
Merge branch 'jt/batch-fetch-blobs-in-diff'

While running "git diff" in a lazy clone, we can upfront know which
missing blobs we will need, instead of waiting for the on-demand
machinery to discover them one by one.  Aim to achieve better
performance by batching the request for these promised blobs.

* jt/batch-fetch-blobs-in-diff:
  diff: batch fetching of missing blobs
  sha1-file: support OBJECT_INFO_FOR_PREFETCH

5 years agoMerge branch 'ab/gc-docs'
Junio C Hamano [Thu, 25 Apr 2019 07:41:18 +0000 (16:41 +0900)] 
Merge branch 'ab/gc-docs'

Update docs around "gc".

* ab/gc-docs:
  gc docs: remove incorrect reference to gc.auto=0
  gc docs: clarify that "gc" doesn't throw away referenced objects
  gc docs: note "gc --aggressive" in "fast-import"
  gc docs: downplay the usefulness of --aggressive
  gc docs: note how --aggressive impacts --window & --depth
  gc docs: fix formatting for "gc.writeCommitGraph"
  gc docs: re-flow the "gc.*" section in "config"
  gc docs: include the "gc.*" section from "config" in "gc"
  gc docs: clean grammar for "gc.bigPackThreshold"
  gc docs: stop noting "repack" flags
  gc docs: modernize the advice for manually running "gc"

5 years agoMerge branch 'dl/submodule-set-branch'
Junio C Hamano [Thu, 25 Apr 2019 07:41:18 +0000 (16:41 +0900)] 
Merge branch 'dl/submodule-set-branch'

"git submodule" learns "set-branch" subcommand that allows the
submodule.*.branch settings to be modified.

* dl/submodule-set-branch:
  submodule: teach set-branch subcommand
  submodule--helper: teach config subcommand --unset
  git-submodule.txt: "--branch <branch>" option defaults to 'master'

5 years agoMerge branch 'jk/revision-rewritten-parents-in-prio-queue'
Junio C Hamano [Thu, 25 Apr 2019 07:41:18 +0000 (16:41 +0900)] 
Merge branch 'jk/revision-rewritten-parents-in-prio-queue'

Performance fix for "rev-list --parents -- pathspec".

* jk/revision-rewritten-parents-in-prio-queue:
  revision: use a prio_queue to hold rewritten parents

5 years agoMerge branch 'dk/blame-keep-origin-blob'
Junio C Hamano [Thu, 25 Apr 2019 07:41:17 +0000 (16:41 +0900)] 
Merge branch 'dk/blame-keep-origin-blob'

Performance fix around "git blame", especially in a linear history
(which is the norm we should optimize for).

* dk/blame-keep-origin-blob:
  blame.c: don't drop origin blobs as eagerly

5 years agoMerge branch 'bc/hash-transition-16'
Junio C Hamano [Thu, 25 Apr 2019 07:41:17 +0000 (16:41 +0900)] 
Merge branch 'bc/hash-transition-16'

Conversion from unsigned char[20] to struct object_id continues.

* bc/hash-transition-16: (35 commits)
  gitweb: make hash size independent
  Git.pm: make hash size independent
  read-cache: read data in a hash-independent way
  dir: make untracked cache extension hash size independent
  builtin/difftool: use parse_oid_hex
  refspec: make hash size independent
  archive: convert struct archiver_args to object_id
  builtin/get-tar-commit-id: make hash size independent
  get-tar-commit-id: parse comment record
  hash: add a function to lookup hash algorithm by length
  remote-curl: make hash size independent
  http: replace sha1_to_hex
  http: compute hash of downloaded objects using the_hash_algo
  http: replace hard-coded constant with the_hash_algo
  http-walker: replace sha1_to_hex
  http-push: remove remaining uses of sha1_to_hex
  http-backend: allow 64-character hex names
  http-push: convert to use the_hash_algo
  builtin/pull: make hash-size independent
  builtin/am: make hash size independent
  ...

5 years agoMerge branch 'en/fast-import-parsing-fix'
Junio C Hamano [Thu, 25 Apr 2019 07:41:16 +0000 (16:41 +0900)] 
Merge branch 'en/fast-import-parsing-fix'

"git fast-import" update.

* en/fast-import-parsing-fix:
  fast-import: fix erroneous handling of get-mark with empty orphan commits
  fast-import: only allow cat-blob requests where it makes sense
  fast-import: check most prominent commands first
  git-fast-import.txt: fix wording about where ls command can appear
  t9300: demonstrate bug with get-mark and empty orphan commits

5 years agoMerge branch 'jt/fetch-no-update-shallow-in-proto-v2'
Junio C Hamano [Thu, 25 Apr 2019 07:41:16 +0000 (16:41 +0900)] 
Merge branch 'jt/fetch-no-update-shallow-in-proto-v2'

Fix for protocol v2 support in "git fetch-pack" of shallow clones.

* jt/fetch-no-update-shallow-in-proto-v2:
  fetch-pack: respect --no-update-shallow in v2
  fetch-pack: call prepare_shallow_info only if v0

5 years agoMerge branch 'jt/fetch-pack-wanted-refs-optim'
Junio C Hamano [Thu, 25 Apr 2019 07:41:16 +0000 (16:41 +0900)] 
Merge branch 'jt/fetch-pack-wanted-refs-optim'

Performance fix around "git fetch" that grabs many refs.

* jt/fetch-pack-wanted-refs-optim:
  fetch-pack: binary search when storing wanted-refs

5 years agoMerge branch 'ab/test-lib-pass-trace2-env'
Junio C Hamano [Thu, 25 Apr 2019 07:41:15 +0000 (16:41 +0900)] 
Merge branch 'ab/test-lib-pass-trace2-env'

Allow tracing of Git executable while running the testsuite.

* ab/test-lib-pass-trace2-env:
  test-lib: whitelist GIT_TR2_* in the environment

5 years agoMerge branch 'sg/index-pack-progress'
Junio C Hamano [Thu, 25 Apr 2019 07:41:15 +0000 (16:41 +0900)] 
Merge branch 'sg/index-pack-progress'

A progress indicator has been added to the "index-pack" step, which
often makes users wait for completion during "git clone".

* sg/index-pack-progress:
  index-pack: show progress while checking objects

5 years agoMerge branch 'ab/commit-graph-fixes'
Junio C Hamano [Thu, 25 Apr 2019 07:41:15 +0000 (16:41 +0900)] 
Merge branch 'ab/commit-graph-fixes'

Code cleanup with more careful error checking before using data
read from the commit-graph file.

* ab/commit-graph-fixes:
  commit-graph: improve & i18n error messages
  commit-graph write: don't die if the existing graph is corrupt
  commit-graph verify: detect inability to read the graph
  commit-graph: don't pass filename to load_commit_graph_one_fd_st()
  commit-graph: don't early exit(1) on e.g. "git status"
  commit-graph: fix segfault on e.g. "git status"
  commit-graph tests: test a graph that's too small
  commit-graph tests: split up corrupt_graph_and_verify()

5 years agoMerge branch 'ab/gc-reflog'
Junio C Hamano [Thu, 25 Apr 2019 07:41:14 +0000 (16:41 +0900)] 
Merge branch 'ab/gc-reflog'

Fix various glitches in "git gc" around reflog handling.

* ab/gc-reflog:
  gc: handle & check gc.reflogExpire config
  reflog tests: assert lack of early exit with expiry="never"
  reflog tests: test for the "points nowhere" warning
  reflog tests: make use of "test_config" idiom
  gc: refactor a "call me once" pattern
  gc: convert to using the_hash_algo
  gc: remove redundant check for gc_auto_threshold

5 years agoMerge branch 'nd/checkout-m'
Junio C Hamano [Thu, 25 Apr 2019 07:41:14 +0000 (16:41 +0900)] 
Merge branch 'nd/checkout-m'

"git checkout -m <other>" was about carrying the differences
between HEAD and the working-tree files forward while checking out
another branch, and ignored the differences between HEAD and the
index.  The command has been taught to abort when the index and the
HEAD are different.

* nd/checkout-m:
  checkout: prevent losing staged changes with --merge
  read-tree: add --quiet
  unpack-trees: rename "gently" flag to "quiet"
  unpack-trees: keep gently check inside add_rejected_path

5 years agoMerge branch 'js/difftool-no-index'
Junio C Hamano [Thu, 25 Apr 2019 07:41:14 +0000 (16:41 +0900)] 
Merge branch 'js/difftool-no-index'

"git difftool" can now run outside a repository.

* js/difftool-no-index:
  difftool: allow running outside Git worktrees with --no-index
  parse-options: make OPT_ARGUMENT() more useful
  difftool: remove obsolete (and misleading) comment

5 years agoMerge branch 'pw/cherry-pick-continue'
Junio C Hamano [Thu, 25 Apr 2019 07:41:13 +0000 (16:41 +0900)] 
Merge branch 'pw/cherry-pick-continue'

"git cherry-pick --options A..B", after giving control back to the
user to ask help resolving a conflicted step, did not honor the
options it originally received, which has been corrected.

* pw/cherry-pick-continue:
  cherry-pick --continue: remember options
  cherry-pick: demonstrate option amnesia
  sequencer: break some long lines

5 years agoMerge branch 'nd/commit-a-with-paths-msg-update'
Junio C Hamano [Thu, 25 Apr 2019 07:41:13 +0000 (16:41 +0900)] 
Merge branch 'nd/commit-a-with-paths-msg-update'

The message given when "git commit -a <paths>" errors out has been
updated.

* nd/commit-a-with-paths-msg-update:
  commit: improve error message in "-a <paths>" case

5 years agoMerge branch 'jk/server-info-rabbit-hole'
Junio C Hamano [Thu, 25 Apr 2019 07:41:13 +0000 (16:41 +0900)] 
Merge branch 'jk/server-info-rabbit-hole'

Code clean-up around a much-less-important-than-it-used-to-be
update_server_info() funtion.

* jk/server-info-rabbit-hole:
  update_info_refs(): drop unused force parameter
  server-info: drop objdirlen pointer arithmetic
  server-info: drop nr_alloc struct member
  server-info: use strbuf to read old info/packs file
  server-info: simplify cleanup in parse_pack_def()
  server-info: fix blind pointer arithmetic
  http: simplify parsing of remote objects/info/packs
  packfile: fix pack basename computation
  midx: check both pack and index names for containment
  t5319: drop useless --buffer from cat-file
  t5319: fix bogus cat-file argument
  pack-revindex: open index if necessary
  packfile.h: drop extern from function declarations

5 years agoMerge branch 'nd/diff-parseopt-4'
Junio C Hamano [Thu, 25 Apr 2019 07:41:12 +0000 (16:41 +0900)] 
Merge branch 'nd/diff-parseopt-4'

Fourth batch to teach the diff machinery to use the parse-options
API.

* nd/diff-parseopt-4:
  am: avoid diff_opt_parse()
  diff --no-index: use parse_options() instead of diff_opt_parse()
  range-diff: use parse_options() instead of diff_opt_parse()
  diff.c: allow --no-color-moved-ws
  diff-parseopt: convert --color-moved-ws
  diff-parseopt: convert --[no-]color-moved
  diff-parseopt: convert --inter-hunk-context
  diff-parseopt: convert --no-prefix
  diff-parseopt: convert --line-prefix
  diff-parseopt: convert --[src|dst]-prefix
  diff-parseopt: convert --[no-]abbrev
  diff-parseopt: convert --diff-filter
  diff-parseopt: convert --find-object
  diff-parseopt: convert -O
  diff-parseopt: convert --pickaxe-all|--pickaxe-regex
  diff-parseopt: convert -S|-G
  diff-parseopt: convert -l
  diff-parseopt: convert -z
  diff-parseopt: convert --ita-[in]visible-in-index
  diff-parseopt: convert --ws-error-highlight

5 years agoMerge branch 'jk/unused-params-even-more'
Junio C Hamano [Thu, 25 Apr 2019 07:41:12 +0000 (16:41 +0900)] 
Merge branch 'jk/unused-params-even-more'

Code cleanup.

* jk/unused-params-even-more:
  parse_opt_ref_sorting: always use with NONEG flag
  pretty: drop unused strbuf from parse_padding_placeholder()
  pretty: drop unused "type" parameter in needs_rfc2047_encoding()
  parse-options: drop unused ctx parameter from show_gitcomp()
  fetch_pack(): drop unused parameters
  report_path_error(): drop unused prefix parameter
  unpack-trees: drop unused error_type parameters
  unpack-trees: drop name_entry from traverse_by_cache_tree()
  test-date: drop unused "now" parameter from parse_dates()
  update-index: drop unused prefix_length parameter from do_reupdate()
  log: drop unused "len" from show_tagger()
  log: drop unused rev_info from early output
  revision: drop some unused "revs" parameters

5 years agoMerge branch 'sg/test-atexit'
Junio C Hamano [Thu, 25 Apr 2019 07:41:12 +0000 (16:41 +0900)] 
Merge branch 'sg/test-atexit'

Test framework update to more robustly clean up leftover files and
processes after tests are done.

* sg/test-atexit:
  t9811-git-p4-label-import: fix pipeline negation
  git p4 test: disable '-x' tracing in the p4d watchdog loop
  git p4 test: simplify timeout handling
  git p4 test: clean up the p4d cleanup functions
  git p4 test: use 'test_atexit' to kill p4d and the watchdog process
  t0301-credential-cache: use 'test_atexit' to stop the credentials helper
  tests: use 'test_atexit' to stop httpd
  git-daemon: use 'test_atexit` to stop 'git-daemon'
  test-lib: introduce 'test_atexit'
  t/lib-git-daemon: make sure to kill the 'git-daemon' process
  test-lib: fix interrupt handling with 'dash' and '--verbose-log -x'

5 years agoMerge branch 'ag/sequencer-reduce-rewriting-todo'
Junio C Hamano [Thu, 25 Apr 2019 07:41:11 +0000 (16:41 +0900)] 
Merge branch 'ag/sequencer-reduce-rewriting-todo'

The scripted version of "git rebase -i" wrote and rewrote the todo
list many times during a single step of its operation, and the
recent C-rewrite made a faithful conversion of the logic to C.  The
implementation has been updated to carry necessary information
around in-core to avoid rewriting the same file over and over
unnecessarily.

* ag/sequencer-reduce-rewriting-todo:
  rebase--interactive: move transform_todo_file()
  sequencer: use edit_todo_list() in complete_action()
  rebase-interactive: rewrite edit_todo_list() to handle the initial edit
  rebase-interactive: append_todo_help() changes
  rebase-interactive: use todo_list_write_to_file() in edit_todo_list()
  sequencer: refactor skip_unnecessary_picks() to work on a todo_list
  rebase--interactive: move rearrange_squash_in_todo_file()
  rebase--interactive: move sequencer_add_exec_commands()
  sequencer: change complete_action() to use the refactored functions
  sequencer: make sequencer_make_script() write its script to a strbuf
  sequencer: refactor rearrange_squash() to work on a todo_list
  sequencer: refactor sequencer_add_exec_commands() to work on a todo_list
  sequencer: refactor check_todo_list() to work on a todo_list
  sequencer: introduce todo_list_write_to_file()
  sequencer: refactor transform_todos() to work on a todo_list
  sequencer: remove the 'arg' field from todo_item
  sequencer: make the todo_list structure public
  sequencer: changes in parse_insn_buffer()

5 years agoMerge branch 'bp/post-index-change-hook'
Junio C Hamano [Thu, 25 Apr 2019 07:41:10 +0000 (16:41 +0900)] 
Merge branch 'bp/post-index-change-hook'

A new hook "post-index-change" is called when the on-disk index
file changes, which can help e.g. a virtualized working tree
implementation.

* bp/post-index-change-hook:
  read-cache: add post-index-change hook

5 years agot7610: add mergetool --gui tests
Denton Liu [Wed, 24 Apr 2019 22:46:59 +0000 (15:46 -0700)] 
t7610: add mergetool --gui tests

In 063f2bdbf7 (mergetool: accept -g/--[no-]gui as arguments,
2018-10-24), mergetool was taught the --gui option but no tests were
added to ensure that it was working properly. Add a test to ensure that
it works.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agot7610: unsuppress output
Denton Liu [Wed, 24 Apr 2019 22:46:57 +0000 (15:46 -0700)] 
t7610: unsuppress output

The output for commands used to be suppressed by redirecting both stdout
and stderr to /dev/null. However, this should not happen since the
output is useful for debugging and, without the "-v" flag, test scripts
don't output anyway.

Unsuppress the output by removing the redirections to /dev/null.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agot/perf: depend on perl JSON only when using --codespeed
Jeff King [Tue, 23 Apr 2019 04:34:20 +0000 (00:34 -0400)] 
t/perf: depend on perl JSON only when using --codespeed

Commit 05eb1c37ed (perf/aggregate: implement codespeed JSON output,
2018-01-05) added a dependency on the perl JSON module to show output
from aggregate.perl, but we only need it when the user asks for
--codespeed output. While the module is pretty common, it's not part of
the base system, and this dependency can get in the way of producing the
default human-readable output.

Let's bump the "use" down to a "require" in the code path that needs it,
which will be interpreted at run-time instead of compile-time. People
not using "--codespeed" won't even load the module, and anybody using it
should see the same results (including the same perl error if they don't
have it).

Note that this skips the importing step, so we'll have to fully qualify
our function call. We could accomplish the same thing in other ways.
E.g., calling JSON->import() ourselves, or wrapping "use JSON" in an
eval. Since there's only one such call, this seems like the
least-magical way of doing it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agodoc/ls-files: put nested list for "-t" option into block
Jeff King [Mon, 22 Apr 2019 15:15:41 +0000 (11:15 -0400)] 
doc/ls-files: put nested list for "-t" option into block

The description for the "-t" option contains a sub-list of all of the
possible file status outputs. But because of the newline separating that
list from the description paragraph, asciidoc treats the sub-list
entries as a continuation of the overall options list, rather than as
children of the "-t" description.

We could fix it by adding a "+" before the sub-list to connect it to the
rest of the "-t" text. But using a pair of "--" to delimit the block is
perhaps more readable, and may have better compatibility with
asciidoctor, as in 39a869b2f2 (Documentation/rev-list-options: wrap
--date=<format> block with "--", 2019-03-30).

The extra blank line comes from 5bc0e247c4 (Document ls-files -t as
semi-obsolete., 2010-07-28), but the problem actually seems older than
that. Before then, we did:

  -t:: some text...
    H:: cached
    M:: unmerged
    etc...

but asciidoc also treats that as one big list. So this problem seems to
have been around forever.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agop5302: create the repo in each index-pack test
Jeff King [Mon, 22 Apr 2019 21:19:52 +0000 (17:19 -0400)] 
p5302: create the repo in each index-pack test

The p5302 script runs "index-pack --stdin" in each timing test. It does
two things to try to get good timings:

  1. we do the repo creation in a separate (non-timed) setup test, so
     that our timing is purely the index-pack run

  2. we use a separate repo for each test; this is important because the
     presence of existing objects in the repo influences the result
     (because we'll end up doing collision checks against them)

But this forgets one thing: we generally run each timed test multiple
times to reduce the impact of noise. Which means that repeats of each
test after the first will be subject to the collision slowdown from
point 2, and we'll generally just end up taking the first time anyway.

Instead, let's create the repo in the test (effectively undoing point
1). That does add a constant amount of extra work to each iteration, but
it's quite small compared to the actual effects we're interested in
measuring.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoMakefile: dedup list of files obtained from ls-files
Junio C Hamano [Sun, 21 Apr 2019 13:19:04 +0000 (22:19 +0900)] 
Makefile: dedup list of files obtained from ls-files

Since 33533975 ("Makefile: ask "ls-files" to list source files if
available", 2011-10-18), we optionally asked "ls-files" to list the
source files that ought to exist, as a faster approximation for
"find" on working tree files.

This works reasonably well, except that it ends up listing the same
path multiple times if the index is unmerged.  Because the original
use of this construct was to name files to run etags over, and the
etags command happily takes the same filename multiple times without
causing any harm, there was no problem (other than perhaps spending
slightly more cycles, but who cares how fast the TAGS file gets
updated).

We however recently added a similar call to "ls-files" to list *.h
files, instead of using "find", in 92b88eba ("Makefile: use `git
ls-files` to list header files, if possible", 2019-03-04).  In this
new use of "ls-files", the resulting list $(LIB_H) is used for,
among other things, generating the header files to run hdr-check
target, and the duplicate unfortunately becomes a true problem.  It
causes $(MAKE) to notice that there are multiple %.hco targets and
complain.

Let the resulting list consumed by $(sort), which deduplicates,
to fix this.

Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoThe sixth batch
Junio C Hamano [Mon, 22 Apr 2019 02:14:24 +0000 (11:14 +0900)] 
The sixth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoMerge branch 'da/smerge'
Junio C Hamano [Mon, 22 Apr 2019 02:14:48 +0000 (11:14 +0900)] 
Merge branch 'da/smerge'

"git mergetool" learned to offer Sublime Merge (smerge) as one of
its backends.

* da/smerge:
  contrib/completion: add smerge to the mergetool completion candidates
  mergetools: add support for smerge (Sublime Merge)

5 years agoMerge branch 'dl/flex-str-cocci'
Junio C Hamano [Mon, 22 Apr 2019 02:14:47 +0000 (11:14 +0900)] 
Merge branch 'dl/flex-str-cocci'

Code clean-up.

* dl/flex-str-cocci:
  cocci: FLEX_ALLOC_MEM to FLEX_ALLOC_STR
  midx.c: convert FLEX_ALLOC_MEM to FLEX_ALLOC_STR

5 years agoMerge branch 'js/spell-out-options-in-tests'
Junio C Hamano [Mon, 22 Apr 2019 02:14:47 +0000 (11:14 +0900)] 
Merge branch 'js/spell-out-options-in-tests'

The tests have been updated not to rely on the abbreviated option
names the parse-options API offers, to protect us from an
abbreviated form of an option that used to be unique within the
command getting non-unique when a new option that share the same
prefix is added.

* js/spell-out-options-in-tests:
  tests: disallow the use of abbreviated options (by default)
  tests (pack-objects): use the full, unabbreviated `--revs` option
  tests (status): spell out the `--find-renames` option in full
  tests (push): do not abbreviate the `--follow-tags` option
  t5531: avoid using an abbreviated option
  t7810: do not abbreviate `--no-exclude-standard` nor `--invert-match`
  tests (rebase): spell out the `--force-rebase` option
  tests (rebase): spell out the `--keep-empty` option

5 years agoMerge branch 'nd/read-tree-reset-doc'
Junio C Hamano [Mon, 22 Apr 2019 02:14:47 +0000 (11:14 +0900)] 
Merge branch 'nd/read-tree-reset-doc'

The documentation for "git read-tree --reset -u" has been updated.

* nd/read-tree-reset-doc:
  read-tree.txt: clarify --reset and worktree changes

5 years agoMerge branch 'nd/interpret-trailers-docfix'
Junio C Hamano [Mon, 22 Apr 2019 02:14:47 +0000 (11:14 +0900)] 
Merge branch 'nd/interpret-trailers-docfix'

Doc update.

* nd/interpret-trailers-docfix:
  interpret-trailers.txt: start the desc line with a capital letter

5 years agoMerge branch 'sg/asciidoctor-in-ci'
Junio C Hamano [Mon, 22 Apr 2019 02:14:46 +0000 (11:14 +0900)] 
Merge branch 'sg/asciidoctor-in-ci'

Update our support to format documentation in the CI environment,
either with AsciiDoc ro Asciidoctor.

* sg/asciidoctor-in-ci:
  ci: fix AsciiDoc/Asciidoctor stderr check in the documentation build job
  ci: stick with Asciidoctor v1.5.8 for now
  ci: install Asciidoctor in 'ci/install-dependencies.sh'
  Documentation/technical/protocol-v2.txt: fix formatting
  Documentation/technical/api-config.txt: fix formatting
  Documentation/git-diff-tree.txt: fix formatting

5 years agoMerge branch 'tz/asciidoctor-fixes'
Junio C Hamano [Mon, 22 Apr 2019 02:14:46 +0000 (11:14 +0900)] 
Merge branch 'tz/asciidoctor-fixes'

Doc updates.

* tz/asciidoctor-fixes:
  Documentation/git-status: fix titles in porcelain v2 section
  Documentation/rev-list-options: wrap --date=<format> block with "--"

5 years agoMerge branch 'js/check-docs-exe'
Junio C Hamano [Mon, 22 Apr 2019 02:14:46 +0000 (11:14 +0900)] 
Merge branch 'js/check-docs-exe'

Dev support update.

* js/check-docs-exe:
  check-docs: fix for setups where executables have an extension
  check-docs: do not expect guide pages to correspond to commands
  check-docs: really look at the documented commands again
  docs: do not document the `git remote-testgit` command
  docs: move gitremote-helpers into section 7

5 years agoMerge branch 'nd/include-if-wildmatch'
Junio C Hamano [Mon, 22 Apr 2019 02:14:45 +0000 (11:14 +0900)] 
Merge branch 'nd/include-if-wildmatch'

A buglet in configuration parser has been fixed.

* nd/include-if-wildmatch:
  config: correct '**' matching in includeIf patterns

5 years agoMerge branch 'cb/doco-mono'
Junio C Hamano [Mon, 22 Apr 2019 02:14:45 +0000 (11:14 +0900)] 
Merge branch 'cb/doco-mono'

Clean-up markup in the documentation suite.

* cb/doco-mono:
  doc: format pathnames and URLs as monospace.
  doc/CodingGuidelines: URLs and paths as monospace

5 years agoMerge branch 'tg/stash-in-c-show-default-to-p-fix'
Junio C Hamano [Mon, 22 Apr 2019 02:14:45 +0000 (11:14 +0900)] 
Merge branch 'tg/stash-in-c-show-default-to-p-fix'

A regression fix.

* tg/stash-in-c-show-default-to-p-fix:
  stash: setup default diff output format if necessary

5 years agoMerge branch 'js/stash-in-c-pathspec-fix'
Junio C Hamano [Mon, 22 Apr 2019 02:14:44 +0000 (11:14 +0900)] 
Merge branch 'js/stash-in-c-pathspec-fix'

Further fixes to "git stash" reimplemented in C.

* js/stash-in-c-pathspec-fix:
  stash: pass pathspec as pointer
  built-in stash: handle :(glob) pathspecs again
  legacy stash: fix "rudimentary backport of -q"

5 years agoMerge branch 'tb/stash-in-c-unused-param-fix'
Junio C Hamano [Mon, 22 Apr 2019 02:14:44 +0000 (11:14 +0900)] 
Merge branch 'tb/stash-in-c-unused-param-fix'

Code clean-up.

* tb/stash-in-c-unused-param-fix:
  stash: drop unused parameter

5 years agoMerge branch 'ps/stash-in-c'
Junio C Hamano [Mon, 22 Apr 2019 02:14:43 +0000 (11:14 +0900)] 
Merge branch 'ps/stash-in-c'

"git stash" rewritten in C.

* ps/stash-in-c: (28 commits)
  tests: add a special setup where stash.useBuiltin is off
  stash: optionally use the scripted version again
  stash: add back the original, scripted `git stash`
  stash: convert `stash--helper.c` into `stash.c`
  stash: replace all `write-tree` child processes with API calls
  stash: optimize `get_untracked_files()` and `check_changes()`
  stash: convert save to builtin
  stash: make push -q quiet
  stash: convert push to builtin
  stash: convert create to builtin
  stash: convert store to builtin
  stash: convert show to builtin
  stash: convert list to builtin
  stash: convert pop to builtin
  stash: convert branch to builtin
  stash: convert drop and clear to builtin
  stash: convert apply to builtin
  stash: mention options in `show` synopsis
  stash: add tests for `git stash show` config
  stash: rename test cases to be more descriptive
  ...

5 years agoclone: do faster object check for partial clones
Josh Steadmon [Fri, 19 Apr 2019 21:00:13 +0000 (14:00 -0700)] 
clone: do faster object check for partial clones

For partial clones, doing a full connectivity check is wasteful; we skip
promisor objects (which, for a partial clone, is all known objects), and
enumerating them all to exclude them from the connectivity check can
take a significant amount of time on large repos.

At most, we want to make sure that we get the objects referred to by any
wanted refs. For partial clones, just check that these objects were
transferred.

Signed-off-by: Josh Steadmon <steadmon@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoworktree: update is_bare heuristics
Jonathan Tan [Fri, 19 Apr 2019 17:21:28 +0000 (10:21 -0700)] 
worktree: update is_bare heuristics

When "git branch -D <name>" is run, Git usually first checks if that
branch is currently checked out. But this check is not performed if the
Git directory of that repository is not at "<repo>/.git", which is the
case if that repository is a submodule that has its Git directory stored
as "super/.git/modules/<repo>", for example. This results in the branch
being deleted even though it is checked out.

This is because get_main_worktree() in worktree.c sets is_bare on a
worktree only using the heuristic that a repo is bare if the worktree's
path does not end in "/.git", and not bare otherwise. This is_bare code
was introduced in 92718b7438 ("worktree: add details to the worktree
struct", 2015-10-08), following a pre-core.bare heuristic. This patch
does 2 things:

 - Teach get_main_worktree() to use is_bare_repository() instead,
   introduced in 7d1864ce67 ("Introduce is_bare_repository() and
   core.bare configuration variable", 2007-01-07) and updated in
   e90fdc39b6 ("Clean up work-tree handling", 2007-08-01). This solves
   the "git branch -D <name>" problem described above. However...

 - If a repository has core.bare=1 but the "git" command is being run
   from one of its secondary worktrees, is_bare_repository() returns
   false (which is fine, since there is a worktree available). However,
   treating the main worktree as non-bare when it is bare causes issues:
   for example, failure to delete a branch from a secondary worktree
   that is referred to by a main worktree's HEAD, even if that main
   worktree is bare.

   In order to avoid that, also check core.bare when setting is_bare. If
   core.bare=1, trust it, and otherwise, use is_bare_repository().

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agorebase -i: run without forking rebase--interactive
Phillip Wood [Wed, 17 Apr 2019 14:30:44 +0000 (15:30 +0100)] 
rebase -i: run without forking rebase--interactive

When the builtin rebase starts an interactive rebase it parses the
options and then repackages them and forks
`rebase--interactive`. Separate the option parsing in
cmd_rebase__interactive() from the business logic to allow interactive
rebases can be run without forking `rebase__interactive` by calling
run_rebase_interactive() directly.

Starting interactive rebases without forking makes it easy to debug
the sequencer without worrying about attaching to child
processes. Ævar has also reported that some of the rebase perf tests
are 30% faster [1].

This patch also makes it easy to remove cmd_rebase__interactive() in
the future when git-legacy-rebase.sh and
git-rebase--preserve-merges.sh are retired.

[1] https://public-inbox.org/git/87y359cfjj.fsf@evledraar.gmail.com/

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agorebase: use a common action enum
Phillip Wood [Wed, 17 Apr 2019 14:30:43 +0000 (15:30 +0100)] 
rebase: use a common action enum

cmd_rebase() and cmd_rebase__interactive() used different enums to hold
the current action. Change to using a common enum so the values are the
same when we change `rebase -i` to avoid forking `rebase--interactive`.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agorebase -i: use struct rebase_options in do_interactive_rebase()
Phillip Wood [Wed, 17 Apr 2019 14:30:42 +0000 (15:30 +0100)] 
rebase -i: use struct rebase_options in do_interactive_rebase()

All the parameters that are passed to do_interactive_rebase() apart from
`flags` are already in `struct rebase_options` so there is no need to
pass them separately.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agorebase -i: use struct rebase_options to parse args
Phillip Wood [Wed, 17 Apr 2019 14:30:41 +0000 (15:30 +0100)] 
rebase -i: use struct rebase_options to parse args

In order to run `rebase -i` without forking `rebase--interactive` it
will be convenient to use the same structure when parsing the options in
cmd_rebase() and cmd_rebase__interactive().

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agorebase -i: use struct object_id for squash_onto
Phillip Wood [Wed, 17 Apr 2019 14:30:40 +0000 (15:30 +0100)] 
rebase -i: use struct object_id for squash_onto

More preparation for using `struct rebase_options` in
cmd_rebase__interactive(). Using a string was a hangover from the
scripted version of rebase, update the functions that use `squash_onto`
to take a `sturct object_id`.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agorebase -i: use struct commit when parsing options
Phillip Wood [Wed, 17 Apr 2019 14:30:39 +0000 (15:30 +0100)] 
rebase -i: use struct commit when parsing options

This is in preparation for using `struct rebase_options` when parsing
options in cmd_rebase__interactive(). Using a string for onto,
restrict_revision and upstream, was a hangover from the scripted version
of rebase. The functions that use these variables are updated to take a
`struct commit`.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agorebase -i: remove duplication
Phillip Wood [Wed, 17 Apr 2019 14:30:38 +0000 (15:30 +0100)] 
rebase -i: remove duplication

path_state_dir() and merge_dir() refer to the same path so remove one of
them.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agorebase -i: combine rebase--interactive.c with rebase.c
Phillip Wood [Wed, 17 Apr 2019 14:30:37 +0000 (15:30 +0100)] 
rebase -i: combine rebase--interactive.c with rebase.c

In order to run `rebase -i` without forking `rebase--interactive` it
will be convenient to have all the code from rebase--interactive.c in
rebase.c. This is a straight forward copy of the code from
rebase--interactive.c, it will be simplified slightly in the next
commit.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agorebase: use OPT_RERERE_AUTOUPDATE()
Phillip Wood [Wed, 17 Apr 2019 14:30:36 +0000 (15:30 +0100)] 
rebase: use OPT_RERERE_AUTOUPDATE()

As we have a macro for this it makes sense to use it. Having
cmd_rebase() and cmd_rebase__interactive() use the same values for
this option will be helpful when we start running interactive rebases
without forking rebase--interactive.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agorebase: rename write_basic_state()
Phillip Wood [Wed, 17 Apr 2019 14:30:35 +0000 (15:30 +0100)] 
rebase: rename write_basic_state()

This clashes with a function in sequencer.c

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agorebase: don't translate trace strings
Phillip Wood [Wed, 17 Apr 2019 14:30:34 +0000 (15:30 +0100)] 
rebase: don't translate trace strings

commit b3a5d5a80c ("trace2:data: add subverb for rebase", 2019-02-22)
mistakenly marked the subverb names for translation and unnecessarily
NULL terminated the array.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agosequencer: always discard index after checkout
Phillip Wood [Tue, 19 Mar 2019 19:03:07 +0000 (19:03 +0000)] 
sequencer: always discard index after checkout

As the checkout runs in a separate process our index will be out of date
so it should be discarded. The existing callers are not doing this
consistently so do it here to avoid the callers having to worry about
it.

This fixes some test failures that happen if do_interactive_rebase() is
called without forking rebase--interactive which we will implement
shortly. Running

  git rebase -i master topic

starting on master created empty todo lists because all the commits in
topic were marked as cherry-picks. After topic was checked out in
prepare_branch_to_be_rebased() the working tree contained the contents
from topic but the index contained master and the cache entries were
still valid. This meant that diff_populate_filespec() which loads the
blobs when calculating patch-id's ended up reading the contents for
master from the working tree which actually contained topic.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoMerge branch 'ag/sequencer-reduce-rewriting-todo' into pw/rebase-i-internal
Junio C Hamano [Thu, 21 Mar 2019 03:10:40 +0000 (12:10 +0900)] 
Merge branch 'ag/sequencer-reduce-rewriting-todo' into pw/rebase-i-internal

* ag/sequencer-reduce-rewriting-todo:
  rebase--interactive: move transform_todo_file()
  sequencer: use edit_todo_list() in complete_action()
  rebase-interactive: rewrite edit_todo_list() to handle the initial edit
  rebase-interactive: append_todo_help() changes
  rebase-interactive: use todo_list_write_to_file() in edit_todo_list()
  sequencer: refactor skip_unnecessary_picks() to work on a todo_list
  rebase--interactive: move rearrange_squash_in_todo_file()
  rebase--interactive: move sequencer_add_exec_commands()
  sequencer: change complete_action() to use the refactored functions
  sequencer: make sequencer_make_script() write its script to a strbuf
  sequencer: refactor rearrange_squash() to work on a todo_list
  sequencer: refactor sequencer_add_exec_commands() to work on a todo_list
  sequencer: refactor check_todo_list() to work on a todo_list
  sequencer: introduce todo_list_write_to_file()
  sequencer: refactor transform_todos() to work on a todo_list
  sequencer: remove the 'arg' field from todo_item
  sequencer: make the todo_list structure public
  sequencer: changes in parse_insn_buffer()

5 years agountracked-cache: simplify parsing by dropping "len"
Jeff King [Thu, 18 Apr 2019 21:18:35 +0000 (17:18 -0400)] 
untracked-cache: simplify parsing by dropping "len"

The code which parses untracked-cache extensions from disk keeps a "len"
variable, which is the size of the string we are parsing. But since we
now have an "end of string" variable, we can just use that to get the
length when we need it. This eliminates the need to keep "len" up to
date (and removes the possibility of any errors where "len" and "eos"
get out of sync).

As a bonus, it means we are not storing a string length in an "int",
which is a potential source of overflows (though in this case it seems
fairly unlikely for that to cause any memory problems).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agountracked-cache: simplify parsing by dropping "next"
Jeff King [Thu, 18 Apr 2019 21:17:38 +0000 (17:17 -0400)] 
untracked-cache: simplify parsing by dropping "next"

When we parse an on-disk untracked cache, we have two pointers, "data"
and "next". As we parse, we point "next" to the end of an element, and
then later update "data" to match.

But we actually don't need two pointers. Each parsing step can just
update "data" directly from other variables we hold (and we don't have
to worry about bailing in an intermediate state, since any parsing
failure causes us to immediately discard "data" and return).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agountracked-cache: be defensive about missing NULs in index
Jeff King [Thu, 18 Apr 2019 21:17:02 +0000 (17:17 -0400)] 
untracked-cache: be defensive about missing NULs in index

The on-disk format for the untracked-cache extension contains
NUL-terminated filenames. We parse these from the mmap'd file using
string functions like strlen(). This works fine in the normal case, but
if we see a malformed or corrupted index, we might read off the end of
our mmap.

Instead, let's use memchr() to find the trailing NUL within the bytes we
know are available, and return an error if it's missing.

Note that we can further simplify by folding another range check into
our conditional. After we find the end of the string, we set "next" to
the byte after the string and treat it as an error if there are no such
bytes left. That saves us from having to do a range check at the
beginning of each subsequent string (and works because there is always
data after each string). We can do both range checks together by
checking "!eos" (we didn't find a NUL) and "eos == end" (it was on the
last available byte, meaning there's nothing after). This replaces the
existing "next > end" checks.

Note also that the decode_varint() calls have a similar problem (we
don't even pass them "end"; they just keep parsing). These are probably
OK in practice since varints have a finite length (we stop parsing when
we'd overflow a uintmax_t), so the worst case is that we'd overflow into
reading the trailing bytes of the index.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agot5304: add a test for pruning with bitmaps
Jeff King [Thu, 18 Apr 2019 20:08:27 +0000 (16:08 -0400)] 
t5304: add a test for pruning with bitmaps

Commit fde67d6896 (prune: use bitmaps for reachability traversal,
2019-02-13) uses bitmaps for pruning when they're available, but only
covers this functionality in the t/perf tests. This makes a kind of
sense, since the point is that the behaviour is indistinguishable before
and after the patch, just faster.

But since the bitmap code path is not exercised at all in the regular
test suite, it leaves us open to a regression where the behavior does in
fact change. The most thorough way to test that would be running the
whole suite with bitmaps enabled. But we don't yet have a way to do
that, and anyway it's expensive to do so. Let's at least add a basic
test that exercises this path and make sure we prune an object we should
(and not one that we shouldn't).

That would hopefully catch the most obvious breakages early.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoTurn `git serve` into a test helper
Johannes Schindelin [Thu, 18 Apr 2019 13:16:51 +0000 (06:16 -0700)] 
Turn `git serve` into a test helper

The `git serve` built-in was introduced in ed10cb952d31 (serve:
introduce git-serve, 2018-03-15) as a backend to serve Git protocol v2,
probably originally intended to be spawned by `git upload-pack`.

However, in the version that the protocol v2 patches made it into core
Git, `git upload-pack` calls the `serve()` function directly instead of
spawning `git serve`; The only reason in life for `git serve` to survive
as a built-in command is to provide a way to test the protocol v2
functionality.

Meaning that it does not even have to be a built-in that is installed
with end-user facing Git installations, but it can be a test helper
instead.

Let's make it so.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agotest-tool: handle the `-C <directory>` option just like `git`
Johannes Schindelin [Thu, 18 Apr 2019 13:16:49 +0000 (06:16 -0700)] 
test-tool: handle the `-C <directory>` option just like `git`

In preparation for moving `git serve` into `test-tool` (because it
really is only used by the test suite), we teach the `test-tool` the
useful trick to change the working directory before running the test
command, which will avoid introducing subshells in the test code.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agocheck-docs: do not bother checking for legacy scripts' documentation
Johannes Schindelin [Thu, 18 Apr 2019 13:16:46 +0000 (06:16 -0700)] 
check-docs: do not bother checking for legacy scripts' documentation

In the recent years, there has been a big push to convert more and more
of Git's commands that are implemented as scripts to built-ins written
in pure, portable C, for robustness, speed and portability.

One strategy that served us well is to convert those scripts
incrementally, starting by renaming the scripts to
`git-legacy-<command>`, then introducing a built-in that does nothing
else at first than checking the config setting `<command>.useBuiltin`
(which defaults to `false` at the outset) and handing off to the legacy
script if so asked.

Obviously, those `git-legacy-<command>` commands share the documentation
with the built-in `git-<command>`, and are not intended to be called
directly anyway. So let's not try to ensure that they are documented
separately from their built-in versions.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agodocs: exclude documentation for commands that have been excluded
Johannes Schindelin [Thu, 18 Apr 2019 13:16:44 +0000 (06:16 -0700)] 
docs: exclude documentation for commands that have been excluded

When building with certain build options, some commands are excluded
from the build. For example, `git-credential-cache` is skipped when
building with `NO_UNIX_SOCKETS`.

Let's not build or package documentation for those excluded commands.

This issue was pointed out rightfully when running `make check-docs` on
Windows, where we do not yet have Unix sockets, and therefore the
`credential-cache` command is excluded (yet its documentation was built
and shipped).

Note: building the documentation via `make -C Documentation` leaves the
build system with no way to determine which commands have been
excluded. If called thusly, we gracefully fail to exclude their
documentation. Only when building the documentation via the top-level
Makefile will it get excluded properly, or after building
`Documentation/GIT-EXCLUDED-PROGRAMS` manually.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agocheck-docs: allow command-list.txt to contain excluded commands
Johannes Schindelin [Thu, 18 Apr 2019 13:16:42 +0000 (06:16 -0700)] 
check-docs: allow command-list.txt to contain excluded commands

Among other things, the `check-docs` target ensures that
`command-list.txt` no longer contains commands that were dropped (or
that were never added in the first place).

To do so, it compares the list of commands from that file to the
commands listed in `$(ALL_COMMANDS)`.

However, some build options exclude commands from the latter. Fix the
target to handle this situation correctly by taking the just-introduced
`$(EXCLUDED_PROGRAMS)` into account.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agohelp -a: do not list commands that are excluded from the build
Johannes Schindelin [Thu, 18 Apr 2019 13:16:40 +0000 (06:16 -0700)] 
help -a: do not list commands that are excluded from the build

When built with NO_CURL or with NO_UNIX_SOCKETS, some commands are
skipped from the build. It does not make sense to list them in the
output of `git help -a`, so let's just not.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoMakefile: drop the NO_INSTALL variable
Johannes Schindelin [Thu, 18 Apr 2019 13:16:39 +0000 (06:16 -0700)] 
Makefile: drop the NO_INSTALL variable

The last user was just removed; There is no longer any need to carry it
around. Should we ever run into a need for it again, it is easy enough
to revert this commit.

It is unlikely, though, that we need `NO_INSTALL` again: as we saw with
the just-removed item, `git-remote-testgit`, we have better locations
to put executables and scripts that we do not want to install, e.g.
a subdirectory in `t/`, or `contrib/`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoautoconf: #include <libintl.h> when checking for gettext()
Vadim Kochan [Thu, 18 Apr 2019 05:04:19 +0000 (08:04 +0300)] 
autoconf: #include <libintl.h> when checking for gettext()

Some libc implementations like uclibc or musl provides
gettext stubs via libintl library but this case is not checked
by AC_CHECK_LIB(c, gettext ...) because gcc has gettext as builtin
which passess the check.

So check it with included libintl.h where gettext may unfold into
libintl_gettext which will cause check to fail if libintl_gettext are
needed to be linked with -lintl.

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agocherry-pick/revert: add scissors line on merge conflict
Denton Liu [Wed, 17 Apr 2019 10:23:30 +0000 (11:23 +0100)] 
cherry-pick/revert: add scissors line on merge conflict

Fix a bug where the scissors line is placed after the Conflicts:
section, in the case where a merge conflict occurs and
commit.cleanup = scissors.

Helped-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agosequencer.c: save and restore cleanup mode
Phillip Wood [Wed, 17 Apr 2019 10:23:29 +0000 (11:23 +0100)] 
sequencer.c: save and restore cleanup mode

If the user specifies an explicit cleanup mode then save and restore it
so that it is preserved by 'git cherry-pick --continue'.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agomerge: add scissors line on merge conflict
Denton Liu [Wed, 17 Apr 2019 10:23:28 +0000 (11:23 +0100)] 
merge: add scissors line on merge conflict

This fixes a bug where the scissors line is placed after the Conflicts:
section, in the case where a merge conflict occurs and
commit.cleanup = scissors.

Next, if commit.cleanup = scissors is specified, don't produce a
scissors line in commit if one already exists in the MERGE_MSG file.

Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agomerge: cleanup messages like commit
Denton Liu [Wed, 17 Apr 2019 10:23:27 +0000 (11:23 +0100)] 
merge: cleanup messages like commit

This change allows git-merge messages to be cleaned up with the
commit.cleanup configuration or --cleanup option, just like how
git-commit does it.

We also give git-pull the option of --cleanup so that it can also take
advantage of this change.

Finally, add testing to ensure that messages are properly cleaned up.
Note that some newlines that were added to the commit message were
removed so that if a file were read via -F, it would be copied
faithfully.

Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoparse-options.h: extract common --cleanup option
Denton Liu [Wed, 17 Apr 2019 10:23:26 +0000 (11:23 +0100)] 
parse-options.h: extract common --cleanup option

The --cleanup option is commonly used. Extract it so that its definition
is not repeated.

Helped-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agocommit: extract cleanup_mode functions to sequencer
Denton Liu [Wed, 17 Apr 2019 10:23:25 +0000 (11:23 +0100)] 
commit: extract cleanup_mode functions to sequencer

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agot7502: clean up style
Denton Liu [Wed, 17 Apr 2019 10:23:24 +0000 (11:23 +0100)] 
t7502: clean up style

Refactor out Git commands that were upstream of a pipe. Remove spaces
after "> ". Indent here-docs appropriately. Convert echo chains to use
the test_write_lines function. Refactor 'sign off' test to use test_cmp
instead of comparing variables.

Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Helped-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agot7604: clean up style
Denton Liu [Wed, 17 Apr 2019 10:23:23 +0000 (11:23 +0100)] 
t7604: clean up style

Before, we had some Git commands which were upstream of the pipe. This
meant that if it produced an error, it would've gone unnoticed. Refactor
to place Git commands on their own.

Also, while we're at it, remove spaces after redirection operators.

Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Helped-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agot3507: clean up style
Denton Liu [Wed, 17 Apr 2019 10:23:22 +0000 (11:23 +0100)] 
t3507: clean up style

Remove space after redirection operators for style. Also, remove a git
command which was upstream of a pipe. Finally, let grep and sed open
their own input instead of letting the shell redirect the input.

Helped-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agot7600: clean up style
Denton Liu [Wed, 17 Apr 2019 10:23:21 +0000 (11:23 +0100)] 
t7600: clean up style

Clean up the 'merge --squash c3 with c7' test by removing some
unnecessary braces and removing a pipe.

Also, generally cleanup style by unindenting a here-doc, removing stray
spaces after a redirection operator and allowing sed to open its own
input instead of redirecting input from the shell.

Helped-by: SZEDER Gábor <szeder.dev@gmail.com>
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agosequencer: fix cleanup with --signoff and -x
Phillip Wood [Fri, 29 Mar 2019 11:08:42 +0000 (11:08 +0000)] 
sequencer: fix cleanup with --signoff and -x

Before commit 356ee4659b ("sequencer: try to commit without forking 'git
commit'", 2017-11-24) when --signoff or -x were given on the command
line the commit message was cleaned up with --cleanup=space or
commit.cleanup if it was set. Unfortunately this behavior was lost when
I implemented committing without forking. Fix this and add some tests to
catch future regressions.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoclone: send server options when using protocol v2
Jonathan Tan [Fri, 12 Apr 2019 19:51:22 +0000 (12:51 -0700)] 
clone: send server options when using protocol v2

Commit 5e3548ef16 ("fetch: send server options when using protocol v2",
2018-04-24) taught "fetch" the ability to send server options when using
protocol v2, but not "clone". This ability is triggered by "-o" or
"--server-option".

Teach "clone" the same ability, except that because "clone" already
has "-o" for another parameter, teach "clone" only to receive
"--server-option".

Explain in the documentation, both for clone and for fetch, that server
handling of server options are server-specific. This is similar to
receive-pack's handling of push options - currently, they are just sent
to hooks to interpret as they see fit.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agotransport: die if server options are unsupported
Jonathan Tan [Fri, 12 Apr 2019 19:51:21 +0000 (12:51 -0700)] 
transport: die if server options are unsupported

Server options were added in commit 5e3548ef16 ("fetch: send server
options when using protocol v2", 2018-04-24), supported only for
protocol version 2. But if the user specifies server options, and the
protocol version being used doesn't support them, the server options are
silently ignored.

Teach any transport users to die instead in this situation, just like
how "push" dies if push options are provided when the server doesn't
support them.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoref-filter: use correct branch for %(push:track)
Damien Robert [Tue, 16 Apr 2019 12:16:46 +0000 (14:16 +0200)] 
ref-filter: use correct branch for %(push:track)

In ref-filter.c, when processing the atom %(push:track), the
ahead/behind values are computed using `stat_tracking_info` which refers
to the upstream branch.

Fix that by introducing a new flag `for_push` in `stat_tracking_info`
in remote.c, which does the same thing but for the push branch.
Update the few callers of `stat_tracking_info` to handle this flag. This
ensure that whenever we use this function in the future, we are careful
to specify is this should apply to the upstream or the push branch.

This bug was not detected in t/t6300-for-each-ref.sh because in the test
for push:track, both the upstream and the push branches were behind by 1
from the local branch. Change the test so that the upstream branch is
behind by 1 while the push branch is ahead by 1. This allows us to test
that %(push:track) refers to the correct branch.

This changes the expected value of some following tests (by introducing
new references), so update them too.

Signed-off-by: Damien Robert <damien.olivier.robert+git@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agofix cherry-pick/revert status after commit
Phillip Wood [Tue, 16 Apr 2019 10:18:42 +0000 (11:18 +0100)] 
fix cherry-pick/revert status after commit

If the user commits a conflict resolution using `git commit` in the
middle of a sequence of cherry-picks/reverts then `git status` missed
the fact that a cherry-pick/revert is still in progress.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agocommit/reset: try to clean up sequencer state
Phillip Wood [Tue, 16 Apr 2019 10:18:41 +0000 (11:18 +0100)] 
commit/reset: try to clean up sequencer state

When cherry-picking or reverting a sequence of commits and if the final
pick/revert has conflicts and the user uses `git commit` to commit the
conflict resolution and does not run `git cherry-pick --continue` then
the sequencer state is left behind. This can cause problems later. In my
case I cherry-picked a sequence of commits the last one of which I
committed with `git commit` after resolving some conflicts, then a while
later, on a different branch I aborted a revert which rewound my HEAD to
the end of the cherry-pick sequence on the previous branch. Avoid this
potential problem by removing the sequencer state if we're committing or
resetting the final pick in a sequence.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoThe fifth batch
Junio C Hamano [Tue, 16 Apr 2019 10:33:35 +0000 (19:33 +0900)] 
The fifth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoMerge branch 'sg/t5318-cleanup'
Junio C Hamano [Tue, 16 Apr 2019 10:28:12 +0000 (19:28 +0900)] 
Merge branch 'sg/t5318-cleanup'

Code cleanup.

* sg/t5318-cleanup:
  t5318-commit-graph: remove unused variable

5 years agoMerge branch 'jt/t5551-protocol-v2-does-not-have-half-auth'
Junio C Hamano [Tue, 16 Apr 2019 10:28:12 +0000 (19:28 +0900)] 
Merge branch 'jt/t5551-protocol-v2-does-not-have-half-auth'

Test update.

* jt/t5551-protocol-v2-does-not-have-half-auth:
  t5551: mark half-auth no-op fetch test as v0-only

5 years agoMerge branch 'jk/http-walker-status-fix'
Junio C Hamano [Tue, 16 Apr 2019 10:28:11 +0000 (19:28 +0900)] 
Merge branch 'jk/http-walker-status-fix'

dumb-http walker has been updated to share more error recovery
strategy with the normal codepath.

* jk/http-walker-status-fix:
  http: use normalize_curl_result() instead of manual conversion
  http: normalize curl results for dumb loose and alternates fetches
  http: factor out curl result code normalization

5 years agoMerge branch 'jh/midx-verify-too-many-packs'
Junio C Hamano [Tue, 16 Apr 2019 10:28:11 +0000 (19:28 +0900)] 
Merge branch 'jh/midx-verify-too-many-packs'

"git multi-pack-index verify" did not scale well with the number of
packfiles, which is being improved.

* jh/midx-verify-too-many-packs:
  midx: during verify group objects by packfile to speed verification
  midx: add progress indicators in multi-pack-index verify
  trace2:data: add trace2 data to midx
  progress: add sparse mode to force 100% complete message

5 years agoMerge branch 'bb/unicode-12'
Junio C Hamano [Tue, 16 Apr 2019 10:28:11 +0000 (19:28 +0900)] 
Merge branch 'bb/unicode-12'

Unicode update.

* bb/unicode-12:
  unicode: update the width tables to Unicode 12

5 years agoMerge branch 'jk/refs-double-abort'
Junio C Hamano [Tue, 16 Apr 2019 10:28:11 +0000 (19:28 +0900)] 
Merge branch 'jk/refs-double-abort'

A corner case bug in the refs API has been corrected.

* jk/refs-double-abort:
  refs/files-backend: don't look at an aborted transaction
  refs/files-backend: handle packed transaction prepare failure