git/git.git
23 months agowt-status: drop unused status parameter
Jeff King [Thu, 9 May 2019 21:30:19 +0000 (17:30 -0400)]
wt-status: drop unused status parameter

The v2_fix_up_changed() function doesn't actually need to see the
wt_status struct. It's possible that could change in the future, but
this is a static-local function with one caller. It would be easy to
read-add it back then. Let's drop the unused parameter.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agoread-cache: drop unused parameter from threaded load
Jeff King [Thu, 9 May 2019 21:29:44 +0000 (17:29 -0400)]
read-cache: drop unused parameter from threaded load

The load_cache_entries_threaded() function takes a src_offset parameter
that it doesn't use. This has been there since its inception in
77ff1127a4 (read-cache: load cache entries on worker threads,
2018-10-10).

Digging on the mailing list, that parameter was part of an earlier
iteration of the series[1], but became unnecessary when the code
switched to using the IEOT extension.

[1] https://public-inbox.org/git/20180906210227.54368-5-benpeart@microsoft.com/

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agoclone: drop dest parameter from copy_alternates()
Jeff King [Thu, 9 May 2019 21:29:22 +0000 (17:29 -0400)]
clone: drop dest parameter from copy_alternates()

Ever since the inception of this function in e6baf4a1ae (clone: clone
from a repository with relative alternates, 2011-08-22), the "dest"
parameter has been unused. Instead, we use add_to_alternates_file(),
which relies on git_pathdup() to find the right file. That in turn works
because we will have initialized and entered the destination repo by
this point.

It's a bit subtle, but this is how it has always worked. And if our
assumptions change, the test in t5601 from e6baf4a1ae should let us
know.

In the meantime, let's drop this unused and confusing parameter from
copy_alternates().

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agosubmodule: drop unused prefix parameter from some functions
Jeff King [Thu, 9 May 2019 21:27:31 +0000 (17:27 -0400)]
submodule: drop unused prefix parameter from some functions

We stopped using the "prefix" parameter of
relocate_single_git_dir_into_superproject() and its callers in
202275b96b (submodule.c: get_super_prefix_or_empty, 2017-03-14), where
we switched to using the environment global directly.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agobuiltin: consistently pass cmd_* prefix to parse_options
Jeff King [Thu, 9 May 2019 21:28:51 +0000 (17:28 -0400)]
builtin: consistently pass cmd_* prefix to parse_options

If a builtin uses RUN_SETUP to request that git.c enter the repository
directory, we'll get passed in a "prefix" variable with the path to the
original directory.  It's important to pass this to parse_options(),
since we may use it to fix up relative OPT_FILENAME() options. Some
builtins don't bother; let's make sure we do so consistently.

There may not be any particular bugs fixed here; OPT_FILENAME is
actually pretty rare, and none of these commands use it directly.
However, this does future-proof us against somebody adding an option
that uses it and creating a subtle bug that only shows up when you're in
a subdirectory of the repository.

In some cases, like hash-object and upload-pack, we don't specify
RUN_SETUP, so we know the prefix will always be empty. It's still worth
passing the variable along to keep the idiom consistent across all
builtins (and of course it protects us if they ever _did_ switch to
using RUN_SETUP).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agocmd_{read,write}_tree: rename "unused" variable that is used
Jeff King [Thu, 9 May 2019 21:27:24 +0000 (17:27 -0400)]
cmd_{read,write}_tree: rename "unused" variable that is used

The "prefix" variable passed by git.c into the builtin cmd_read_tree()
and cmd_write_tree() functions is named "unused_prefix". But we do in
fact pass it to parse_options(), which may use the prefix to adjust any
filename options. Let's get rid of this confusing name.

However, we can't just call it "prefix". The reason these variables were
renamed in the first place is that they shadowed local variables named
"prefix", because these commands both take a "--prefix" option.

