]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
3 years agolog_tree_diff: get rid of extra check for NULL
Sergey Organov [Fri, 28 Aug 2020 11:05:26 +0000 (14:05 +0300)] 
log_tree_diff: get rid of extra check for NULL

Get rid of needless check of 'parents' for NULL. The NULL case
is already handled right above, and 'parents' is dereferenced
without check below anyway.

Signed-off-by: Sergey Organov <sorganov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agolog_tree_diff: get rid of code duplication for first_parent_only
Sergey Organov [Fri, 28 Aug 2020 11:05:25 +0000 (14:05 +0300)] 
log_tree_diff: get rid of code duplication for first_parent_only

Handle first_parent_only by breaking from generic loop early
rather than by duplicating (part of) the loop body.

Signed-off-by: Sergey Organov <sorganov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoThirteenth batch
Junio C Hamano [Thu, 3 Sep 2020 19:23:59 +0000 (12:23 -0700)] 
Thirteenth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'pb/doc-external-diff-env'
Junio C Hamano [Thu, 3 Sep 2020 19:37:09 +0000 (12:37 -0700)] 
Merge branch 'pb/doc-external-diff-env'

Doc update.

* pb/doc-external-diff-env:
  git.txt: correct stale 'GIT_EXTERNAL_DIFF' description

3 years agoMerge branch 'jk/xrealloc-avoid-use-after-free'
Junio C Hamano [Thu, 3 Sep 2020 19:37:08 +0000 (12:37 -0700)] 
Merge branch 'jk/xrealloc-avoid-use-after-free'

It was possible for xrealloc() to send a non-NULL pointer that has
been freed, which has been fixed.

* jk/xrealloc-avoid-use-after-free:
  xrealloc: do not reuse pointer freed by zero-length realloc()

3 years agoMerge branch 'jc/post-checkout-doc'
Junio C Hamano [Thu, 3 Sep 2020 19:37:07 +0000 (12:37 -0700)] 
Merge branch 'jc/post-checkout-doc'

Doc update.

* jc/post-checkout-doc:
  doc: clarify how exit status of post-checkout hook is used

3 years agoMerge branch 'pb/doc-sequence-editor-configuration'
Junio C Hamano [Thu, 3 Sep 2020 19:37:06 +0000 (12:37 -0700)] 
Merge branch 'pb/doc-sequence-editor-configuration'

Doc update.

* pb/doc-sequence-editor-configuration:
  doc: mention GIT_SEQUENCE_EDITOR and 'sequence.editor' more

3 years agoMerge branch 'hl/bisect-doc-clarify-bad-good-ordering'
Junio C Hamano [Thu, 3 Sep 2020 19:37:06 +0000 (12:37 -0700)] 
Merge branch 'hl/bisect-doc-clarify-bad-good-ordering'

Doc update.

* hl/bisect-doc-clarify-bad-good-ordering:
  bisect: swap command-line options in documentation

3 years agoMerge branch 'so/pretty-abbrev-doc'
Junio C Hamano [Thu, 3 Sep 2020 19:37:05 +0000 (12:37 -0700)] 
Merge branch 'so/pretty-abbrev-doc'

Documentation update for "--no-abbrev-commit".

* so/pretty-abbrev-doc:
  pretty-options.txt: fix --no-abbrev-commit description

3 years agoMerge branch 'mr/diff-hide-stat-wo-textual-change'
Junio C Hamano [Thu, 3 Sep 2020 19:37:05 +0000 (12:37 -0700)] 
Merge branch 'mr/diff-hide-stat-wo-textual-change'

"git diff --stat -w" showed 0-line changes for paths whose changes
were only whitespaces, which was not intuitive.  We now omit such
paths from the stat output.

* mr/diff-hide-stat-wo-textual-change:
  diff: teach --stat to ignore uninteresting modifications

3 years agoMerge branch 'jt/lazy-fetch'
Junio C Hamano [Thu, 3 Sep 2020 19:37:04 +0000 (12:37 -0700)] 
Merge branch 'jt/lazy-fetch'

Updates to on-demand fetching code in lazily cloned repositories.

* jt/lazy-fetch:
  fetch: no FETCH_HEAD display if --no-write-fetch-head
  fetch-pack: remove no_dependents code
  promisor-remote: lazy-fetch objects in subprocess
  fetch-pack: do not lazy-fetch during ref iteration
  fetch: only populate existing_refs if needed
  fetch: avoid reading submodule config until needed
  fetch: allow refspecs specified through stdin
  negotiator/noop: add noop fetch negotiator

3 years agoMerge branch 'jc/run-command-use-embedded-args'
Junio C Hamano [Thu, 3 Sep 2020 19:37:03 +0000 (12:37 -0700)] 
Merge branch 'jc/run-command-use-embedded-args'

Various callers of run_command API has been modernized.

* jc/run-command-use-embedded-args:
  run_command: teach API users to use embedded 'args' more

3 years agoMerge branch 'jc/undash-in-tree-git-callers'
Junio C Hamano [Thu, 3 Sep 2020 19:37:03 +0000 (12:37 -0700)] 
Merge branch 'jc/undash-in-tree-git-callers'

A handful of places in in-tree code still relied on being able to
execute the git subcommands, especially built-ins, in "git-foo"
form, which have been corrected.

* jc/undash-in-tree-git-callers:
  credential-cache: use child_process.args
  cvsexportcommit: do not run git programs in dashed form
  transport-helper: do not run git-remote-ext etc. in dashed form

3 years agoMerge branch 'jk/slimmed-down'
Junio C Hamano [Thu, 3 Sep 2020 19:37:02 +0000 (12:37 -0700)] 
Merge branch 'jk/slimmed-down'

Trim an unused binary and turn a bunch of commands into built-in.

* jk/slimmed-down:
  drop vcs-svn experiment
  make git-fast-import a builtin
  make git-bugreport a builtin
  make credential helpers builtins
  Makefile: drop builtins from MSVC pdb list

3 years agoMerge branch 'pw/add-p-allowed-options-fix'
Junio C Hamano [Thu, 3 Sep 2020 19:37:02 +0000 (12:37 -0700)] 
Merge branch 'pw/add-p-allowed-options-fix'

"git add -p" update.

* pw/add-p-allowed-options-fix:
  add -p: fix checking of user input
  add -p: use ALLOC_GROW_BY instead of ALLOW_GROW

3 years agoMerge branch 'jt/fetch-pack-loosen-validation-with-packfile-uri'
Junio C Hamano [Thu, 3 Sep 2020 19:37:01 +0000 (12:37 -0700)] 
Merge branch 'jt/fetch-pack-loosen-validation-with-packfile-uri'

Bugfix for "git fetch" when the packfile URI capability is in use.

* jt/fetch-pack-loosen-validation-with-packfile-uri:
  fetch-pack: make packfile URIs work with transfer.fsckobjects
  fetch-pack: document only_packfile in get_pack()
  (various): document from_promisor parameter

3 years agoMerge branch 'ss/t7401-modernize'
Junio C Hamano [Thu, 3 Sep 2020 19:37:01 +0000 (12:37 -0700)] 
Merge branch 'ss/t7401-modernize'

Test clean-up.

* ss/t7401-modernize:
  t7401: add a NEEDSWORK
  t7401: change indentation for enhanced readability
  t7401: change syntax of test_i18ncmp calls for clarity
  t7401: use 'short' instead of 'verify' and cut in rev-parse calls
  t7401: modernize style

