]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
3 years agogit-stash.txt: be explicit about subcommand options
Denton Liu [Tue, 9 Feb 2021 07:28:47 +0000 (23:28 -0800)] 
git-stash.txt: be explicit about subcommand options

Currently, the options for the `list` and `show` subcommands are just
listed as `<options>`. This seems to imply, from a cursory glance at the
summary, that they take the stash options listed below. However, reading
more carefully, we see that they take log options and diff options
respectively.

Make it more obvious that they take log and diff options by explicitly
stating this in the subcommand summary.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoSync with 2.30.1
Junio C Hamano [Mon, 8 Feb 2021 22:44:42 +0000 (14:44 -0800)] 
Sync with 2.30.1

3 years agoGit 2.30.1 v2.30.1
Junio C Hamano [Mon, 8 Feb 2021 22:05:35 +0000 (14:05 -0800)] 
Git 2.30.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'pb/ci-matrix-wo-shortcut' into maint
Junio C Hamano [Mon, 8 Feb 2021 22:05:55 +0000 (14:05 -0800)] 
Merge branch 'pb/ci-matrix-wo-shortcut' into maint

Our setting of GitHub CI test jobs were a bit too eager to give up
once there is even one failure found.  Tweak the knob to allow
other jobs keep running even when we see a failure, so that we can
find more failures in a single run.

* pb/ci-matrix-wo-shortcut:
  ci: do not cancel all jobs of a matrix if one fails

3 years agoMerge branch 'pb/blame-funcname-range-userdiff' into maint
Junio C Hamano [Mon, 8 Feb 2021 22:05:55 +0000 (14:05 -0800)] 
Merge branch 'pb/blame-funcname-range-userdiff' into maint

Test fix.

* pb/blame-funcname-range-userdiff:
  annotate-tests: quote variable expansions containing path names

3 years agoMerge branch 'jk/p5303-sed-portability-fix' into maint
Junio C Hamano [Mon, 8 Feb 2021 22:05:55 +0000 (14:05 -0800)] 
Merge branch 'jk/p5303-sed-portability-fix' into maint

A perf script was made more portable.

* jk/p5303-sed-portability-fix:
  p5303: avoid sed GNU-ism

3 years agoMerge branch 'ab/branch-sort' into maint
Junio C Hamano [Mon, 8 Feb 2021 22:05:55 +0000 (14:05 -0800)] 
Merge branch 'ab/branch-sort' into maint

The implementation of "git branch --sort" wrt the detached HEAD
display has always been hacky, which has been cleaned up.

* ab/branch-sort:
  branch: show "HEAD detached" first under reverse sort
  branch: sort detached HEAD based on a flag
  ref-filter: move ref_sorting flags to a bitfield
  ref-filter: move "cmp_fn" assignment into "else if" arm
  ref-filter: add braces to if/else if/else chain
  branch tests: add to --sort tests
  branch: change "--local" to "--list" in comment

3 years agoMerge branch 'ma/more-opaque-lock-file' into maint
Junio C Hamano [Mon, 8 Feb 2021 22:05:54 +0000 (14:05 -0800)] 
Merge branch 'ma/more-opaque-lock-file' into maint

Code clean-up.

* ma/more-opaque-lock-file:
  read-cache: try not to peek into `struct {lock_,temp}file`
  refs/files-backend: don't peek into `struct lock_file`
  midx: don't peek into `struct lock_file`
  commit-graph: don't peek into `struct lock_file`
  builtin/gc: don't peek into `struct lock_file`

3 years agoMerge branch 'dl/p4-encode-after-kw-expansion' into maint
Junio C Hamano [Mon, 8 Feb 2021 22:05:54 +0000 (14:05 -0800)] 
Merge branch 'dl/p4-encode-after-kw-expansion' into maint

Text encoding fix for "git p4".

* dl/p4-encode-after-kw-expansion:
  git-p4: fix syncing file types with pattern

3 years agoMerge branch 'ar/t6016-modernise' into maint
Junio C Hamano [Mon, 8 Feb 2021 22:05:54 +0000 (14:05 -0800)] 
Merge branch 'ar/t6016-modernise' into maint

Test update.

* ar/t6016-modernise:
  t6016: move to lib-log-graph.sh framework

3 years agoMerge branch 'zh/arg-help-format' into maint
Junio C Hamano [Mon, 8 Feb 2021 22:05:54 +0000 (14:05 -0800)] 
Merge branch 'zh/arg-help-format' into maint

Clean up option descriptions in "git cmd --help".