So let's rename the parameters, but try to reduce further confusion:

  1. In both cases we'll call them "cmd_prefix" to mark that they're
     part of the cmd_* interface.

  2. In cmd_write_tree(), we'll rename the local prefix variable to
     "tree_prefix" to make it more clear that we're talking about the
     prefix to be used for the tree we're writing.

  3. In cmd_read_tree(), the "prefix" local has since migrated into
     "struct unpack_trees_options". We'll leave that alone, as the
     context within the struct makes its meaning clear (we actually
     _could_ just call the parameter "prefix" now, but that invites
     confusion in the other direction).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoThe eighth batch
Junio C Hamano [Wed, 8 May 2019 15:37:54 +0000 (00:37 +0900)]
The eighth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'vk/autoconf-gettext'
Junio C Hamano [Wed, 8 May 2019 15:37:29 +0000 (00:37 +0900)]
Merge branch 'vk/autoconf-gettext'

The autoconf generated configure script failed to use the right
gettext() implementations from -libintl by ignoring useless stub
implementations shipped in some C library, which has been
corrected.

* vk/autoconf-gettext:
  autoconf: #include <libintl.h> when checking for gettext()

2 years agoMerge branch 'cc/aix-has-fileno-as-a-macro'
Junio C Hamano [Wed, 8 May 2019 15:37:28 +0000 (00:37 +0900)]
Merge branch 'cc/aix-has-fileno-as-a-macro'

AIX shared the same build issues with other BSDs around fileno(fp),
which has been corrected.

* cc/aix-has-fileno-as-a-macro:
  Makefile: use fileno macro work around on AIX

2 years agoMerge branch 'jt/submodule-repo-is-with-worktree'
Junio C Hamano [Wed, 8 May 2019 15:37:28 +0000 (00:37 +0900)]
Merge branch 'jt/submodule-repo-is-with-worktree'

The logic to tell if a Git repository has a working tree protects
"git branch -D" from removing the branch that is currently checked
out by mistake.  The implementation of this logic was broken for
repositories with unusual name, which unfortunately is the norm for
submodules these days.  This has been fixed.

* jt/submodule-repo-is-with-worktree:
  worktree: update is_bare heuristics

2 years agoMerge branch 'jk/untracked-cache-more-fixes'
Junio C Hamano [Wed, 8 May 2019 15:37:28 +0000 (00:37 +0900)]
Merge branch 'jk/untracked-cache-more-fixes'

Code clean-up.

* jk/untracked-cache-more-fixes:
  untracked-cache: simplify parsing by dropping "len"
  untracked-cache: simplify parsing by dropping "next"
  untracked-cache: be defensive about missing NULs in index

2 years agoMerge branch 'jk/prune-optim'
Junio C Hamano [Wed, 8 May 2019 15:37:27 +0000 (00:37 +0900)]
Merge branch 'jk/prune-optim'

A follow-up test for an earlier "git prune" improvements.

* jk/prune-optim:
  t5304: add a test for pruning with bitmaps

2 years agoMerge branch 'js/misc-doc-fixes'
Junio C Hamano [Wed, 8 May 2019 15:37:27 +0000 (00:37 +0900)]
Merge branch 'js/misc-doc-fixes'

"make check-docs", "git help -a", etc. did not account for cases
where a particular build may deliberately omit some subcommands,
which has been corrected.

* js/misc-doc-fixes:
  Turn `git serve` into a test helper
  test-tool: handle the `-C <directory>` option just like `git`
  check-docs: do not bother checking for legacy scripts' documentation
  docs: exclude documentation for commands that have been excluded
  check-docs: allow command-list.txt to contain excluded commands
  help -a: do not list commands that are excluded from the build
  Makefile: drop the NO_INSTALL variable
  remote-testgit: move it into the support directory for t5801

2 years agoMerge branch 'dr/ref-filter-push-track-fix'
Junio C Hamano [Wed, 8 May 2019 15:37:26 +0000 (00:37 +0900)]
Merge branch 'dr/ref-filter-push-track-fix'