3 years agoMerge branch 'pw/rebase-i-more-options'
Junio C Hamano [Thu, 3 Sep 2020 19:37:01 +0000 (12:37 -0700)] 
Merge branch 'pw/rebase-i-more-options'

"git rebase -i" learns a bit more options.

* pw/rebase-i-more-options:
  t3436: do not run git-merge-recursive in dashed form
  rebase: add --reset-author-date
  rebase -i: support --ignore-date
  rebase -i: support --committer-date-is-author-date
  am: stop exporting GIT_COMMITTER_DATE
  rebase -i: add --ignore-whitespace flag

3 years agofetch: no FETCH_HEAD display if --no-write-fetch-head
Jonathan Tan [Wed, 2 Sep 2020 21:05:39 +0000 (14:05 -0700)] 
fetch: no FETCH_HEAD display if --no-write-fetch-head

887952b8c6 ("fetch: optionally allow disabling FETCH_HEAD update",
2020-08-18) introduced the ability to disable writing to FETCH_HEAD
during fetch, but did not suppress the "<source> -> FETCH_HEAD" message
when this ability is used. This message is misleading in this case,
because FETCH_HEAD is not written. Also, because "fetch" is used to
lazy-fetch missing objects in a partial clone, this significantly
clutters up the output in that case since the objects to be fetched are
potentially numerous.

Therefore, suppress this message when --no-write-fetch-head is passed
(but not when --dry-run is set).

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoxrealloc: do not reuse pointer freed by zero-length realloc()
Jeff King [Wed, 2 Sep 2020 07:54:39 +0000 (03:54 -0400)] 
xrealloc: do not reuse pointer freed by zero-length realloc()

This patch fixes a bug where xrealloc(ptr, 0) can double-free and
corrupt the heap on some platforms (including at least glibc).

The C99 standard says of malloc (section 7.20.3):

  If the size of the space requested is zero, the behavior is
  implementation-defined: either a null pointer is returned, or the
  behavior is as if the size were some nonzero value, except that the
  returned pointer shall not be used to access an object.

So we might get NULL back, or we might get an actual pointer (but we're
not allowed to look at its contents). To simplify our code, our
xmalloc() handles a NULL return by converting it into a single-byte
allocation. That way callers get consistent behavior. This was done way
back in 4e7a2eccc2 (?alloc: do not return NULL when asked for zero
bytes, 2005-12-29).

We also gave xcalloc() and xrealloc() the same treatment. And according
to C99, that is fine; the text above is in a paragraph that applies to
all three. But what happens to the memory we passed to realloc() in such
a case? I.e., if we do:

  ret = realloc(ptr, 0);

and "ptr" is non-NULL, but we get NULL back, is "ptr" still valid? C99
doesn't cover this case specifically, but says (section 7.20.3.4):

  The realloc function deallocates the old object pointed to by ptr and
  returns a pointer to a new object that has the size specified by size.

So "ptr" is now deallocated, and we must only look at "ret". And since
"ret" is NULL, that means we have no allocated object at all. But that's
not quite the whole story. It also says:

  If memory for the new object cannot be allocated, the old object is
  not deallocated and its value is unchanged.
  [...]
  The realloc function returns a pointer to the new object (which may
  have the same value as a pointer to the old object), or a null pointer
  if the new object could not be allocated.

So if we see a NULL return with a non-zero size, we can expect that the
original object _is_ still valid. But with a non-zero size, it's
ambiguous. The NULL return might mean a failure (in which case the
object is valid), or it might mean that we successfully allocated
nothing, and used NULL to represent that.

The glibc manpage for realloc() explicitly says:

  [...]if size is equal to zero, and ptr is not NULL, then the call is
  equivalent to free(ptr).

Likewise, this StackOverflow answer:

  https://stackoverflow.com/a/2135302

claims that C89 gave similar guidance (but I don't have a copy to verify
it). A comment on this answer:

  https://stackoverflow.com/a/2022410

claims that Microsoft's CRT behaves the same.

But our current "retry with 1 byte" code passes the original pointer
again. So on glibc, we effectively free() the pointer and then try to
realloc() it again, which is undefined behavior.

The simplest fix here is to just pass "ret" (which we know to be NULL)
to the follow-up realloc(). But that means that a system which _doesn't_
free the original pointer would leak it. It's not clear if any such
systems exist, and that interpretation of the standard seems unlikely
(I'd expect a system that doesn't deallocate to simply return the
original pointer in this case). But it's easy enough to err on the safe
side, and just never pass a zero size to realloc() at all.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogit.txt: correct stale 'GIT_EXTERNAL_DIFF' description
Philippe Blain [Tue, 1 Sep 2020 13:20:12 +0000 (13:20 +0000)] 
git.txt: correct stale 'GIT_EXTERNAL_DIFF' description

In fde97d8ac6 (Update documentation to remove incorrect GIT_DIFF_OPTS
example., 2006-11-27), the description of the 'GIT_EXTERNAL_DIFF'
variable was moved from 'diff-format.txt' to 'git.txt', and the
documentation was updated to remove a 'diff(1)' invocation since Git did
not use an external diff program anymore by default.

However, the description of 'GIT_EXTERNAL_DIFF' still mentions "instead
of the diff invocation described above", which is confusing.

Correct that outdated sentence.

Also, link to git(1) in 'diff-generate-patch.txt' when GIT_DIFF_OPTS and
GIT_EXTERNAL_DIFF are mentioned, so that users can easily know what
these variables are about.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoTwelfth batch
Junio C Hamano [Mon, 31 Aug 2020 22:00:05 +0000 (15:00 -0700)] 
Twelfth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'ps/ref-transaction-hook'
Junio C Hamano [Mon, 31 Aug 2020 22:49:52 +0000 (15:49 -0700)] 
Merge branch 'ps/ref-transaction-hook'

Code simplification by removing ineffective optimization.

* ps/ref-transaction-hook:
  refs: remove lookup cache for reference-transaction hook

3 years agoMerge branch 'jk/rev-input-given-fix'
Junio C Hamano [Mon, 31 Aug 2020 22:49:52 +0000 (15:49 -0700)] 
Merge branch 'jk/rev-input-given-fix'

Feeding "$ZERO_OID" to "git log --ignore-missing --stdin", and
running "git log --ignore-missing $ZERO_OID" fell back to start
digging from HEAD; it has been corrected to become a no-op, like
"git log --tags=no-tag-matches-this-pattern" does.

* jk/rev-input-given-fix:
  revision: set rev_input_given in handle_revision_arg()

3 years agoMerge branch 'jc/ident-whose-ident'
Junio C Hamano [Mon, 31 Aug 2020 22:49:51 +0000 (15:49 -0700)] 
Merge branch 'jc/ident-whose-ident'

Error message update.

* jc/ident-whose-ident:
  ident: say whose identity is missing when giving user.name hint

3 years agoMerge branch 'rp/apply-cached-doc'
Junio C Hamano [Mon, 31 Aug 2020 22:49:51 +0000 (15:49 -0700)] 
Merge branch 'rp/apply-cached-doc'

The description of --cached/--index options in "git apply --help"
has been updated.

* rp/apply-cached-doc:
  git-apply.txt: update descriptions of --cached, --index