* zh/arg-help-format:
  builtin/*: update usage format
  parse-options: format argh like error messages

3 years agoMerge branch 'ma/doc-pack-format-varint-for-sizes' into maint
Junio C Hamano [Mon, 8 Feb 2021 22:05:53 +0000 (14:05 -0800)] 
Merge branch 'ma/doc-pack-format-varint-for-sizes' into maint

Doc update.

* ma/doc-pack-format-varint-for-sizes:
  pack-format.txt: document sizes at start of delta data

3 years agoMerge branch 'ma/t1300-cleanup' into maint
Junio C Hamano [Mon, 8 Feb 2021 22:05:53 +0000 (14:05 -0800)] 
Merge branch 'ma/t1300-cleanup' into maint

Code clean-up.

* ma/t1300-cleanup:
  t1300: don't needlessly work with `core.foo` configs
  t1300: remove duplicate test for `--file no-such-file`
  t1300: remove duplicate test for `--file ../foo`

3 years agoMerge branch 'fc/t6030-bisect-reset-removes-auxiliary-files' into maint
Junio C Hamano [Mon, 8 Feb 2021 22:05:53 +0000 (14:05 -0800)] 
Merge branch 'fc/t6030-bisect-reset-removes-auxiliary-files' into maint

A 3-year old test that was not testing anything useful has been
corrected.

* fc/t6030-bisect-reset-removes-auxiliary-files:
  test: bisect-porcelain: fix location of files

3 years agoSync with maint
Junio C Hamano [Sat, 6 Feb 2021 00:41:17 +0000 (16:41 -0800)] 
Sync with maint

3 years agoThe sixth batch
Junio C Hamano [Sat, 6 Feb 2021 00:40:31 +0000 (16:40 -0800)] 
The sixth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'sg/test-stress-jobs'
Junio C Hamano [Sat, 6 Feb 2021 00:40:46 +0000 (16:40 -0800)] 
Merge branch 'sg/test-stress-jobs'

Test framework fix.

* sg/test-stress-jobs:
  test-lib: prevent '--stress-jobs=X' from being ignored

3 years agoMerge branch 'jk/weather-balloon-require-variadic-macro'
Junio C Hamano [Sat, 6 Feb 2021 00:40:46 +0000 (16:40 -0800)] 
Merge branch 'jk/weather-balloon-require-variadic-macro'

We've carried compatibility codepaths for compilers without
variadic macros for quite some time, but the world may be ready for
them to be removed.  Force compilation failure on exotic platforms
where variadic macros are not available to find out who screams in
such a way that we can easily revert if it turns out that the world
is not yet ready.

* jk/weather-balloon-require-variadic-macro:
  git-compat-util: always enable variadic macros

3 years agoMerge branch 'pb/ci-matrix-wo-shortcut'
Junio C Hamano [Sat, 6 Feb 2021 00:40:46 +0000 (16:40 -0800)] 
Merge branch 'pb/ci-matrix-wo-shortcut'

Our setting of GitHub CI test jobs were a bit too eager to give up
once there is even one failure found.  Tweak the knob to allow
other jobs keep running even when we see a failure, so that we can
find more failures in a single run.

* pb/ci-matrix-wo-shortcut:
  ci: do not cancel all jobs of a matrix if one fails

3 years agoMerge branch 'pb/blame-funcname-range-userdiff'
Junio C Hamano [Sat, 6 Feb 2021 00:40:45 +0000 (16:40 -0800)] 
Merge branch 'pb/blame-funcname-range-userdiff'

Test fix.

* pb/blame-funcname-range-userdiff:
  annotate-tests: quote variable expansions containing path names

3 years agoMerge branch 'jk/p5303-sed-portability-fix'
Junio C Hamano [Sat, 6 Feb 2021 00:40:45 +0000 (16:40 -0800)] 
Merge branch 'jk/p5303-sed-portability-fix'

A perf script was made more portable.

* jk/p5303-sed-portability-fix:
  p5303: avoid sed GNU-ism

3 years agoMerge branch 'jv/pack-objects-narrower-ref-iteration'
Junio C Hamano [Sat, 6 Feb 2021 00:40:45 +0000 (16:40 -0800)] 
Merge branch 'jv/pack-objects-narrower-ref-iteration'

The "pack-objects" command needs to iterate over all the tags when
automatic tag following is enabled, but it actually iterated over
all refs and then discarded everything outside "refs/tags/"
hierarchy, which was quite wasteful.

* jv/pack-objects-narrower-ref-iteration:
  builtin/pack-objects.c: avoid iterating all refs

3 years agoMerge branch 'ph/use-delete-refs'
Junio C Hamano [Sat, 6 Feb 2021 00:40:45 +0000 (16:40 -0800)] 
Merge branch 'ph/use-delete-refs'

When removing many branches and tags, the code used to do so one
ref at a time.  There is another API it can use to delete multiple
refs, and it makes quite a lot of performance difference when the
refs are packed.

* ph/use-delete-refs:
  use delete_refs when deleting tags or branches

3 years agoMerge branch 'tb/ls-refs-optim'
Junio C Hamano [Sat, 6 Feb 2021 00:40:45 +0000 (16:40 -0800)] 
Merge branch 'tb/ls-refs-optim'

The ls-refs protocol operation has been optimized to narrow the
sub-hierarchy of refs/ it walks to produce response.

* tb/ls-refs-optim:
  ls-refs.c: traverse prefixes of disjoint "ref-prefix" sets
  ls-refs.c: initialize 'prefixes' before using it
  refs: expose 'for_each_fullref_in_prefixes'

3 years agoMerge branch 'zh/ls-files-deduplicate'
Junio C Hamano [Sat, 6 Feb 2021 00:40:44 +0000 (16:40 -0800)] 
Merge branch 'zh/ls-files-deduplicate'

"git ls-files" can and does show multiple entries when the index is
unmerged, which is a source for confusion unless -s/-u option is in
use.  A new option --deduplicate has been introduced.

* zh/ls-files-deduplicate:
  ls-files.c: add --deduplicate option
  ls_files.c: consolidate two for loops into one
  ls_files.c: bugfix for --deleted and --modified

3 years agoMerge branch 'ds/cache-tree-basics'
Junio C Hamano [Sat, 6 Feb 2021 00:40:44 +0000 (16:40 -0800)] 
Merge branch 'ds/cache-tree-basics'

Document, clean-up and optimize the code around the cache-tree
extension in the index.

* ds/cache-tree-basics:
  cache-tree: speed up consecutive path comparisons
  cache-tree: use ce_namelen() instead of strlen()
  index-format: discuss recursion of cache-tree better
  index-format: update preamble to cache tree extension
  index-format: use 'cache tree' over 'cached tree'
  cache-tree: trace regions for prime_cache_tree
  cache-tree: trace regions for I/O
  cache-tree: use trace2 in cache_tree_update()
  unpack-trees: add trace2 regions
  tree-walk: report recursion counts

3 years agoMerge branch 'en/ort-conflict-handling'
Junio C Hamano [Sat, 6 Feb 2021 00:40:44 +0000 (16:40 -0800)] 
Merge branch 'en/ort-conflict-handling'

ORT merge strategy learns more support for merge conflicts.

* en/ort-conflict-handling:
  merge-ort: add handling for different types of files at same path
  merge-ort: copy find_first_merges() implementation from merge-recursive.c
  merge-ort: implement format_commit()
  merge-ort: copy and adapt merge_submodule() from merge-recursive.c
  merge-ort: copy and adapt merge_3way() from merge-recursive.c
  merge-ort: flesh out implementation of handle_content_merge()
  merge-ort: handle book-keeping around two- and three-way content merge
  merge-ort: implement unique_path() helper
  merge-ort: handle directory/file conflicts that remain
  merge-ort: handle D/F conflict where directory disappears due to merge

3 years agoMerge branch 'so/log-diff-merge'
Junio C Hamano [Sat, 6 Feb 2021 00:40:44 +0000 (16:40 -0800)] 
Merge branch 'so/log-diff-merge'

"git log" learned a new "--diff-merges=<how>" option.

* so/log-diff-merge: (32 commits)
  t4013: add tests for --diff-merges=first-parent
  doc/git-show: include --diff-merges description
  doc/rev-list-options: document --first-parent changes merges format
  doc/diff-generate-patch: mention new --diff-merges option
  doc/git-log: describe new --diff-merges options
  diff-merges: add '--diff-merges=1' as synonym for 'first-parent'
  diff-merges: add old mnemonic counterparts to --diff-merges
  diff-merges: let new options enable diff without -p
  diff-merges: do not imply -p for new options
  diff-merges: implement new values for --diff-merges
  diff-merges: make -m/-c/--cc explicitly mutually exclusive
  diff-merges: refactor opt settings into separate functions
  diff-merges: get rid of now empty diff_merges_init_revs()
  diff-merges: group diff-merge flags next to each other inside 'rev_info'
  diff-merges: split 'ignore_merges' field
  diff-merges: fix -m to properly override -c/--cc
  t4013: add tests for -m failing to override -c/--cc
  t4013: support test_expect_failure through ':failure' magic
  diff-merges: revise revs->diff flag handling
  diff-merges: handle imply -p on -c/--cc logic for log.c
  ...

3 years agoPrepare for 2.30.1
Junio C Hamano [Sat, 6 Feb 2021 00:30:42 +0000 (16:30 -0800)] 
Prepare for 2.30.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'js/skip-dashed-built-ins-from-config-mak' into maint
Junio C Hamano [Sat, 6 Feb 2021 00:31:28 +0000 (16:31 -0800)] 
Merge branch 'js/skip-dashed-built-ins-from-config-mak' into maint

Build fix.

* js/skip-dashed-built-ins-from-config-mak:
  SKIP_DASHED_BUILT_INS: respect `config.mak`

3 years agoMerge branch 'jt/packfile-as-uri-doc' into maint
Junio C Hamano [Sat, 6 Feb 2021 00:31:28 +0000 (16:31 -0800)] 
Merge branch 'jt/packfile-as-uri-doc' into maint

Doc fix for packfile URI feature.

* jt/packfile-as-uri-doc:
  Doc: clarify contents of packfile sent as URI

3 years agoMerge branch 'ab/fsck-doc-fix' into maint
Junio C Hamano [Sat, 6 Feb 2021 00:31:28 +0000 (16:31 -0800)] 
Merge branch 'ab/fsck-doc-fix' into maint

Documentation for "git fsck" lost stale bits that has become
incorrect.

* ab/fsck-doc-fix:
  fsck doc: remove ancient out-of-date diagnostics

3 years agoMerge branch 'jk/log-cherry-pick-duplicate-patches' into maint
Junio C Hamano [Sat, 6 Feb 2021 00:31:27 +0000 (16:31 -0800)] 
Merge branch 'jk/log-cherry-pick-duplicate-patches' into maint

When more than one commit with the same patch ID appears on one
side, "git log --cherry-pick A...B" did not exclude them all when a
commit with the same patch ID appears on the other side.  Now it
does.

* jk/log-cherry-pick-duplicate-patches:
  patch-ids: handle duplicate hashmap entries

3 years agoMerge branch 'jk/forbid-lf-in-git-url' into maint
Junio C Hamano [Sat, 6 Feb 2021 00:31:27 +0000 (16:31 -0800)] 
Merge branch 'jk/forbid-lf-in-git-url' into maint

Newline characters in the host and path part of git:// URL are
now forbidden.

* jk/forbid-lf-in-git-url:
  fsck: reject .gitmodules git:// urls with newlines
  git_connect_git(): forbid newlines in host and path

3 years agoMerge branch 'jc/macos-install-dependencies-fix' into maint
Junio C Hamano [Sat, 6 Feb 2021 00:31:26 +0000 (16:31 -0800)] 
Merge branch 'jc/macos-install-dependencies-fix' into maint

Fix for procedure to building CI test environment for mac.

* jc/macos-install-dependencies-fix:
  ci/install-depends: attempt to fix "brew cask" stuff

3 years agoMerge branch 'tb/local-clone-race-doc' into maint
Junio C Hamano [Sat, 6 Feb 2021 00:31:26 +0000 (16:31 -0800)] 
Merge branch 'tb/local-clone-race-doc' into maint

Doc update.

* tb/local-clone-race-doc:
  Documentation/git-clone.txt: document race with --local

3 years agoMerge branch 'bc/doc-status-short' into maint
Junio C Hamano [Sat, 6 Feb 2021 00:31:26 +0000 (16:31 -0800)] 
Merge branch 'bc/doc-status-short' into maint

Doc update.

* bc/doc-status-short:
  docs: rephrase and clarify the git status --short format

3 years agoMerge branch 'ab/gettext-charset-comment-fix' into maint
Junio C Hamano [Sat, 6 Feb 2021 00:31:26 +0000 (16:31 -0800)] 
Merge branch 'ab/gettext-charset-comment-fix' into maint

Comments update.

* ab/gettext-charset-comment-fix:
  gettext.c: remove/reword a mostly-useless comment
  Makefile: remove a warning about old GETTEXT_POISON flag

3 years agoMerge branch 'ug/doc-lose-dircache' into maint
Junio C Hamano [Sat, 6 Feb 2021 00:31:25 +0000 (16:31 -0800)] 
Merge branch 'ug/doc-lose-dircache' into maint

Doc update.

* ug/doc-lose-dircache:
  doc: remove "directory cache" from man pages

3 years agoMerge branch 'ad/t4129-setfacl-target-fix' into maint
Junio C Hamano [Sat, 6 Feb 2021 00:31:25 +0000 (16:31 -0800)] 
Merge branch 'ad/t4129-setfacl-target-fix' into maint

Test fix.

* ad/t4129-setfacl-target-fix:
  t4129: fix setfacl-related permissions failure

3 years agoMerge branch 'jk/t5516-deflake' into maint
Junio C Hamano [Sat, 6 Feb 2021 00:31:25 +0000 (16:31 -0800)] 
Merge branch 'jk/t5516-deflake' into maint

Test fix.

* jk/t5516-deflake:
  t5516: loosen "not our ref" error check

3 years agoMerge branch 'vv/send-email-with-less-secure-apps-access' into maint
Junio C Hamano [Sat, 6 Feb 2021 00:31:25 +0000 (16:31 -0800)] 
Merge branch 'vv/send-email-with-less-secure-apps-access' into maint

Doc update.

* vv/send-email-with-less-secure-apps-access:
  git-send-email.txt: mention less secure app access with Gmail

3 years agoMerge branch 'pb/mergetool-tool-help-fix' into maint
Junio C Hamano [Sat, 6 Feb 2021 00:31:24 +0000 (16:31 -0800)] 
Merge branch 'pb/mergetool-tool-help-fix' into maint

Fix 2.29 regression where "git mergetool --tool-help" fails to list
all the available tools.

* pb/mergetool-tool-help-fix:
  mergetool--lib: fix '--tool-help' to correctly show available tools

3 years agoMerge branch 'ds/for-each-repo-noopfix' into maint
Junio C Hamano [Sat, 6 Feb 2021 00:31:23 +0000 (16:31 -0800)] 
Merge branch 'ds/for-each-repo-noopfix' into maint

"git for-each-repo --config=<var> <cmd>" should not run <cmd> for
any repository when the configuration variable <var> is not defined
even once.

* ds/for-each-repo-noopfix:
  for-each-repo: do nothing on empty config

3 years agoMerge branch 'jc/sign-off' into maint
Junio C Hamano [Sat, 6 Feb 2021 00:31:23 +0000 (16:31 -0800)] 
Merge branch 'jc/sign-off' into maint

Doc update.

* jc/sign-off:
  SubmittingPatches: tighten wording on "sign-off" procedure

3 years agoMerge branch 'mt/t4129-with-setgid-dir' into maint
Junio C Hamano [Sat, 6 Feb 2021 00:31:22 +0000 (16:31 -0800)] 
Merge branch 'mt/t4129-with-setgid-dir' into maint

Some tests expect that "ls -l" output has either '-' or 'x' for
group executable bit, but setgid bit can be inherited from parent
directory and make these fields 'S' or 's' instead, causing test
failures.

* mt/t4129-with-setgid-dir:
  t4129: don't fail if setgid is set in the test directory

3 years agoMerge branch 'en/stash-apply-sparse-checkout' into maint
Junio C Hamano [Sat, 6 Feb 2021 00:31:22 +0000 (16:31 -0800)] 
Merge branch 'en/stash-apply-sparse-checkout' into maint

"git stash" did not work well in a sparsely checked out working
tree.

* en/stash-apply-sparse-checkout:
  stash: fix stash application in sparse-checkouts
  stash: remove unnecessary process forking
  t7012: add a testcase demonstrating stash apply bugs in sparse checkouts

3 years agoMerge branch 'nk/perf-fsmonitor-cleanup' into maint
Junio C Hamano [Sat, 6 Feb 2021 00:31:22 +0000 (16:31 -0800)] 
Merge branch 'nk/perf-fsmonitor-cleanup' into maint

Test fix.

* nk/perf-fsmonitor-cleanup:
  p7519: allow running without watchman prereq

3 years agoMerge branch 'rs/rebase-commit-validation' into maint
Junio C Hamano [Sat, 6 Feb 2021 00:31:22 +0000 (16:31 -0800)] 
Merge branch 'rs/rebase-commit-validation' into maint

Diagnose command line error of "git rebase" early.

* rs/rebase-commit-validation:
  rebase: verify commit parameter

3 years agoMerge branch 'pb/doc-modules-git-work-tree-typofix' into maint
Junio C Hamano [Sat, 6 Feb 2021 00:31:21 +0000 (16:31 -0800)] 
Merge branch 'pb/doc-modules-git-work-tree-typofix' into maint

Doc fix.

* pb/doc-modules-git-work-tree-typofix:
  gitmodules.txt: fix 'GIT_WORK_TREE' variable name

3 years agoMerge branch 'ta/doc-typofix' into maint
Junio C Hamano [Sat, 6 Feb 2021 00:31:21 +0000 (16:31 -0800)] 
Merge branch 'ta/doc-typofix' into maint

Doc fix.

* ta/doc-typofix:
  doc: fix some typos

3 years agoMerge branch 'pk/subsub-fetch-fix-take-2' into maint
Junio C Hamano [Sat, 6 Feb 2021 00:31:20 +0000 (16:31 -0800)] 
Merge branch 'pk/subsub-fetch-fix-take-2' into maint

"git fetch --recurse-submodules" fix (second attempt).

* pk/subsub-fetch-fix-take-2:
  submodules: fix of regression on fetching of non-init subsub-repo

3 years agoThe fifth batch
Junio C Hamano [Wed, 3 Feb 2021 22:56:47 +0000 (14:56 -0800)] 
The fifth batch

3 years agoMerge branch 'jk/run-command-use-shell-doc'
Junio C Hamano [Wed, 3 Feb 2021 23:04:49 +0000 (15:04 -0800)] 
Merge branch 'jk/run-command-use-shell-doc'

The .use_shell flag in struct child_process that is passed to
run_command() API has been clarified with a bit more documentation.

* jk/run-command-use-shell-doc:
  run-command: document use_shell option

3 years agoMerge branch 'jk/peel-iterated-oid'
Junio C Hamano [Wed, 3 Feb 2021 23:04:49 +0000 (15:04 -0800)] 
Merge branch 'jk/peel-iterated-oid'

The peel_ref() API has been replaced with peel_iterated_oid().

* jk/peel-iterated-oid:
  refs: switch peel_ref() to peel_iterated_oid()

3 years agoMerge branch 'js/skip-dashed-built-ins-from-config-mak'
Junio C Hamano [Wed, 3 Feb 2021 23:04:49 +0000 (15:04 -0800)] 
Merge branch 'js/skip-dashed-built-ins-from-config-mak'

Build fix.

* js/skip-dashed-built-ins-from-config-mak:
  SKIP_DASHED_BUILT_INS: respect `config.mak`

3 years agoMerge branch 'jt/packfile-as-uri-doc'
Junio C Hamano [Wed, 3 Feb 2021 23:04:49 +0000 (15:04 -0800)] 
Merge branch 'jt/packfile-as-uri-doc'

Doc fix for packfile URI feature.

* jt/packfile-as-uri-doc:
  Doc: clarify contents of packfile sent as URI

3 years agoMerge branch 'ds/maintenance-prefetch-cleanup'
Junio C Hamano [Wed, 3 Feb 2021 23:04:48 +0000 (15:04 -0800)] 
Merge branch 'ds/maintenance-prefetch-cleanup'

Test clean-up plus UI improvement by hiding extra refs that
the prefetch task uses from "log --decorate" output.

* ds/maintenance-prefetch-cleanup:
  t7900: clean up some broken refs
  maintenance: set log.excludeDecoration durin prefetch

3 years agoMerge branch 'ab/fsck-doc-fix'
Junio C Hamano [Wed, 3 Feb 2021 23:04:48 +0000 (15:04 -0800)] 
Merge branch 'ab/fsck-doc-fix'

Documentation for "git fsck" lost stale bits that has become
incorrect.

* ab/fsck-doc-fix:
  fsck doc: remove ancient out-of-date diagnostics

3 years agoannotate-tests: quote variable expansions containing path names
Johannes Sixt [Sat, 30 Jan 2021 16:22:25 +0000 (17:22 +0100)] 
annotate-tests: quote variable expansions containing path names

The test case added by 9466e3809d ("blame: enable funcname blaming with
userdiff driver", 2020-11-01) forgot to quote variable expansions. This
causes failures when the current directory contains blanks.

One variable that the test case introduces will not have IFS characters
and could remain without quotes, but let's quote all expansions for
consistency, not just the one that has the path name.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Acked-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agop5303: avoid sed GNU-ism
Jeff King [Fri, 29 Jan 2021 20:04:08 +0000 (15:04 -0500)] 
p5303: avoid sed GNU-ism

Using "1~5" isn't portable. Nobody seems to have noticed, since perhaps
people don't tend to run the perf suite on more exotic platforms. Still,
it's better to set a good example.

We can use:

  perl -ne 'print if $. % 5 == 1'

instead. But we can further observe that perl does a good job of the
other parts of this pipeline, and fold the whole thing together.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogit-compat-util: always enable variadic macros
Jeff King [Thu, 28 Jan 2021 05:28:33 +0000 (00:28 -0500)] 
git-compat-util: always enable variadic macros

We allow variadic macros in the code base, but only if there is fallback
code for platforms that lack it. This leads to some annoyances:

  - the code is more complicated because of the fallbacks (e.g.,
    trace_printf(), etc, is implemented twice with a set of parallel
    wrappers).

  - some constructs are just impossible and we've had to live without
    them (e.g., a cross between FLEX_ALLOC and xstrfmt)

Since this feature is present in C99, we may be able to start counting
on it being available everywhere. Let's start with a weather balloon
patch to find out.

This patch makes the absolute minimal change by always setting
HAVE_VARIADIC_MACROS. If somebody runs into a platform where it's a
problem, they can undo it by commenting out the define. Likewise, if we
have to revert this, it would be quite unlikely to cause conflicts.

Once we feel comfortable that this is the right direction, then we can
start ripping out all the spots that actually look at the flag, and
removing the dead code.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoci: do not cancel all jobs of a matrix if one fails
Philippe Blain [Thu, 28 Jan 2021 04:06:08 +0000 (04:06 +0000)] 
ci: do not cancel all jobs of a matrix if one fails

The CI/PR GitHub Actions workflow uses the 'matrix' strategy for the
"windows-test", "vs-test", "regular" and "dockerized" jobs. The default
behaviour of GitHub Actions is to cancel all in-progress jobs in a
matrix if one of the job of the matrix fails [1].

This is not ideal as a failure early in a job, like during installation of
the build/test dependencies on a specific platform, leads to the
cancellation of all other jobs in the matrix.

Set the 'fail-fast' variable to 'false' for all four matrix jobs in the
workflow.

[1] https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstrategyfail-fast

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agotest-lib: prevent '--stress-jobs=X' from being ignored
SZEDER Gábor [Tue, 26 Jan 2021 22:05:33 +0000 (23:05 +0100)] 
test-lib: prevent '--stress-jobs=X' from being ignored

'./t1234-foo.sh --stress-jobs=X ...' is supposed to run that test
script in X parallel jobs, but the number of jobs specified on the
command line is entirely ignored if other '--stress'-related options
follow.  I.e. both './t1234-foo.sh --stress-jobs=X --stress-limit=Y'
and './t1234-foo.sh --stress-jobs=X --stress' fall back to using twice
the number of CPUs parallel jobs instead.

The former has been broken since commit de69e6f6c9 (tests: let
--stress-limit=<N> imply --stress, 2019-03-03) [1], which started to
unconditionally overwrite the $stress variable holding the specified
number of jobs in its effort to imply '--stress'.  The latter has been
broken since f545737144 (tests: introduce --stress-jobs=<N>,
2019-03-03), because it didn't consider that handling '--stress' will
overwrite that variable as well.

We could fix this by being more careful about (over)writing that
$stress variable and checking first whether it has already been set.
But I think it's cleaner to use a dedicated variable to hold the
number of specified parallel jobs, so let's do that instead.

[1] In de69e6f6c9 there was no '--stress-jobs=X' option yet, the
    number of parallel jobs had to be specified via '--stress=X', so,
    strictly speaking, de69e6f6c9 broke './t1234-foo.sh --stress=X
    --stress-limit=Y'.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoThe fourth batch
Junio C Hamano [Mon, 25 Jan 2021 22:04:49 +0000 (14:04 -0800)] 
The fourth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'ab/mailmap-fixup'
Junio C Hamano [Mon, 25 Jan 2021 22:19:20 +0000 (14:19 -0800)] 
Merge branch 'ab/mailmap-fixup'

Follow-up fixes and improvements to ab/mailmap topic.

* ab/mailmap-fixup:
  t4203: make blame output massaging more robust
  mailmap doc: use correct environment variable 'GIT_WORK_TREE'
  t4203: stop losing return codes of git commands
  test-lib-functions.sh: fix usage for test_commit()

3 years agoMerge branch 'tb/pack-revindex-api'
Junio C Hamano [Mon, 25 Jan 2021 22:19:19 +0000 (14:19 -0800)] 
Merge branch 'tb/pack-revindex-api'

Abstract accesses to in-core revindex that allows enumerating
objects stored in a packfile in the order they appear in the pack,
in preparation for introducing an on-disk precomputed revindex.

* tb/pack-revindex-api: (21 commits)
  for_each_object_in_pack(): clarify pack vs index ordering
  pack-revindex.c: avoid direct revindex access in 'offset_to_pack_pos()'
  pack-revindex: hide the definition of 'revindex_entry'
  pack-revindex: remove unused 'find_revindex_position()'
  pack-revindex: remove unused 'find_pack_revindex()'
  builtin/gc.c: guess the size of the revindex
  for_each_object_in_pack(): convert to new revindex API
  unpack_entry(): convert to new revindex API
  packed_object_info(): convert to new revindex API
  retry_bad_packed_offset(): convert to new revindex API
  get_delta_base_oid(): convert to new revindex API
  rebuild_existing_bitmaps(): convert to new revindex API
  try_partial_reuse(): convert to new revindex API
  get_size_by_pos(): convert to new revindex API
  show_objects_for_type(): convert to new revindex API
  bitmap_position_packfile(): convert to new revindex API
  check_object(): convert to new revindex API
  write_reused_pack_verbatim(): convert to new revindex API
  write_reused_pack_one(): convert to new revindex API
  write_reuse_object(): convert to new revindex API
  ...

3 years agoMerge branch 'ab/coc-update-to-2.0'
Junio C Hamano [Mon, 25 Jan 2021 22:19:19 +0000 (14:19 -0800)] 
Merge branch 'ab/coc-update-to-2.0'

Update the Code-of-conduct to version 2.0 from the upstream (we've
been using version 1.4).

* ab/coc-update-to-2.0:
  CoC: update to version 2.0 + local changes
  CoC: explicitly take any whitespace breakage
  CoC: Update word-wrapping to match upstream

3 years agoMerge branch 'ps/config-env-pairs'
Junio C Hamano [Mon, 25 Jan 2021 22:19:19 +0000 (14:19 -0800)] 
Merge branch 'ps/config-env-pairs'

Introduce two new ways to feed configuration variable-value pairs
via environment variables, and tweak the way GIT_CONFIG_PARAMETERS
encodes variable/value pairs to make it more robust.

* ps/config-env-pairs:
  config: allow specifying config entries via envvar pairs
  environment: make `getenv_safe()` a public function
  config: store "git -c" variables using more robust format
  config: parse more robust format in GIT_CONFIG_PARAMETERS
  config: extract function to parse config pairs
  quote: make sq_dequote_step() a public function
  config: add new way to pass config via `--config-env`
  git: add `--super-prefix` to usage string

3 years agoMerge branch 'cc/write-promisor-file'
Junio C Hamano [Mon, 25 Jan 2021 22:19:19 +0000 (14:19 -0800)] 
Merge branch 'cc/write-promisor-file'

A bit of code refactoring.

* cc/write-promisor-file:
  pack-write: die on error in write_promisor_file()
  fetch-pack: refactor writing promisor file
  fetch-pack: rename helper to create_promisor_file()

3 years agoMerge branch 'jx/bundle'
Junio C Hamano [Mon, 25 Jan 2021 22:19:19 +0000 (14:19 -0800)] 
Merge branch 'jx/bundle'

"git bundle" learns "--stdin" option to read its refs from the
standard input.  Also, it now does not lose refs whey they point
at the same object.

* jx/bundle:
  bundle: arguments can be read from stdin
  bundle: lost objects when removing duplicate pendings
  test: add helper functions for git-bundle

3 years agoMerge branch 'ab/mailmap'
Junio C Hamano [Mon, 25 Jan 2021 22:19:19 +0000 (14:19 -0800)] 
Merge branch 'ab/mailmap'

Clean-up docs, codepaths and tests around mailmap.

* ab/mailmap: (22 commits)
  shortlog: remove unused(?) "repo-abbrev" feature
  mailmap doc + tests: document and test for case-insensitivity
  mailmap tests: add tests for empty "<>" syntax
  mailmap tests: add tests for whitespace syntax
  mailmap tests: add a test for comment syntax
  mailmap doc + tests: add better examples & test them
  tests: refactor a few tests to use "test_commit --append"
  test-lib functions: add an --append option to test_commit
  test-lib functions: add --author support to test_commit
  test-lib functions: document arguments to test_commit
  test-lib functions: expand "test_commit" comment template
  mailmap: test for silent exiting on missing file/blob
  mailmap tests: get rid of overly complex blame fuzzing
  mailmap tests: add a test for "not a blob" error
  mailmap tests: remove redundant entry in test
  mailmap tests: improve --stdin tests
  mailmap tests: modernize syntax & test idioms
  mailmap tests: use our preferred whitespace syntax
  mailmap doc: start by mentioning the comment syntax
  check-mailmap doc: note config options
  ...

3 years agoMerge branch 'ps/fetch-atomic'
Junio C Hamano [Mon, 25 Jan 2021 22:19:19 +0000 (14:19 -0800)] 
Merge branch 'ps/fetch-atomic'

"git fetch" learns to treat ref updates atomically in all-or-none
fashion, just like "git push" does, with the new "--atomic" option.

* ps/fetch-atomic:
  fetch: implement support for atomic reference updates
  fetch: allow passing a transaction to `s_update_ref()`
  fetch: refactor `s_update_ref` to use common exit path
  fetch: use strbuf to format FETCH_HEAD updates
  fetch: extract writing to FETCH_HEAD

3 years agoMerge branch 'jk/log-cherry-pick-duplicate-patches'
Junio C Hamano [Mon, 25 Jan 2021 22:19:19 +0000 (14:19 -0800)] 
Merge branch 'jk/log-cherry-pick-duplicate-patches'

When more than one commit with the same patch ID appears on one
side, "git log --cherry-pick A...B" did not exclude them all when a
commit with the same patch ID appears on the other side.  Now it
does.

* jk/log-cherry-pick-duplicate-patches:
  patch-ids: handle duplicate hashmap entries

3 years agoMerge branch 'js/default-branch-name-tests-final-stretch'
Junio C Hamano [Mon, 25 Jan 2021 22:19:18 +0000 (14:19 -0800)] 
Merge branch 'js/default-branch-name-tests-final-stretch'

Prepare tests not to be affected by the name of the default branch
"git init" creates.

* js/default-branch-name-tests-final-stretch: (28 commits)
  tests: drop prereq `PREPARE_FOR_MAIN_BRANCH` where no longer needed
  t99*: adjust the references to the default branch name "main"
  tests(git-p4): transition to the default branch name `main`
  t9[5-7]*: adjust the references to the default branch name "main"
  t9[0-4]*: adjust the references to the default branch name "main"
  t8*: adjust the references to the default branch name "main"
  t7[5-9]*: adjust the references to the default branch name "main"
  t7[0-4]*: adjust the references to the default branch name "main"
  t6[4-9]*: adjust the references to the default branch name "main"
  t64*: preemptively adjust alignment to prepare for `master` -> `main`
  t6[0-3]*: adjust the references to the default branch name "main"
  t5[6-9]*: adjust the references to the default branch name "main"
  t55[4-9]*: adjust the references to the default branch name "main"
  t55[23]*: adjust the references to the default branch name "main"
  t551*: adjust the references to the default branch name "main"
  t550*: adjust the references to the default branch name "main"
  t5503: prepare aligned comment for replacing `master` with `main`
  t5[0-4]*: adjust the references to the default branch name "main"
  t5323: prepare centered comment for `master` -> `main`
  t4*: adjust the references to the default branch name "main"
  ...

3 years agoMerge branch 'dl/reflog-with-single-entry'
Junio C Hamano [Mon, 25 Jan 2021 22:19:18 +0000 (14:19 -0800)] 
Merge branch 'dl/reflog-with-single-entry'

After expiring a reflog and making a single commit, the reflog for
the branch would record a single entry that knows both @{0} and
@{1}, but we failed to answer "what commit were we on?", i.e. @{1}

* dl/reflog-with-single-entry:
  refs: allow @{n} to work with n-sized reflog
  refs: factor out set_read_ref_cutoffs()

3 years agoMerge branch 'sj/untracked-files-in-submodule-directory-is-not-dirty'
Junio C Hamano [Mon, 25 Jan 2021 22:19:18 +0000 (14:19 -0800)] 
Merge branch 'sj/untracked-files-in-submodule-directory-is-not-dirty'

"git diff" showed a submodule working tree with untracked cruft as
"Submodule commit <objectname>-dirty", but a natural expectation is
that the "-dirty" indicator would align with "git describe --dirty",
which does not consider having untracked files in the working tree
as source of dirtiness.  The inconsistency has been fixed.

* sj/untracked-files-in-submodule-directory-is-not-dirty:
  diff: do not show submodule with untracked files as "-dirty"

3 years agoMerge branch 'jc/deprecate-pack-redundant'
Junio C Hamano [Mon, 25 Jan 2021 22:19:17 +0000 (14:19 -0800)] 
Merge branch 'jc/deprecate-pack-redundant'

Warn loudly when the "pack-redundant" command, which has been left
stale with almost unusable performance issues, gets used, as we no
longer want to recommend its use (instead just "repack -d" instead).

* jc/deprecate-pack-redundant:
  pack-redundant: gauge the usage before proposing its removal

3 years agoMerge branch 'jk/forbid-lf-in-git-url'
Junio C Hamano [Mon, 25 Jan 2021 22:19:17 +0000 (14:19 -0800)] 
Merge branch 'jk/forbid-lf-in-git-url'

Newline characters in the host and path part of git:// URL are
now forbidden.

* jk/forbid-lf-in-git-url:
  fsck: reject .gitmodules git:// urls with newlines
  git_connect_git(): forbid newlines in host and path

3 years agoMerge branch 'ab/branch-sort'
Junio C Hamano [Mon, 25 Jan 2021 22:19:17 +0000 (14:19 -0800)] 
Merge branch 'ab/branch-sort'

The implementation of "git branch --sort" wrt the detached HEAD
display has always been hacky, which has been cleaned up.

* ab/branch-sort:
  branch: show "HEAD detached" first under reverse sort
  branch: sort detached HEAD based on a flag
  ref-filter: move ref_sorting flags to a bitfield
  ref-filter: move "cmp_fn" assignment into "else if" arm
  ref-filter: add braces to if/else if/else chain
  branch tests: add to --sort tests
  branch: change "--local" to "--list" in comment

3 years agoMerge branch 'en/diffcore-rename'
Junio C Hamano [Mon, 25 Jan 2021 22:19:17 +0000 (14:19 -0800)] 
Merge branch 'en/diffcore-rename'

File-level rename detection updates.

* en/diffcore-rename:
  diffcore-rename: remove unnecessary duplicate entry checks
  diffcore-rename: accelerate rename_dst setup
  diffcore-rename: simplify and accelerate register_rename_src()
  t4058: explore duplicate tree entry handling in a bit more detail
  t4058: add more tests and documentation for duplicate tree entry handling
  diffcore-rename: reduce jumpiness in progress counters
  diffcore-rename: simplify limit check
  diffcore-rename: avoid usage of global in too_many_rename_candidates()
  diffcore-rename: rename num_create to num_destinations

3 years agoMerge branch 'ma/more-opaque-lock-file'
Junio C Hamano [Mon, 25 Jan 2021 22:19:17 +0000 (14:19 -0800)] 
Merge branch 'ma/more-opaque-lock-file'

Code clean-up.

* ma/more-opaque-lock-file:
  read-cache: try not to peek into `struct {lock_,temp}file`
  refs/files-backend: don't peek into `struct lock_file`
  midx: don't peek into `struct lock_file`
  commit-graph: don't peek into `struct lock_file`
  builtin/gc: don't peek into `struct lock_file`

3 years agoMerge branch 'en/merge-ort-3'
Junio C Hamano [Mon, 25 Jan 2021 22:19:17 +0000 (14:19 -0800)] 
Merge branch 'en/merge-ort-3'

Rename detection is added to the "ORT" merge strategy.

* en/merge-ort-3:
  merge-ort: add implementation of type-changed rename handling
  merge-ort: add implementation of normal rename handling
  merge-ort: add implementation of rename collisions
  merge-ort: add implementation of rename/delete conflicts
  merge-ort: add implementation of both sides renaming differently
  merge-ort: add implementation of both sides renaming identically
  merge-ort: add basic outline for process_renames()
  merge-ort: implement compare_pairs() and collect_renames()
  merge-ort: implement detect_regular_renames()
  merge-ort: add initial outline for basic rename detection
  merge-ort: add basic data structures for handling renames

3 years agoMerge branch 'ab/mktag'
Junio C Hamano [Mon, 25 Jan 2021 22:19:16 +0000 (14:19 -0800)] 
Merge branch 'ab/mktag'

"git mktag" validates its input using its own rules before writing
a tag object---it has been updated to share the logic with "git
fsck".

* ab/mktag: (23 commits)
  mktag: add a --[no-]strict option
  mktag: mark strings for translation
  mktag: convert to parse-options
  mktag: allow omitting the header/body \n separator
  mktag: allow turning off fsck.extraHeaderEntry
  fsck: make fsck_config() re-usable
  mktag: use fsck instead of custom verify_tag()
  mktag: use puts(str) instead of printf("%s\n", str)
  mktag: remove redundant braces in one-line body "if"
  mktag: use default strbuf_read() hint
  mktag tests: test verify_object() with replaced objects
  mktag tests: improve verify_object() test coverage
  mktag tests: test "hash-object" compatibility
  mktag tests: stress test whitespace handling
  mktag tests: run "fsck" after creating "mytag"
  mktag tests: don't create "mytag" twice
  mktag tests: don't redirect stderr to a file needlessly
  mktag tests: remove needless SHA-1 hardcoding
  mktag tests: use "test_commit" helper
  mktag tests: don't needlessly use a subshell
  ...

3 years agols-files.c: add --deduplicate option
ZheNing Hu [Sat, 23 Jan 2021 10:20:10 +0000 (10:20 +0000)] 
ls-files.c: add --deduplicate option

During a merge conflict, the name of a file may appear multiple
times in "git ls-files" output, once for each stage.  If you use
both `--delete` and `--modify` at the same time, the output may
mention a deleted file twice.

When none of the '-t', '-u', or '-s' options is in use, these
duplicate entries do not add much value to the output.

Introduce a new '--deduplicate' option to suppress them.

Signed-off-by: ZheNing Hu <adlternative@gmail.com>
[jc: extended doc and rewritten commit log]
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agols_files.c: consolidate two for loops into one
ZheNing Hu [Sat, 23 Jan 2021 10:20:09 +0000 (10:20 +0000)] 
ls_files.c: consolidate two for loops into one

This will make it easier to show only one entry per filename in the
next step.

Signed-off-by: ZheNing Hu <adlternative@gmail.com>
[jc: corrected the log message]
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agols_files.c: bugfix for --deleted and --modified
ZheNing Hu [Sat, 23 Jan 2021 10:20:08 +0000 (10:20 +0000)] 
ls_files.c: bugfix for --deleted and --modified

This situation may occur in the original code: lstat() failed
but we use `&st` to feed ie_modified() later.

Therefore, we can directly execute show_ce without the judgment of
ie_modified() when lstat() has failed.

Signed-off-by: ZheNing Hu <adlternative@gmail.com>
[jc: fixed misindented code]
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agols-refs.c: traverse prefixes of disjoint "ref-prefix" sets
Taylor Blau [Wed, 20 Jan 2021 16:04:30 +0000 (11:04 -0500)] 
ls-refs.c: traverse prefixes of disjoint "ref-prefix" sets

ls-refs performs a single revision walk over the whole ref namespace,
and sends ones that match with one of the given ref prefixes down to the
user.

This can be expensive if there are many refs overall, but the portion of
them covered by the given prefixes is small by comparison.

To attempt to reduce the difference between the number of refs
traversed, and the number of refs sent, only traverse references which
are in the longest common prefix of the given prefixes. This is very
reminiscent of the approach taken in b31e2680c4 (ref-filter.c: find
disjoint pattern prefixes, 2019-06-26) which does an analogous thing for
multi-patterned 'git for-each-ref' invocations.

The callback 'send_ref' is resilient to ignore extra patterns by
discarding any arguments which do not begin with at least one of the
specified prefixes.

Similarly, the code introduced in b31e2680c4 is resilient to stop early
at metacharacters, but we only pass strict prefixes here. At worst we
would return too many results, but the double checking done by send_ref
will throw away anything that doesn't start with something in the prefix
list.

Finally, if no prefixes were provided, then implicitly add the empty
string (which will match all references) since this matches the existing
behavior (see the "no restrictions" comment in "ls-refs.c:ref_match()").

Original-patch-by: Jacob Vosmaer <jacob@gitlab.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agols-refs.c: initialize 'prefixes' before using it
Jacob Vosmaer [Wed, 20 Jan 2021 16:04:25 +0000 (11:04 -0500)] 
ls-refs.c: initialize 'prefixes' before using it

Correctly initialize the "prefixes" strvec using strvec_init() instead
of simply zeroing it via the earlier memset().

There's no way to trigger a crash, since the first 'ref-prefix' command
will initialize the strvec via the 'ALLOC_GROW' in 'strvec_push_nodup()'
(the alloc and nr variables are already zero'd, so the call to
ALLOC_GROW is valid).

If no "ref-prefix" command was given, then the call to
'ls-refs.c:ref_match()' will abort early after it reads the zero in
'prefixes->nr'. Likewise, strvec_clear() will only call free() on the
array, which is NULL, so we're safe there, too.

But, all of this is dangerous and requires more reasoning than it would
if we simply called 'strvec_init()', so do that.

Signed-off-by: Jacob Vosmaer <jacob@gitlab.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agorefs: expose 'for_each_fullref_in_prefixes'
Taylor Blau [Wed, 20 Jan 2021 16:04:21 +0000 (11:04 -0500)] 
refs: expose 'for_each_fullref_in_prefixes'

This function was used in the ref-filter.c code to find the longest
common prefix of among a set of refspecs, and then to iterate all of the
references that descend from that prefix.

A future patch will want to use that same code from ls-refs.c, so
prepare by exposing and moving it to refs.c. Since there is nothing
specific to the ref-filter code here (other than that it was previously
the only caller of this function), this really belongs in the more
generic refs.h header.

The code moved in this patch is identical before and after, with the one
exception of renaming some arguments to be consistent with other
functions exposed in refs.h.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agobuiltin/pack-objects.c: avoid iterating all refs
Jacob Vosmaer [Wed, 20 Jan 2021 12:45:14 +0000 (13:45 +0100)] 
builtin/pack-objects.c: avoid iterating all refs

In git-pack-objects, we iterate over all the tags if the --include-tag
option is passed on the command line. For some reason this uses
for_each_ref which is expensive if the repo has many refs. We should
use for_each_tag_ref instead.

Because the add_ref_tag callback will now only visit tags we
simplified it a bit.

The motivation for this change is that we observed performance issues
with a repository on gitlab.com that has 500,000 refs but only 2,000
tags. The fetch traffic on that repo is dominated by CI, and when we
changed CI to fetch with 'git fetch --no-tags' we saw a dramatic
change in the CPU profile of git-pack-objects. This lead us to this
particular ref walk. More details in:
https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/746#note_483546598

Signed-off-by: Jacob Vosmaer <jacob@gitlab.com>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agorun-command: document use_shell option
Jeff King [Fri, 22 Jan 2021 21:03:33 +0000 (16:03 -0500)] 
run-command: document use_shell option

It's unclear how run-command's use_shell option should impact the
arguments fed to a command. Plausibly it could mean that we glue all of
the arguments together into a string to pass to the shell, in which case
that opens the question of whether the caller needs to quote them.

But in fact we don't implement it that way (and even if we did, we'd
probably auto-quote the arguments as part of the glue step). And we must
not receive quoted arguments, because we might actually optimize out the
shell entirely (i.e., the caller does not even know if a shell will be
involved in the end or not).

Since this ambiguity may have been the cause of a recent bug, let's
document the option a bit.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agouse delete_refs when deleting tags or branches
Phil Hord [Thu, 21 Jan 2021 03:23:32 +0000 (19:23 -0800)] 
use delete_refs when deleting tags or branches

'git tag -d' accepts one or more tag refs to delete, but each deletion
is done by calling `delete_ref` on each argv. This is very slow when
removing from packed refs. Use delete_refs instead so all the removals
can be done inside a single transaction with a single update.

Do the same for 'git branch -d'.

Since delete_refs performs all the packed-refs delete operations
inside a single transaction, if any of the deletes fail then all
them will be skipped. In practice, none of them should fail since
we verify the hash of each one before calling delete_refs, but some
network error or odd permissions problem could have different results
after this change.

Also, since the file-backed deletions are not performed in the same
transaction, those could succeed even when the packed-refs transaction
fails.

After deleting branches, remove the branch config only if the branch
ref was removed and was not subsequently added back in.

A manual test deleting 24,000 tags took about 30 minutes using
delete_ref.  It takes about 5 seconds using delete_refs.

Acked-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Phil Hord <phil.hord@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agorefs: switch peel_ref() to peel_iterated_oid()
Jeff King [Wed, 20 Jan 2021 19:44:43 +0000 (14:44 -0500)] 
refs: switch peel_ref() to peel_iterated_oid()

The peel_ref() interface is confusing and error-prone:

  - it's typically used by ref iteration callbacks that have both a
    refname and oid. But since they pass only the refname, we may load
    the ref value from the filesystem again. This is inefficient, but
    also means we are open to a race if somebody simultaneously updates
    the ref. E.g., this:

      int some_ref_cb(const char *refname, const struct object_id *oid, ...)
      {
              if (!peel_ref(refname, &peeled))
                      printf("%s peels to %s",
                             oid_to_hex(oid), oid_to_hex(&peeled);
      }

    could print nonsense. It is correct to say "refname peels to..."
    (you may see the "before" value or the "after" value, either of
    which is consistent), but mentioning both oids may be mixing
    before/after values.

    Worse, whether this is possible depends on whether the optimization
    to read from the current iterator value kicks in. So it is actually
    not possible with:

      for_each_ref(some_ref_cb);

    but it _is_ possible with:

      head_ref(some_ref_cb);

    which does not use the iterator mechanism (though in practice, HEAD
    should never peel to anything, so this may not be triggerable).

  - it must take a fully-qualified refname for the read_ref_full() code
    path to work. Yet we routinely pass it partial refnames from
    callbacks to for_each_tag_ref(), etc. This happens to work when
    iterating because there we do not call read_ref_full() at all, and
    only use the passed refname to check if it is the same as the
    iterator. But the requirements for the function parameters are quite
    unclear.

Instead of taking a refname, let's instead take an oid. That fixes both
problems. It's a little funny for a "ref" function not to involve refs
at all. The key thing is that it's optimizing under the hood based on
having access to the ref iterator. So let's change the name to make it
clear why you'd want this function versus just peel_object().

There are two other directions I considered but rejected:

  - we could pass the peel information into the each_ref_fn callback.
    However, we don't know if the caller actually wants it or not. For
    packed-refs, providing it is essentially free. But for loose refs,
    we actually have to peel the object, which would be wasteful in most
    cases. We could likewise pass in a flag to the callback indicating
    whether the peeled information is known, but that complicates those
    callbacks, as they then have to decide whether to manually peel
    themselves. Plus it requires changing the interface of every
    callback, whether they care about peeling or not, and there are many
    of them.

  - we could make a function to return the peeled value of the current
    iterated ref (computing it if necessary), and BUG() otherwise. I.e.:

      int peel_current_iterated_ref(struct object_id *out);

    Each of the current callers is an each_ref_fn callback, so they'd
    mostly be happy. But:

      - we use those callbacks with functions like head_ref(), which do
        not use the iteration code. So we'd need to handle the fallback
        case there, anyway.

      - it's possible that a caller would want to call into generic code
        that sometimes is used during iteration and sometimes not. This
        encapsulates the logic to do the fast thing when possible, and
        fallback when necessary.

The implementation is mostly obvious, but I want to call out a few
things in the patch:

  - the test-tool coverage for peel_ref() is now meaningless, as it all
    collapses to a single peel_object() call (arguably they were pretty
    uninteresting before; the tricky part of that function is the
    fast-path we see during iteration, but these calls didn't trigger
    that). I've just dropped it entirely, though note that some other
    tests relied on the tags we created; I've moved that creation to the
    tests where it matters.

  - we no longer need to take a ref_store parameter, since we'd never
    look up a ref now. We do still rely on a global "current iterator"
    variable which _could_ be kept per-ref-store. But in practice this
    is only useful if there are multiple recursive iterations, at which
    point the more appropriate solution is probably a stack of
    iterators. No caller used the actual ref-store parameter anyway
    (they all call the wrapper that passes the_repository).

  - the original only kicked in the optimization when the "refname"
    pointer matched (i.e., not string comparison). We do likewise with
    the "oid" parameter here, but fall back to doing an actual oideq()
    call. This in theory lets us kick in the optimization more often,
    though in practice no current caller cares. It should never be
    wrong, though (peeling is a property of an object, so two refs
    pointing to the same object would peel identically).

  - the original took care not to touch the peeled out-parameter unless
    we found something to put in it. But no caller cares about this, and
    anyway, it is enforced by peel_object() itself (and even in the
    optimized iterator case, that's where we eventually end up). We can
    shorten the code and avoid an extra copy by just passing the
    out-parameter through the stack.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoSKIP_DASHED_BUILT_INS: respect `config.mak`
Johannes Schindelin [Thu, 21 Jan 2021 13:09:45 +0000 (13:09 +0000)] 
SKIP_DASHED_BUILT_INS: respect `config.mak`

When `SKIP_DASHED_BUILT_INS` is specified in `config.mak`, the dashed
form of the built-ins was still generated.

By moving the `SKIP_DASHED_BUILT_INS` handling after `config.mak` was
read, this can be avoided.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agofsck doc: remove ancient out-of-date diagnostics
Ævar Arnfjörð Bjarmason [Sat, 16 Jan 2021 17:15:00 +0000 (18:15 +0100)] 
fsck doc: remove ancient out-of-date diagnostics

Remove diagnostics that haven't been emitted by "fsck" or its
predecessors for around 15 years. This documentation was added in
c64b9b88605 (Reference documentation for the core git commands.,
2005-05-05), but was out-of-date quickly after that.

Notes on individual diagnostics:

 - "expect dangling commits": Added in bcee6fd8e71 (Make 'fsck' able
   to[...], 2005-04-13), documented in c64b9b88605. Not emitted since
   1024932f019 (fsck-cache: walk the 'refs' directory[...],
   2005-05-18).

 - "missing sha1 directory": Added in 20222118ae4 (Add first cut at
   "fsck-cache"[...], 2005-04-08), documented in c64b9b88605. Not
   emitted since 230f13225df (Create object subdirectories on demand,
   2005-10-08).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoDoc: clarify contents of packfile sent as URI
Jonathan Tan [Wed, 20 Jan 2021 19:36:57 +0000 (11:36 -0800)] 
Doc: clarify contents of packfile sent as URI

Clarify that, when the packfile-uri feature is used, the client should
not assume that the extra packfiles downloaded would only contain a
single blob, but support packfiles containing multiple objects of all
types.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot7900: clean up some broken refs
Derrick Stolee [Tue, 19 Jan 2021 12:52:04 +0000 (12:52 +0000)] 
t7900: clean up some broken refs

The tests for the 'prefetch' task create remotes and fetch refs into
'refs/prefetch/<remote>/' and tags into 'refs/tags/'. These tests use
the remotes to create objects not intended to be seen by the "local"
repository.

In that sense, the incrmental-repack tasks did not have these objects
and refs in mind. That test replaces the object directory with a
specific pack-file layout for testing the batch-size logic. However,
this causes some operations to start showing warnings such as:

 error: refs/prefetch/remote1/one does not point to a valid object!
 error: refs/tags/one does not point to a valid object!

This only shows up if you run the tests verbosely and watch the output.
It caught my eye and I _thought_ that there was a bug where 'git gc' or
'git repack' wouldn't check 'refs/prefetch/' before pruning objects.
That is incorrect. Those commands do handle 'refs/prefetch/' correctly.

All that is left is to clean up the tests in t7900-maintenance.sh to
remove these tags and refs that are not being repacked for the
incremental-repack tests. Use update-ref to ensure this works with all
ref backends.

Helped-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agomaintenance: set log.excludeDecoration durin prefetch
Derrick Stolee [Tue, 19 Jan 2021 12:52:03 +0000 (12:52 +0000)] 
maintenance: set log.excludeDecoration durin prefetch

The 'prefetch' task fetches refs from all remotes and places them in the
refs/prefetch/<remote>/ refspace. As this task is intended to run in the
background, this allows users to keep their local data very close to the
remote servers' data while not updating the users' understanding of the
remote refs in refs/remotes/<remote>/.

However, this can clutter 'git log' decorations with copies of the refs
with the full name 'refs/prefetch/<remote>/<branch>'.

The log.excludeDecoration config option was added in a6be5e67 (log: add
log.excludeDecoration config option, 2020-05-16) for exactly this
purpose.

Ensure we set this only for users that would benefit from it by
assigning it at the beginning of the prefetch task. Other alternatives
would be during 'git maintenance register' or 'git maintenance start',
but those might assign the config even when the prefetch task is
disabled by existing config. Further, users could run 'git maintenance
run --task=prefetch' using their own scripting or scheduling. This
provides the best coverage to automatically update the config when
valuable.

It is improbable, but possible, that users might want to run the
prefetch task _and_ see these refs in their log decorations. This seems
incredibly unlikely to me, but users can always opt-in on a
command-by-command basis using --decorate-refs=refs/prefetch/.

Test that this works in a few cases. In particular, ensure that our
assignment of log.excludeDecoration=refs/prefetch/ is additive to other
existing exclusions. Further, ensure we do not add multiple copies in
multiple runs.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocache-tree: speed up consecutive path comparisons
Derrick Stolee [Thu, 7 Jan 2021 16:32:11 +0000 (16:32 +0000)] 
cache-tree: speed up consecutive path comparisons

The previous change reduced time spent in strlen() while comparing
consecutive paths in verify_cache(), but we can do better. The
conditional checks the existence of a directory separator at the correct
location, but only after doing a string comparison. Swap the order to be
logically equivalent but perform fewer string comparisons.

To test the effect on performance, I used a repository with over three
million paths in the index. I then ran the following command on repeat:

  git -c index.threads=1 commit --amend --allow-empty --no-edit

Here are the measurements over 10 runs after a 5-run warmup:

  Benchmark #1: v2.30.0
    Time (mean ± σ):     854.5 ms ±  18.2 ms
    Range (min … max):   825.0 ms … 892.8 ms

  Benchmark #2: Previous change
    Time (mean ± σ):     833.2 ms ±  10.3 ms
    Range (min … max):   815.8 ms … 849.7 ms

  Benchmark #3: This change
    Time (mean ± σ):     815.5 ms ±  18.1 ms
    Range (min … max):   795.4 ms … 849.5 ms

This change is 2% faster than the previous change and 5% faster than
v2.30.0.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>