%(push:track) token used in the --format option to "git
for-each-ref" and friends was not showing the right branch, which
has been fixed.

* dr/ref-filter-push-track-fix:
  ref-filter: use correct branch for %(push:track)

2 years agoMerge branch 'ss/msvc-path-utils-fix'
Junio C Hamano [Wed, 8 May 2019 15:37:26 +0000 (00:37 +0900)]
Merge branch 'ss/msvc-path-utils-fix'

An earlier update for MinGW and Cygwin accidentally broke MSVC build,
which has been fixed.

* ss/msvc-path-utils-fix:
  MSVC: include compat/win32/path-utils.h for MSVC, too, for real_path()

2 years agoMerge branch 'jt/clone-server-option'
Junio C Hamano [Wed, 8 May 2019 15:37:25 +0000 (00:37 +0900)]
Merge branch 'jt/clone-server-option'

"git clone" learned a new --server-option option when talking over
the protocol version 2.

* jt/clone-server-option:
  clone: send server options when using protocol v2
  transport: die if server options are unsupported

2 years agoMerge branch 'tb/unexpected'
Junio C Hamano [Wed, 8 May 2019 15:37:25 +0000 (00:37 +0900)]
Merge branch 'tb/unexpected'

Code tightening against a "wrong" object appearing where an object
of a different type is expected, instead of blindly assuming that
the connection between objects are correctly made.

* tb/unexpected:
  rev-list: detect broken root trees
  rev-list: let traversal die when --missing is not in use
  get_commit_tree(): return NULL for broken tree
  list-objects.c: handle unexpected non-tree entries
  list-objects.c: handle unexpected non-blob entries
  t: introduce tests for unexpected object types
  t: move 'hex2oct' into test-lib-functions.sh

2 years agoMerge branch 'nd/sha1-name-c-wo-the-repository'
Junio C Hamano [Wed, 8 May 2019 15:37:24 +0000 (00:37 +0900)]
Merge branch 'nd/sha1-name-c-wo-the-repository'

Further code clean-up to allow the lowest level of name-to-object
mapping layer to work with a passed-in repository other than the
default one.

* nd/sha1-name-c-wo-the-repository: (34 commits)
  sha1-name.c: remove the_repo from get_oid_mb()
  sha1-name.c: remove the_repo from other get_oid_*
  sha1-name.c: remove the_repo from maybe_die_on_misspelt_object_name
  submodule-config.c: use repo_get_oid for reading .gitmodules
  sha1-name.c: add repo_get_oid()
  sha1-name.c: remove the_repo from get_oid_with_context_1()
  sha1-name.c: remove the_repo from resolve_relative_path()
  sha1-name.c: remove the_repo from diagnose_invalid_index_path()
  sha1-name.c: remove the_repo from handle_one_ref()
  sha1-name.c: remove the_repo from get_oid_1()
  sha1-name.c: remove the_repo from get_oid_basic()
  sha1-name.c: remove the_repo from get_describe_name()
  sha1-name.c: remove the_repo from get_oid_oneline()
  sha1-name.c: add repo_interpret_branch_name()
  sha1-name.c: remove the_repo from interpret_branch_mark()
  sha1-name.c: remove the_repo from interpret_nth_prior_checkout()
  sha1-name.c: remove the_repo from get_short_oid()
  sha1-name.c: add repo_for_each_abbrev()
  sha1-name.c: store and use repo in struct disambiguate_state
  sha1-name.c: add repo_find_unique_abbrev_r()
  ...

2 years agoMerge branch 'cc/replace-graft-peel-tags'
Junio C Hamano [Wed, 8 May 2019 15:37:24 +0000 (00:37 +0900)]
Merge branch 'cc/replace-graft-peel-tags'

When given a tag that points at a commit-ish, "git replace --graft"
failed to peel the tag before writing a replace ref, which did not
make sense because the old graft mechanism the feature wants to
mimick only allowed to replace one commit object with another.
This has been fixed.