3 years agoMerge branch 'rs/checkout-no-overlay-pathspec-fix'
Junio C Hamano [Mon, 31 Aug 2020 22:49:50 +0000 (15:49 -0700)] 
Merge branch 'rs/checkout-no-overlay-pathspec-fix'

"git restore/checkout --no-overlay" with wildcarded pathspec
mistakenly removed matching paths in subdirectories, which has been
corrected.

* rs/checkout-no-overlay-pathspec-fix:
  checkout, restore: make pathspec recursive

3 years agoMerge branch 'al/bisect-first-parent'
Junio C Hamano [Mon, 31 Aug 2020 22:49:49 +0000 (15:49 -0700)] 
Merge branch 'al/bisect-first-parent'

Finishing touches.

* al/bisect-first-parent:
  bisect: add first-parent option to documentation

3 years agoMerge branch 'jk/refspecs-cleanup'
Junio C Hamano [Mon, 31 Aug 2020 22:49:48 +0000 (15:49 -0700)] 
Merge branch 'jk/refspecs-cleanup'

Preliminary code clean-up before introducing "negative refspec".

* jk/refspecs-cleanup:
  refspec: make sure stack refspec_item variables are zeroed
  refspec: fix documentation referring to refspec_item

3 years agoMerge branch 'hn/refs-pseudorefs'
Junio C Hamano [Mon, 31 Aug 2020 22:49:48 +0000 (15:49 -0700)] 
Merge branch 'hn/refs-pseudorefs'

Accesses to two pseudorefs have been updated to properly use ref
API.

* hn/refs-pseudorefs:
  sequencer: treat REVERT_HEAD as a pseudo ref
  builtin/commit: suggest update-ref for pseudoref removal
  sequencer: treat CHERRY_PICK_HEAD as a pseudo ref
  refs: make refs_ref_exists public

3 years agoMerge branch 'jk/index-pack-w-more-threads'
Junio C Hamano [Mon, 31 Aug 2020 22:49:48 +0000 (15:49 -0700)] 
Merge branch 'jk/index-pack-w-more-threads'

Long ago, we decided to use 3 threads by default when running the
index-pack task in parallel, which has been adjusted a bit upwards.

* jk/index-pack-w-more-threads:
  index-pack: adjust default threading cap
  p5302: count up to online-cpus for thread tests
  p5302: disable thread-count parameter tests by default

3 years agoMerge branch 'hv/ref-filter-trailers-atom-parsing-fix'
Junio C Hamano [Mon, 31 Aug 2020 22:49:47 +0000 (15:49 -0700)] 
Merge branch 'hv/ref-filter-trailers-atom-parsing-fix'

The parser for "git for-each-ref --format=..." was too loose when
parsing the "%(trailers...)" atom, and forgot that "trailers" and
"trailers:<modifiers>" are the only two allowed forms, which has
been corrected.

* hv/ref-filter-trailers-atom-parsing-fix:
  ref-filter: 'contents:trailers' show error if `:` is missing
  t6300: unify %(trailers) and %(contents:trailers) tests

3 years agoMerge branch 'jt/promisor-pack-fix'
Junio C Hamano [Mon, 31 Aug 2020 22:49:46 +0000 (15:49 -0700)] 
Merge branch 'jt/promisor-pack-fix'

Updates into a lazy/partial clone with a submodule did not work
well with transfer.fsckobjects set.

* jt/promisor-pack-fix:
  fetch-pack: in partial clone, pass --promisor

3 years agoMerge branch 'dd/diff-customize-index-line-abbrev'
Junio C Hamano [Mon, 31 Aug 2020 22:49:46 +0000 (15:49 -0700)] 
Merge branch 'dd/diff-customize-index-line-abbrev'

The output from the "diff" family of the commands had abbreviated
object names of blobs involved in the patch, but its length was not
affected by the --abbrev option.  Now it is.

* dd/diff-customize-index-line-abbrev:
  diff: index-line: respect --abbrev in object's name
  t4013: improve diff-post-processor logic

3 years agoMerge branch 'am/ci-wsfix'
Junio C Hamano [Mon, 31 Aug 2020 22:49:46 +0000 (15:49 -0700)] 
Merge branch 'am/ci-wsfix'

Aesthetic fix to a CI configuration file.

* am/ci-wsfix:
  ci: fix inconsistent indentation

3 years agodoc: mention GIT_SEQUENCE_EDITOR and 'sequence.editor' more
Philippe Blain [Mon, 31 Aug 2020 03:40:08 +0000 (03:40 +0000)] 
doc: mention GIT_SEQUENCE_EDITOR and 'sequence.editor' more

The environment variable `GIT_SEQUENCE_EDITOR`, and the configuration
variable 'sequence.editor', which were added in 821881d88d ("rebase -i":
support special-purpose editor to edit insn sheet, 2011-10-17), are
mentioned in the `git config` man page but not anywhere else.

Include `config/sequencer.txt` in `git-rebase.txt`, so that both the
environment variable and the configuration setting are mentioned there.

Also, add `GIT_SEQUENCE_EDITOR` to the list of environment variables
in `git(1)`.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agobisect: swap command-line options in documentation
Hugo Locurcio [Fri, 28 Aug 2020 15:31:19 +0000 (15:31 +0000)] 
bisect: swap command-line options in documentation

The positional arguments are specified in this order: "bad" then "good".
To avoid confusion, the options above the positional arguments
are now specified in the same order. They can still be specified in any
order since they're options, not positional arguments.

Signed-off-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agopo: add missing letter for French message
brian m. carlson [Thu, 27 Aug 2020 22:35:27 +0000 (22:35 +0000)] 
po: add missing letter for French message

Add the missing "e" in "de".  While it is possible in French to omit it,
that only occurs with an apostrophe and only when the next word starts
with a vowel or mute h, which is not the case here.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Acked-by: Jean-Noël Avila <jn.avila@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agodoc: clarify how exit status of post-checkout hook is used
Junio C Hamano [Thu, 27 Aug 2020 21:45:11 +0000 (14:45 -0700)] 
doc: clarify how exit status of post-checkout hook is used

Because the hook runs after the main checkout operation finishes, it
cannot affect what branch will be the current branch, what paths are
updated in the working tree, etc., which was described as "cannot
affect the outcome of 'checkout'".

However, the exit status of the hook is used as the exit status of
the 'checkout' command and is observable by anybody who spawned the
'checkout', which was missing from the documentation.  Fix this.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoEleventh batch
Junio C Hamano [Thu, 27 Aug 2020 20:57:13 +0000 (13:57 -0700)] 
Eleventh batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'hn/refs-fetch-head-is-special'
Junio C Hamano [Thu, 27 Aug 2020 21:04:49 +0000 (14:04 -0700)] 
Merge branch 'hn/refs-fetch-head-is-special'

The FETCH_HEAD is now always read from the filesystem regardless of
the ref backend in use, as its format is much richer than the
normal refs, and written directly by "git fetch" as a plain file..

* hn/refs-fetch-head-is-special:
  refs: read FETCH_HEAD and MERGE_HEAD generically
  refs: move gitdir into base ref_store
  refs: fix comment about submodule ref_stores
  refs: split off reading loose ref data in separate function

3 years agoMerge branch 'rz/complete-more-options'
Junio C Hamano [Thu, 27 Aug 2020 21:04:49 +0000 (14:04 -0700)] 
Merge branch 'rz/complete-more-options'

Command line completion (in contrib/) usually omits redundant,
deprecated and/or dangerous options from its output; it learned to
optionally include all of them.

* rz/complete-more-options:
  completion: add GIT_COMPLETION_SHOW_ALL env var
  parse-options: add --git-completion-helper-all

3 years agoMerge branch 'jk/leakfix'
Junio C Hamano [Thu, 27 Aug 2020 21:04:49 +0000 (14:04 -0700)] 
Merge branch 'jk/leakfix'

Code clean-up.

* jk/leakfix:
  submodule--helper: fix leak of core.worktree value
  config: fix leak in git_config_get_expiry_in_days()
  config: drop git_config_get_string_const()
  config: fix leaks from git_config_get_string_const()
  checkout: fix leak of non-existent branch names
  submodule--helper: use strbuf_release() to free strbufs
  clear_pattern_list(): clear embedded hashmaps

3 years agoMerge branch 'en/mem-pool'
Junio C Hamano [Thu, 27 Aug 2020 21:04:48 +0000 (14:04 -0700)] 
Merge branch 'en/mem-pool'

API update.

* en/mem-pool:
  mem-pool: use consistent pool variable name
  mem-pool: use more standard initialization and finalization
  mem-pool: add convenience functions for strdup and strndup

3 years agopretty-options.txt: fix --no-abbrev-commit description
Sergey Organov [Wed, 26 Aug 2020 14:49:23 +0000 (17:49 +0300)] 
pretty-options.txt: fix --no-abbrev-commit description

Description suggested --no-abbrev-commit negates --oneline as well as any other
option that implies --abbrev-commit. Fix it to say that it's --abbrev-commit
that is negated, not the option that implies it.

Signed-off-by: Sergey Organov <sorganov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocredential-cache: use child_process.args
Junio C Hamano [Wed, 26 Aug 2020 21:37:39 +0000 (14:37 -0700)] 
credential-cache: use child_process.args

As child_process structure has an embedded strvec args for
formulating the command line, let's use it instead of using
an out-of-line argv[] whose length needs to be maintained
correctly.

Also, when spawning a git subcommand, omit it from the command list
and instead use the .git_cmd bit in the child_process structure.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agorun_command: teach API users to use embedded 'args' more
Junio C Hamano [Wed, 26 Aug 2020 22:25:03 +0000 (15:25 -0700)] 
run_command: teach API users to use embedded 'args' more

The child_process structure has an embedded strvec for formulating
the command line argument list these days, but code that predates
the wide use of it prepared a separate char *argv[] array and
manually set the child_process.argv pointer point at it.

Teach these old-style code to lose the separate argv[] array.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocvsexportcommit: do not run git programs in dashed form
Junio C Hamano [Wed, 26 Aug 2020 19:46:50 +0000 (12:46 -0700)] 
cvsexportcommit: do not run git programs in dashed form

This ancient script runs "git-foo" all over the place, which is
OK for a scripted Porcelain in the Git suite, but asking "git" to
dispatch to subcommands is the usual way these days.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agotransport-helper: do not run git-remote-ext etc. in dashed form
Junio C Hamano [Wed, 26 Aug 2020 19:46:49 +0000 (12:46 -0700)] 
transport-helper: do not run git-remote-ext etc. in dashed form

Running it as "git remote-ext" and letting "git" dispatch to
"remote-ext" would just be fine and is more idiomatic.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot3436: do not run git-merge-recursive in dashed form
Junio C Hamano [Wed, 26 Aug 2020 21:46:23 +0000 (14:46 -0700)] 
t3436: do not run git-merge-recursive in dashed form

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agorevision: set rev_input_given in handle_revision_arg()
Jeff King [Wed, 26 Aug 2020 20:13:05 +0000 (16:13 -0400)] 
revision: set rev_input_given in handle_revision_arg()

Commit 7ba826290a (revision: add rev_input_given flag, 2017-08-02) added
a flag to rev_info to tell whether we got any revision arguments. As
explained there, this is necessary because some revision arguments may
not produce any pending traversal objects, but should still inhibit
default behaviors (e.g., a glob that matches nothing).

However, it only set the flag in the globbing code, but not for
revisions we get on the command-line or via stdin. This leads to two
problems:

  - the command-line code keeps its own separate got_rev_arg flag; this
    isn't wrong, but it's confusing and an extra maintenance burden

  - even specifically-named rev arguments might end up not adding any
    pending objects: if --ignore-missing is set, then specifying a
    missing object is a noop rather than an error.