* cc/replace-graft-peel-tags:
  replace: peel tag when passing a tag first to --graft
  replace: peel tag when passing a tag as parent to --graft
  t6050: redirect expected error output to a file
  t6050: use test_line_count instead of wc -l

2 years agoMerge branch 'js/trace2-to-directory'
Junio C Hamano [Wed, 8 May 2019 15:37:24 +0000 (00:37 +0900)]
Merge branch 'js/trace2-to-directory'

The trace2 tracing facility learned to auto-generate a filename
when told to log to a directory.

* js/trace2-to-directory:
  trace2: write to directory targets

2 years agoMerge branch 'dl/merge-cleanup-scissors-fix'
Junio C Hamano [Wed, 8 May 2019 15:37:24 +0000 (00:37 +0900)]
Merge branch 'dl/merge-cleanup-scissors-fix'

The list of conflicted paths shown in the editor while concluding a
conflicted merge was shown above the scissors line when the
clean-up mode is set to "scissors", even though it was commented
out just like the list of updated paths and other information to
help the user explain the merge better.

* dl/merge-cleanup-scissors-fix:
  cherry-pick/revert: add scissors line on merge conflict
  sequencer.c: save and restore cleanup mode
  merge: add scissors line on merge conflict
  merge: cleanup messages like commit
  parse-options.h: extract common --cleanup option
  commit: extract cleanup_mode functions to sequencer
  t7502: clean up style
  t7604: clean up style
  t3507: clean up style
  t7600: clean up style

2 years agoMerge branch 'pw/sequencer-cleanup-with-signoff-x-fix'
Junio C Hamano [Wed, 8 May 2019 15:37:23 +0000 (00:37 +0900)]
Merge branch 'pw/sequencer-cleanup-with-signoff-x-fix'

"git cherry-pick" run with the "-x" or the "--signoff" option used
to (and more importantly, ought to) clean up the commit log message
with the --cleanup=space option by default, but this has been
broken since late 2017.  This has been fixed.

* pw/sequencer-cleanup-with-signoff-x-fix:
  sequencer: fix cleanup with --signoff and -x

2 years agoMerge branch 'jk/pack-objects-reports-num-objects-to-trace2'
Junio C Hamano [Wed, 8 May 2019 15:37:23 +0000 (00:37 +0900)]
Merge branch 'jk/pack-objects-reports-num-objects-to-trace2'

The "git pack-objects" command learned to report the number of
objects it packed via the trace2 mechanism.

* jk/pack-objects-reports-num-objects-to-trace2:
  pack-objects: write objects packed to trace2

2 years agoMerge branch 'tz/git-svn-doc-markup-fix'
Junio C Hamano [Wed, 8 May 2019 15:37:23 +0000 (00:37 +0900)]
Merge branch 'tz/git-svn-doc-markup-fix'

Doc formatting fix.

* tz/git-svn-doc-markup-fix:
  Documentation/git-svn: improve asciidoctor compatibility

2 years agoMerge branch 'km/empty-repo-is-still-a-repo'
Junio C Hamano [Wed, 8 May 2019 15:37:23 +0000 (00:37 +0900)]
Merge branch 'km/empty-repo-is-still-a-repo'

Running "git add" on a repository created inside the current
repository is an explicit indication that the user wants to add it
as a submodule, but when the HEAD of the inner repository is on an
unborn branch, it cannot be added as a submodule.  Worse, the files
in its working tree can be added as if they are a part of the outer
repository, which is not what the user wants.  These problems are
being addressed.

* km/empty-repo-is-still-a-repo:
  add: error appropriately on repository with no commits
  dir: do not traverse repositories with no commits
  submodule: refuse to add repository with no commits

2 years agoMerge branch 'dl/warn-tagging-a-tag'
Junio C Hamano [Wed, 8 May 2019 15:37:22 +0000 (00:37 +0900)]
Merge branch 'dl/warn-tagging-a-tag'