And that leads to some user-visible bugs:

  - when deciding whether a default rev like "HEAD" should kick in, we
    check both got_rev_arg and rev_input_given. That means that
    "--ignore-missing $ZERO_OID" works on the command-line (where we set
    got_rev_arg) but not on --stdin (where we don't)

  - when rev-list decides whether it should complain that it wasn't
    given a starting point, it relies on rev_input_given. So it can't
    even get the command-line "--ignore-missing $ZERO_OID" right

Let's consistently set the flag if we got any revision argument. That
lets us clean up the redundant got_rev_arg, and fixes both of those bugs
(but note there are three new tests: we'll confirm the already working
git-log command-line case).

A few implementation notes:

  - conceptually we want to set the flag whenever handle_revision_arg()
    finds an actual revision arg ("handles" it, you might say). But it
    covers a ton of cases with early returns. Rather than annotating
    each one, we just wrap it and use its success exit-code to set the
    flag in one spot.

  - the new rev-list test is in t6018, which is titled to cover globs.
    This isn't exactly a glob, but it made sense to stick it with the
    other tests that handle the "even though we got a rev, we have no
    pending objects" case, which are globs.

  - the tests check for the oid of a missing object, which it's pretty
    clear --ignore-missing should ignore. You can see the same behavior
    with "--ignore-missing a-ref-that-does-not-exist", because
    --ignore-missing treats them both the same. That's perhaps less
    clearly correct, and we may want to change that in the future. But
    the way the code and tests here are written, we'd continue to do the
    right thing even if it does.

Reported-by: Bryan Turner <bturner@atlassian.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agorefs: remove lookup cache for reference-transaction hook
Patrick Steinhardt [Tue, 25 Aug 2020 10:35:24 +0000 (12:35 +0200)] 
refs: remove lookup cache for reference-transaction hook

When adding the reference-transaction hook, there were concerns about
the performance impact it may have on setups which do not make use of
the new hook at all. After all, it gets executed every time a reftx is
prepared, committed or aborted, which linearly scales with the number of
reference-transactions created per session. And as there are code paths
like `git push` which create a new transaction for each reference to be
updated, this may translate to calling `find_hook()` quite a lot.

To address this concern, a cache was added with the intention to not
repeatedly do negative hook lookups. Turns out this cache caused a
regression, which was fixed via e5256c82e5 (refs: fix interleaving hook
calls with reference-transaction hook, 2020-08-07). In the process of
discussing the fix, we realized that the cache doesn't really help even
in the negative-lookup case. While performance tests added to benchmark
this did show a slight improvement in the 1% range, this really doesn't
warrent having a cache. Furthermore, it's quite flaky, too. E.g. running
it twice in succession produces the following results:

Test                         master            pks-reftx-hook-remove-cache
--------------------------------------------------------------------------
1400.2: update-ref           2.79(2.16+0.74)   2.73(2.12+0.71) -2.2%
1400.3: update-ref --stdin   0.22(0.08+0.14)   0.21(0.08+0.12) -4.5%

Test                         master            pks-reftx-hook-remove-cache
--------------------------------------------------------------------------
1400.2: update-ref           2.70(2.09+0.72)   2.74(2.13+0.71) +1.5%
1400.3: update-ref --stdin   0.21(0.10+0.10)   0.21(0.08+0.13) +0.0%

One case notably absent from those benchmarks is a single executable
searching for the hook hundreds of times, which is exactly the case for
which the negative cache was added. p1400.2 will spawn a new update-ref
for each transaction and p1400.3 only has a single reference-transaction
for all reference updates. So this commit adds a third benchmark, which
performs an non-atomic push of a thousand references. This will create a
new reference transaction per reference. But even for this case, the
negative cache doesn't consistently improve performance:

Test                         master            pks-reftx-hook-remove-cache
--------------------------------------------------------------------------
1400.4: nonatomic push       6.63(6.50+0.13)   6.81(6.67+0.14) +2.7%
1400.4: nonatomic push       6.35(6.21+0.14)   6.39(6.23+0.16) +0.6%
1400.4: nonatomic push       6.43(6.31+0.13)   6.42(6.28+0.15) -0.2%

So let's just remove the cache altogether to simplify the code.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agofetch-pack: make packfile URIs work with transfer.fsckobjects
Jonathan Tan [Mon, 17 Aug 2020 19:48:20 +0000 (12:48 -0700)] 
fetch-pack: make packfile URIs work with transfer.fsckobjects

When fetching with packfile URIs and transfer.fsckobjects=1, use the
--fsck-objects instead of the --strict flag when invoking index-pack so
that links are not checked, only objects. This is because incomplete
links are expected. (A subsequent connectivity check will be done when
all the packs have been downloaded regardless of whether
transfer.fsckobjects is set.)

This is similar to 98a2ea46c2 ("fetch-pack: do not check links for
partial fetch", 2018-03-15), but for packfile URIs instead of partial
clones.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agofetch-pack: document only_packfile in get_pack()
Jonathan Tan [Mon, 17 Aug 2020 19:48:19 +0000 (12:48 -0700)] 
fetch-pack: document only_packfile in get_pack()

dd4b732df7 ("upload-pack: send part of packfile response as uri",
2020-06-10) added the "only_packfile" parameter to get_pack() but did
not document it. Add documentation.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years ago(various): document from_promisor parameter
Jonathan Tan [Mon, 17 Aug 2020 19:48:18 +0000 (12:48 -0700)] 
(various): document from_promisor parameter

88e2f9ed8e ("introduce fetch-object: fetch one promisor object",
2017-12-05) plumbed through the from_promisor parameter but did
not document it everywhere it appeared. Add the documentation.

(It also plumbed through the no_dependents parameter, but I have left
that alone because it is being removed in a commit under review [1].)

[1] https://lore.kernel.org/git/e8f16d69089a5011c355d5939c56fa53b7a1eb2d.1597184949.git.jonathantanmy@google.com/

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoTenth batch
Junio C Hamano [Mon, 24 Aug 2020 21:47:38 +0000 (14:47 -0700)] 
Tenth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'en/dir-clear'
Junio C Hamano [Mon, 24 Aug 2020 21:54:33 +0000 (14:54 -0700)] 
Merge branch 'en/dir-clear'

Leakfix with code clean-up.

* en/dir-clear:
  dir: fix problematic API to avoid memory leaks
  dir: make clear_directory() free all relevant memory

3 years agoMerge branch 'rs/patch-id-with-incomplete-line'
Junio C Hamano [Mon, 24 Aug 2020 21:54:33 +0000 (14:54 -0700)] 
Merge branch 'rs/patch-id-with-incomplete-line'

The patch-id computation did not ignore the "incomplete last line"
marker like whitespaces.

* rs/patch-id-with-incomplete-line:
  patch-id: ignore newline at end of file in diff_flush_patch_id()

3 years agoMerge branch 'dl/subtree-docs'
Junio C Hamano [Mon, 24 Aug 2020 21:54:33 +0000 (14:54 -0700)] 
Merge branch 'dl/subtree-docs'

Doc updates for subtree (in contrib/)

* dl/subtree-docs:
  contrib/subtree: document 'push' does not take '--squash'
  contrib/subtree: fix "unsure" for --message in the document

3 years agoMerge branch 'mt/checkout-entry-dead-code-removal'
Junio C Hamano [Mon, 24 Aug 2020 21:54:32 +0000 (14:54 -0700)] 
Merge branch 'mt/checkout-entry-dead-code-removal'

Code clean-up.

* mt/checkout-entry-dead-code-removal:
  checkout_entry(): remove unreachable error() call

3 years agoMerge branch 'jc/no-update-fetch-head'
Junio C Hamano [Mon, 24 Aug 2020 21:54:31 +0000 (14:54 -0700)] 
Merge branch 'jc/no-update-fetch-head'

"git fetch" learned --no-write-fetch-head option to avoid writing
the FETCH_HEAD file.

* jc/no-update-fetch-head:
  fetch: optionally allow disabling FETCH_HEAD update

3 years agoMerge branch 'ma/doc-sha-256-is-experimental'
Junio C Hamano [Mon, 24 Aug 2020 21:54:31 +0000 (14:54 -0700)] 
Merge branch 'ma/doc-sha-256-is-experimental'

The recent addition of SHA-256 support is marked as experimental in
the documentation.

* ma/doc-sha-256-is-experimental:
  Documentation: mark `--object-format=sha256` as experimental

3 years agoMerge branch 'rs/more-buffered-io'
Junio C Hamano [Mon, 24 Aug 2020 21:54:31 +0000 (14:54 -0700)] 
Merge branch 'rs/more-buffered-io'

Use more buffered I/O where we used to call many small write(2)s.

* rs/more-buffered-io:
  upload-pack: use buffered I/O to talk to rev-list
  midx: use buffered I/O to talk to pack-objects
  connected: use buffered I/O to talk to rev-list

3 years agoMerge branch 'jk/unleak-fixes'
Junio C Hamano [Mon, 24 Aug 2020 21:54:30 +0000 (14:54 -0700)] 
Merge branch 'jk/unleak-fixes'

Fix some incorrect UNLEAK() annotations.

* jk/unleak-fixes:
  ls-remote: simplify UNLEAK() usage
  stop calling UNLEAK() before die()

3 years agoMerge branch 'en/dir-nonbare-embedded'
Junio C Hamano [Mon, 24 Aug 2020 21:54:29 +0000 (14:54 -0700)] 
Merge branch 'en/dir-nonbare-embedded'

"ls-files -o" mishandled the top-level directory of another git
working tree that hangs in the current git working tree.

* en/dir-nonbare-embedded:
  dir: avoid prematurely marking nonbare repositories as matches
  t3000: fix some test description typos

3 years agoMerge branch 'ds/midx-repack-to-batch-size'
Junio C Hamano [Mon, 24 Aug 2020 21:54:28 +0000 (14:54 -0700)] 
Merge branch 'ds/midx-repack-to-batch-size'

The "--batch-size" option of "git multi-pack-index repack" command
is now used to specify that very small packfiles are collected into
one until the total size roughly exceeds it.

* ds/midx-repack-to-batch-size:
  multi-pack-index: repack batches below --batch-size

3 years agoMerge branch 'es/init-no-separate-git-dir-in-bare'
Junio C Hamano [Mon, 24 Aug 2020 21:54:28 +0000 (14:54 -0700)] 
Merge branch 'es/init-no-separate-git-dir-in-bare'

The purpose of "git init --separate-git-dir" is to initialize a
new project with the repository separate from the working tree,
or, in the case of an existing project, to move the repository
(the .git/ directory) out of the working tree. It does not make
sense to use --separate-git-dir with a bare repository for which
there is no working tree, so disallow its use with bare
repositories.

* es/init-no-separate-git-dir-in-bare:
  init: disallow --separate-git-dir with bare repository

3 years agobisect: add first-parent option to documentation
Aaron Lipman [Sat, 22 Aug 2020 20:32:03 +0000 (16:32 -0400)] 
bisect: add first-parent option to documentation

Ensure that the [--first-parent] option is listed in the output of
"git bisect -h".

Signed-off-by: Aaron Lipman <alipman88@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocheckout, restore: make pathspec recursive
René Scharfe [Sat, 22 Aug 2020 08:57:59 +0000 (10:57 +0200)] 
checkout, restore: make pathspec recursive

The pathspec given to git checkout and git restore is used with both
tree_entry_interesting (via read_tree_recursive) and match_pathspec
(via ce_path_match).  The latter effectively only supports recursive
matching regardless of the value of the pathspec flag "recursive",
which is unset here.

That causes different match results for pathspecs with wildcards, and
can lead checkout and restore in no-overlay mode to remove entries
instead of modifying them.  Enable recursive matching for both checkout
and restore to make matching consistent.

Setting the flag in checkout_main() technically also affects git switch,
but since that command doesn't accept pathspecs at all this has no
actual consequence.

Reported-by: Sergii Shkarnikov <sergii.shkarnikov@globallogic.com>
Initial-test-by: Sergii Shkarnikov <sergii.shkarnikov@globallogic.com>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoident: say whose identity is missing when giving user.name hint
Junio C Hamano [Fri, 21 Aug 2020 20:36:28 +0000 (13:36 -0700)] 
ident: say whose identity is missing when giving user.name hint

If `user.name` and `user.email` have not been configured and the
user invokes:

    git commit --author=...

without specifying the committer identity, then Git errors out with
a message asking the user to configure `user.name` and `user.email`
but doesn't tell the user which attribution was missing. This can be
confusing for a user new to Git who isn't aware of the distinction
between user, author, and committer.

Give such users a bit more help by extending the error message to
also say which attribution is expected.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoref-filter: 'contents:trailers' show error if `:` is missing
Hariom Verma [Fri, 21 Aug 2020 21:06:14 +0000 (21:06 +0000)] 
ref-filter: 'contents:trailers' show error if `:` is missing

The 'contents' atom does not show any error if used with 'trailers'
atom and colon is missing before trailers arguments.

e.g %(contents:trailersonly) works, while it shouldn't.

It is definitely not an expected behavior.

Let's fix this bug.

Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Mentored-by: Heba Waly <heba.waly@gmail.com>
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Hariom Verma <hariom18599@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agodiff: index-line: respect --abbrev in object's name
Đoàn Trần Công Danh [Fri, 21 Aug 2020 11:51:47 +0000 (18:51 +0700)] 
diff: index-line: respect --abbrev in object's name

A handful of Git's commands respect `--abbrev' for customizing length
of abbreviation of object names.

For diff-family, Git supports 2 different options for 2 different
purposes, `--full-index' for showing diff-patch object's name in full,
and `--abbrev' to customize the length of object names in diff-raw and
diff-tree header lines, without any options to customise the length of
object names in diff-patch format. When working with diff-patch format,
we only have two options, either full index, or default abbrev length.

Although, that behaviour is documented, it doesn't stop users from
trying to use `--abbrev' with the hope of customising diff-patch's
objects' name's abbreviation.

Let's allow the blob object names shown on the "index" line to be
abbreviated to arbitrary length given via the "--abbrev" option.

To preserve backward compatibility with old script that specify both
`--full-index' and `--abbrev', always show full object id
if `--full-index' is specified.

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot4013: improve diff-post-processor logic
brian m. carlson [Fri, 21 Aug 2020 11:51:46 +0000 (18:51 +0700)] 
t4013: improve diff-post-processor logic

From 72f936b1 (t4013: make test hash independent, 2020-02-07),
we started to adjust metadata of git-diff's output in order to
ignore uninteresting metadata which is dependent of underlying hash
algorithm.

However, we forgot to special case all-zero object names, which is
special for missing objects, in consequence, we could't catch
possible future bugs where object names is all-zeros including but
not limited to:
* show intend-to-add entry
* deleted entry
* diff between index and working tree with new file

We also mistakenly munged file-modes as if they were object names
abbreviated to 6 hexadecimal digits.

In addition, in the upcoming change, we would like to test for
customizing the length of abbreviated blob objects on the index line,
which is not supported by current diff-processor logic.

Let's fix the bug for all-zero object names, and file modes.
While we're at it, support abbreviation of object names up to 16 bytes.

Based-on-patch-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot6300: unify %(trailers) and %(contents:trailers) tests
Hariom Verma [Fri, 21 Aug 2020 10:11:01 +0000 (10:11 +0000)] 
t6300: unify %(trailers) and %(contents:trailers) tests

Currently, there are different tests for testing %(trailers) and
%(contents:trailers) causing redundant copy.

Its time to get rid of duplicate code.

Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Mentored-by: Heba Waly <heba.waly@gmail.com>
Signed-off-by: Hariom Verma <hariom18599@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoci: fix inconsistent indentation
Adrian Moennich [Fri, 21 Aug 2020 09:27:26 +0000 (09:27 +0000)] 
ci: fix inconsistent indentation

While YAML allows different indentation styles as long as each block
is consistent, it is rather unusual to mix different indentations in
a single file.  Adjust to use two-space indentation everywhere.

Signed-off-by: Adrian Moennich <adrian@planetcoding.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoindex-pack: adjust default threading cap
Jeff King [Fri, 21 Aug 2020 17:58:00 +0000 (13:58 -0400)] 
index-pack: adjust default threading cap

Commit b8a2486f15 (index-pack: support multithreaded delta resolving,
2012-05-06) describes an experiment that shows that setting the number
of threads for index-pack higher than 3 does not help.

I repeated that experiment using a more modern version of Git and a more
modern CPU and got different results.

Here are timings for p5302 against linux.git run on my laptop, a Core
i9-9880H with 8 cores plus hyperthreading (so online-cpus returns 16):

  5302.3: index-pack 0 threads                   256.28(253.41+2.79)
  5302.4: index-pack 1 threads                   257.03(254.03+2.91)
  5302.5: index-pack 2 threads                   149.39(268.34+3.06)
  5302.6: index-pack 4 threads                   94.96(294.10+3.23)
  5302.7: index-pack 8 threads                   68.12(339.26+3.89)
  5302.8: index-pack 16 threads                  70.90(655.03+7.21)
  5302.9: index-pack default number of threads   116.91(290.05+3.21)

You can see that wall-clock times continue to improve dramatically up to
the number of cores, but bumping beyond that (into hyperthreading
territory) does not help (and in fact hurts a little).

Here's the same experiment on a machine with dual Xeon 6230's, totaling
40 cores (80 with hyperthreading):

  5302.3: index-pack 0 threads                    310.04(302.73+6.90)
  5302.4: index-pack 1 threads                    310.55(302.68+7.40)
  5302.5: index-pack 2 threads                    178.17(304.89+8.20)
  5302.6: index-pack 5 threads                    99.53(315.54+9.56)
  5302.7: index-pack 10 threads                   72.80(327.37+12.79)
  5302.8: index-pack 20 threads                   60.68(357.74+21.66)
  5302.9: index-pack 40 threads                   58.07(454.44+67.96)
  5302.10: index-pack 80 threads                  59.81(720.45+334.52)
  5302.11: index-pack default number of threads   134.18(309.32+7.98)

The results are similar; things stop improving at 40 threads. Curiously,
going from 20 to 40 really doesn't help much, either (and increases CPU
time considerably). So that may represent an actual barrier to
parallelism, where we lose out due to context-switching and loss of
cache locality, but don't reap the wall-clock benefits due to contention
of our coarse-grained locks.

So what's a good default value? It's clear that the current cap of 3 is
too low; our default values are 42% and 57% slower than the best times
on each machine. The results on the 40-core machine imply that 20
threads is an actual barrier regardless of the number of cores, so we'll
take that as a maximum. We get the best results on these machines at
half of the online-cpus value. That's presumably a result of the
hyperthreading. That's common on multi-core Intel processors, but not
necessarily elsewhere. But if we take it as an assumption, we can
perform optimally on hyperthreaded machines and still do much better
than the status quo on other machines, as long as we never half below
the current value of 3.

So that's what this patch does.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agop5302: count up to online-cpus for thread tests
Jeff King [Fri, 21 Aug 2020 17:54:51 +0000 (13:54 -0400)] 
p5302: count up to online-cpus for thread tests

When PERF_EXTRA is enabled, p5302 checks the performance of index-pack
with various numbers of threads. This can be useful for deciding what
the default should be (which is currently capped at 3 threads based on
the results of this script).

However, we only go up to 8 threads, and modern machines may have more.
Let's get the number of CPUs from test-tool, and test various numbers of
threads between one and that maximum.

Note that the current tests aren't all identical, as we have to set
GIT_FORCE_THREADS for the --threads=1 test (which measures the overhead
of starting a single worker thread versus the "0" case of using the main
thread). To keep the loop simple, we'll keep the "0" case out of it, and
set GIT_FORCE_THREADS=1 for all of the other cases (it's a noop for all
but the "1" case, since numbers higher than 1 would always need
threads).

Note also that we could skip running "test-tool" if PERF_EXTRA isn't
set. However, there's some small value in knowing the number of threads,
so that we can mark each test as skipped in the output.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agop5302: disable thread-count parameter tests by default
Jeff King [Fri, 21 Aug 2020 17:53:39 +0000 (13:53 -0400)] 
p5302: disable thread-count parameter tests by default

The primary function of the perf suite is to detect regressions (or
improvements) between versions of Git. The only numbers we show a direct
comparison for are timings between the same test run on two different
versions.

However, it can sometimes be used to collect other information.  For
instance, p5302 runs the same index-pack operation with different thread
counts. The output doesn't directly compare these, but anybody
interested in working on index-pack can manually compare the results.

For a normal regression run of the full perf-suite, though, this incurs
a significant cost to generate numbers nobody will actually look at;
about 25% of the total time of the test suite is spent in p5302. And the
low-thread-count runs are the most expensive part of it, since they're
(unsurprisingly) not using as many threads.

Let's skip these tests by default, but make it possible for people
working on index-pack to still run them by setting an environment
variable. Rather than make this specific to p5302, let's introduce a
generic mechanism. This makes it possible to run the full suite with
every possible test if somebody really wants to burn some CPU.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot7401: add a NEEDSWORK
Shourya Shukla [Fri, 21 Aug 2020 16:59:52 +0000 (22:29 +0530)] 
t7401: add a NEEDSWORK

Add a NEEDSWORK regarding the outdated syntax and working of the test,
which may need to be improved to obtain better and desired results.

While at it, change the word 'test' to 'test script' in the test
description to avoid ambiguity.

Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Mentored-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Helped-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Shourya Shukla <shouryashukla.oo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot7401: change indentation for enhanced readability
Shourya Shukla [Fri, 21 Aug 2020 16:59:51 +0000 (22:29 +0530)] 
t7401: change indentation for enhanced readability

Change the indentation of expected outputs for enhanced readability of
the tests. Also modify the heredoc string limiter in a test which lacks
it to support the indentation change.

Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Mentored-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Taylor Blau <me@taylorr.com>
Signed-off-by: Shourya Shukla <shouryashukla.oo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot7401: change syntax of test_i18ncmp calls for clarity
Shourya Shukla [Fri, 21 Aug 2020 16:59:50 +0000 (22:29 +0530)] 
t7401: change syntax of test_i18ncmp calls for clarity

Change the test_i18ncmp syntax from 'test_i18ncmp actual expected' to
'test_i18ncmp expected actual' to align it with the convention followed
by other tests in the test script.

Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Mentored-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Signed-off-by: Shourya Shukla <shouryashukla.oo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot7401: use 'short' instead of 'verify' and cut in rev-parse calls
Shourya Shukla [Fri, 21 Aug 2020 16:59:49 +0000 (22:29 +0530)] 
t7401: use 'short' instead of 'verify' and cut in rev-parse calls

'git rev-parse' can limit the number of characters in the hash it
outputs using the '--short' option, thereby, making the 'cut' invocation
redundant. Since using '--short' implies '--verify' as well, we can
safely replace the latter with the former. This change results in the
helper functions getting the hash in the same way 'summary' gets the
hash internally.

So, avoid the unnecessary invocation to 'cut' in the helper
functions.

Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Mentored-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Signed-off-by: Shourya Shukla <shouryashukla.oo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot7401: modernize style
Shourya Shukla [Fri, 21 Aug 2020 16:59:48 +0000 (22:29 +0530)] 
t7401: modernize style

The tests in 't7401-submodule-summary.sh' were written a long time ago
and has a violation with respect to our CodingGuidelines which is,
incorrect spacing in usages of the redirection operator.

Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Mentored-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Helped-by: Denton Liu <liu.denton@gmail.com>
Helped-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Shourya Shukla <shouryashukla.oo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agosequencer: treat REVERT_HEAD as a pseudo ref
Han-Wen Nienhuys [Fri, 21 Aug 2020 16:59:37 +0000 (16:59 +0000)] 
sequencer: treat REVERT_HEAD as a pseudo ref

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agobuiltin/commit: suggest update-ref for pseudoref removal
Han-Wen Nienhuys [Fri, 21 Aug 2020 16:59:36 +0000 (16:59 +0000)] 
builtin/commit: suggest update-ref for pseudoref removal

When pseudorefs move to a different ref storage mechanism, pseudorefs no longer
can be removed with 'rm'. Instead, suggest a "update-ref -d" command, which will
work regardless of ref storage backend.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agosequencer: treat CHERRY_PICK_HEAD as a pseudo ref
Han-Wen Nienhuys [Fri, 21 Aug 2020 16:59:35 +0000 (16:59 +0000)] 
sequencer: treat CHERRY_PICK_HEAD as a pseudo ref

Check for existence and delete CHERRY_PICK_HEAD through ref functions.
This will help cherry-pick work with alternate ref storage backends.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agorefs: make refs_ref_exists public
Han-Wen Nienhuys [Fri, 21 Aug 2020 16:59:34 +0000 (16:59 +0000)] 
refs: make refs_ref_exists public

This will be necessary to replace file existence checks for pseudorefs.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogit-apply.txt: update descriptions of --cached, --index
Raymond E. Pasco [Thu, 20 Aug 2020 23:10:51 +0000 (19:10 -0400)] 
git-apply.txt: update descriptions of --cached, --index

The blurb for "--cached" says it implies "--index", but in reality
"--cached" and "--index" are distinct modes with different behavior.

Additionally, the descriptions of "--index" and "--cached" are somewhat
unclear about what might be modified, and what "--index" looks for to
determine that the index and working copy "match".

Rewrite the blurbs for both options for clarity and accuracy.

Signed-off-by: Raymond E. Pasco <ray@ameretat.dev>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agofetch-pack: in partial clone, pass --promisor
Jonathan Tan [Thu, 20 Aug 2020 17:51:16 +0000 (10:51 -0700)] 
fetch-pack: in partial clone, pass --promisor

When fetching a pack from a promisor remote, the corresponding .promisor
file needs to be created. "fetch-pack" originally did this by passing
"--promisor" to "index-pack", but in 5374a290aa ("fetch-pack: write
fetched refs to .promisor", 2019-10-16), "fetch-pack" was taught to do
this itself instead, because it needed to store ref information in the
.promisor file.

This causes a problem with superprojects when transfer.fsckobjects is
set, because in the current implementation, it is "index-pack" that
calls fsck_finish() to check the objects; before 5374a290aa,
fsck_finish() would see that .gitmodules is a promisor object and
tolerate it being missing, but after, there is no .promisor file (at the
time of the invocation of fsck_finish() by "index-pack") to tell it that
.gitmodules is a promisor object, so it returns an error.

Therefore, teach "fetch-pack" to pass "--promisor" to index pack once
again. "fetch-pack" will subsequently overwrite this file with the ref
information.

An alternative is to instead move object checking to "fetch-pack", and
let "index-pack" only index the files. However, since "index-pack" has
to inflate objects in order to index them, it seems reasonable to also
let it check the objects (which also require inflated files).

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agodiff: teach --stat to ignore uninteresting modifications
Matthew Rogers [Thu, 20 Aug 2020 00:41:32 +0000 (00:41 +0000)] 
diff: teach --stat to ignore uninteresting modifications

When options such as --ignore-space-change are in use, files with
modifications can have no interesting textual changes worth showing.  In
such cases, "git diff --stat" shows 0 lines of additions and deletions.
Teach "git diff --stat" not to show such a path in its output, which
would be more natural.

However, we don't want to prevent the display  of all files that have 0
effective diffs since they could be the result of a rename, permission
change, or other similar operation that may still be of interest so we
special case additions and deletions as they are always interesting.

Signed-off-by: Matthew Rogers <mattr94@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocompletion: add GIT_COMPLETION_SHOW_ALL env var
Ryan Zoeller [Wed, 19 Aug 2020 23:06:13 +0000 (23:06 +0000)] 
completion: add GIT_COMPLETION_SHOW_ALL env var

When set to 1, GIT_COMPLETION_SHOW_ALL causes --git-completion-helper-all
to be passed instead of --git-completion-helper.

Signed-off-by: Ryan Zoeller <rtzoeller@rtzoeller.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoparse-options: add --git-completion-helper-all
Ryan Zoeller [Wed, 19 Aug 2020 23:06:08 +0000 (23:06 +0000)] 
parse-options: add --git-completion-helper-all

--git-completion-helper excludes hidden options, such as --allow-empty
for git commit. This is typically helpful, but occasionally we want
auto-completion for obscure flags. --git-completion-helper-all returns
all options, even if they are marked as hidden or nocomplete.

Signed-off-by: Ryan Zoeller <rtzoeller@rtzoeller.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoNinth batch
Junio C Hamano [Wed, 19 Aug 2020 23:14:30 +0000 (16:14 -0700)] 
Ninth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'jh/mingw-unlink'
Junio C Hamano [Wed, 19 Aug 2020 23:14:53 +0000 (16:14 -0700)] 
Merge branch 'jh/mingw-unlink'

"unlink" emulation on MinGW has been optimized.

* jh/mingw-unlink:
  mingw: improve performance of mingw_unlink()

3 years agoMerge branch 'ds/sha256-leftover-bits'
Junio C Hamano [Wed, 19 Aug 2020 23:14:52 +0000 (16:14 -0700)] 
Merge branch 'ds/sha256-leftover-bits'

midx and commit-graph files now use the byte defined in their file
format specification for identifying the hash function used for
object names.

* ds/sha256-leftover-bits:
  multi-pack-index: use hash version byte
  commit-graph: use the "hash version" byte
  t/README: document GIT_TEST_DEFAULT_HASH

3 years agoMerge branch 'ma/sha-256-docs'
Junio C Hamano [Wed, 19 Aug 2020 23:14:52 +0000 (16:14 -0700)] 
Merge branch 'ma/sha-256-docs'

Further update of docs to adjust to the recent SHA-256 work.

* ma/sha-256-docs:
  shallow.txt: document SHA-256 shallow format
  protocol-capabilities.txt: clarify "allow-x-sha1-in-want" re SHA-256
  index-format.txt: document SHA-256 index format
  http-protocol.txt: document SHA-256 "want"/"have" format

3 years agoMerge branch 'jc/object-names-are-not-sha-1'
Junio C Hamano [Wed, 19 Aug 2020 23:14:52 +0000 (16:14 -0700)] 
Merge branch 'jc/object-names-are-not-sha-1'

A few end-user facing messages have been updated to be
hash-algorithm agnostic.

* jc/object-names-are-not-sha-1:
  messages: avoid SHA-1 in end-user facing messages

3 years agoMerge branch 'bc/sha-256-doc-updates'
Junio C Hamano [Wed, 19 Aug 2020 23:14:51 +0000 (16:14 -0700)] 
Merge branch 'bc/sha-256-doc-updates'

Further update of docs to adjust to the recent SHA-256 work.

* bc/sha-256-doc-updates:
  docs: fix step in transition plan
  docs: document SHA-256 pack and indices

3 years agoMerge branch 'pb/set-url-docfix'
Junio C Hamano [Wed, 19 Aug 2020 23:14:51 +0000 (16:14 -0700)] 
Merge branch 'pb/set-url-docfix'

Doc fix.

* pb/set-url-docfix:
  fetch, pull doc: correct description of '--set-upstream'

3 years agoMerge branch 'pb/userdiff-fortran-update'
Junio C Hamano [Wed, 19 Aug 2020 23:14:50 +0000 (16:14 -0700)] 
Merge branch 'pb/userdiff-fortran-update'

The regexp to identify the function boundary for FORTRAN programs
has been updated.

* pb/userdiff-fortran-update:
  userdiff: improve Fortran xfuncname regex
  userdiff: add tests for Fortran xfuncname regex