"git tag" learned to give an advice suggesting it might be a
mistake when creating an annotated or signed tag that points at
another tag.

* dl/warn-tagging-a-tag:
  tag: advise on nested tags
  tag: fix formatting

2 years agoMerge branch 'en/merge-directory-renames'
Junio C Hamano [Wed, 8 May 2019 15:37:22 +0000 (00:37 +0900)]
Merge branch 'en/merge-directory-renames'

"git merge-recursive" backend recently learned a new heuristics to
infer file movement based on how other files in the same directory
moved.  As this is inherently less robust heuristics than the one
based on the content similarity of the file itself (rather than
based on what its neighbours are doing), it sometimes gives an
outcome unexpected by the end users.  This has been toned down to
leave the renamed paths in higher/conflicted stages in the index so
that the user can examine and confirm the result.

* en/merge-directory-renames:
  merge-recursive: switch directory rename detection default
  merge-recursive: give callers of handle_content_merge() access to contents
  merge-recursive: track information associated with directory renames
  t6043: fix copied test description to match its purpose
  merge-recursive: switch from (oid,mode) pairs to a diff_filespec
  merge-recursive: cleanup handle_rename_* function signatures
  merge-recursive: track branch where rename occurred in rename struct
  merge-recursive: remove ren[12]_other fields from rename_conflict_info
  merge-recursive: shrink rename_conflict_info
  merge-recursive: move some struct declarations together
  merge-recursive: use 'ci' for rename_conflict_info variable name
  merge-recursive: rename locals 'o' and 'a' to 'obuf' and 'abuf'
  merge-recursive: rename diff_filespec 'one' to 'o'
  merge-recursive: rename merge_options argument from 'o' to 'opt'
  Use 'unsigned short' for mode, like diff_filespec does

2 years agoMakefile: use fileno macro work around on AIX
Clément Chigot [Thu, 18 Apr 2019 08:55:09 +0000 (08:55 +0000)]
Makefile: use fileno macro work around on AIX

Declare FILENO_IS_A_MACRO on AIX

On AIX, fileno(fp) is a macro and need to use the work around already made for BSD's.

Signed-off-by: Clément Chigot <clement.chigot@atos.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoThe seventh batch
Junio C Hamano [Thu, 25 Apr 2019 07:03:52 +0000 (16:03 +0900)]
The seventh batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'js/macos-gettext-build'
Junio C Hamano [Thu, 25 Apr 2019 07:41:25 +0000 (16:41 +0900)]
Merge branch 'js/macos-gettext-build'

Build with gettext breaks on recent macOS w/ Homebrew when
/usr/local/bin is not on PATH, which has been corrected.

* js/macos-gettext-build:
  macOS: make sure that gettext is found

2 years agoMerge branch 'bs/sendemail-tighten-anything-by'
Junio C Hamano [Thu, 25 Apr 2019 07:41:25 +0000 (16:41 +0900)]
Merge branch 'bs/sendemail-tighten-anything-by'

The recently added feature to add addresses that are on
anything-by: trailers in 'git send-email' was found to be way too
eager and considered nonsense strings as if they can be legitimate
beginning of *-by: trailer.  This has been tightened.

* bs/sendemail-tighten-anything-by:
  send-email: don't cc *-by lines with '-' prefix

2 years agoMerge branch 'bc/send-email-qp-cr'
Junio C Hamano [Thu, 25 Apr 2019 07:41:25 +0000 (16:41 +0900)]
Merge branch 'bc/send-email-qp-cr'

"git send-email" has been taught to use quoted-printable when the
payload contains carriage-return.  The use of the mechanism is in
line with the design originally added the codepath that chooses QP
when the payload has overly long lines.

* bc/send-email-qp-cr:
  send-email: default to quoted-printable when CR is present

2 years agoMerge branch 'nd/submodule-foreach-quiet'
Junio C Hamano [Thu, 25 Apr 2019 07:41:24 +0000 (16:41 +0900)]
Merge branch 'nd/submodule-foreach-quiet'

"git submodule foreach <command> --quiet" did not pass the option
down correctly, which has been corrected.

* nd/submodule-foreach-quiet:
  submodule foreach: fix "<command> --quiet" not being respected

2 years agoMerge branch 'js/iso8895-test-on-apfs'
Junio C Hamano [Thu, 25 Apr 2019 07:41:24 +0000 (16:41 +0900)]
Merge branch 'js/iso8895-test-on-apfs'

Test fix on APFS that is incapable of store paths in Latin-1.

* js/iso8895-test-on-apfs:
  t9822: skip tests if file names cannot be ISO-8859-1 encoded

2 years agoMerge branch 'jc/gettext-test-fix'
Junio C Hamano [Thu, 25 Apr 2019 07:41:23 +0000 (16:41 +0900)]
Merge branch 'jc/gettext-test-fix'

The GETTEXT_POISON test option has been quite broken ever since it
was made runtime-tunable, which has been fixed.

* jc/gettext-test-fix:
  gettext tests: export the restored GIT_TEST_GETTEXT_POISON

2 years agoMerge branch 'jk/fetch-reachability-error-fix'
Junio C Hamano [Thu, 25 Apr 2019 07:41:23 +0000 (16:41 +0900)]
Merge branch 'jk/fetch-reachability-error-fix'

Code clean-up and a fix for "git fetch" by an explicit object name
(as opposed to fetching refs by name).

* jk/fetch-reachability-error-fix:
  fetch: do not consider peeled tags as advertised tips
  remote.c: make singular free_ref() public
  fetch: use free_refs()
  pkt-line: prepare buffer before handling ERR packets
  upload-pack: send ERR packet for non-tip objects
  t5530: check protocol response for "not our ref"
  t5516: drop ok=sigpipe from unreachable-want tests

2 years agoMerge branch 'jk/xmalloc'
Junio C Hamano [Thu, 25 Apr 2019 07:41:23 +0000 (16:41 +0900)]
Merge branch 'jk/xmalloc'

The code is updated to check the result of memory allocation before
it is used in more places, by using xmalloc and/or xcalloc calls.

* jk/xmalloc:
  progress: use xmalloc/xcalloc
  xdiff: use xmalloc/xrealloc
  xdiff: use git-compat-util
  test-prio-queue: use xmalloc

2 years agoMerge branch 'km/t3000-retitle'
Junio C Hamano [Thu, 25 Apr 2019 07:41:22 +0000 (16:41 +0900)]
Merge branch 'km/t3000-retitle'

A test update.

* km/t3000-retitle:
  t3000 (ls-files -o): widen description to reflect current tests

2 years agoMerge branch 'js/untracked-cache-allocfix'
Junio C Hamano [Thu, 25 Apr 2019 07:41:22 +0000 (16:41 +0900)]
Merge branch 'js/untracked-cache-allocfix'

An underallocation in the code to read the untracked cache
extension has been corrected.

* js/untracked-cache-allocfix:
  untracked cache: fix off-by-one

2 years agoMerge branch 'js/t3301-unbreak-notes-test'
Junio C Hamano [Thu, 25 Apr 2019 07:41:21 +0000 (16:41 +0900)]
Merge branch 'js/t3301-unbreak-notes-test'

Test fix.

* js/t3301-unbreak-notes-test:
  t3301: fix false negative

2 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}

2 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

2 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

2 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

2 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`

2 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

2 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

2 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"

2 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'

2 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

2 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

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

2 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

2 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

2 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

2 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

2 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

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

2 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

2 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

2 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

2 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

2 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

2 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

2 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

2 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

2 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'

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

2 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

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

2 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

2 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

2 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

2 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

2 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

2 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 "--"

2 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

2 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

2 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

2 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

2 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"

2 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

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

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