]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
3 years agoMerge branch 'ak/slab-decl-cleanup'
Junio C Hamano [Wed, 20 May 2020 15:33:29 +0000 (08:33 -0700)] 
Merge branch 'ak/slab-decl-cleanup'

Code clean-up.

* ak/slab-decl-cleanup:
  commit-slab-decl.h: update include guard

3 years agoMerge branch 'jc/fix-tap-output-under-bash'
Junio C Hamano [Wed, 20 May 2020 15:33:29 +0000 (08:33 -0700)] 
Merge branch 'jc/fix-tap-output-under-bash'

A recent attempt to make the test output nicer to view on CI
systems broke TAP output under bash.  The effort has been reverted
to be re-attempted in the next cycle.

* jc/fix-tap-output-under-bash:
  Revert "tests: when run in Bash, annotate test failures with file name/line number"
  Revert "ci: add a problem matcher for GitHub Actions"
  Revert "t/test_lib: avoid naked bash arrays in file_lineno"

3 years agoMerge branch 'en/sparse-checkout'
Junio C Hamano [Wed, 20 May 2020 15:33:29 +0000 (08:33 -0700)] 
Merge branch 'en/sparse-checkout'

Consistency fix to a topic already in 'master'.

* en/sparse-checkout:
  unpack-trees: also allow get_progress() to work on a different index

3 years agoMerge branch 'ds/trace-log-progress-fix'
Junio C Hamano [Wed, 20 May 2020 15:33:28 +0000 (08:33 -0700)] 
Merge branch 'ds/trace-log-progress-fix'

Last-minute fix for our recent change to allow use of progress API
as a traceable region.

* ds/trace-log-progress-fix:
  progress: call trace2_region_leave() only after calling _enter()

3 years agoMerge branch 'js/ci-sdk-download-fix'
Junio C Hamano [Wed, 20 May 2020 15:33:27 +0000 (08:33 -0700)] 
Merge branch 'js/ci-sdk-download-fix'

Instead of downloading Windows SDK for CI jobs for windows builds
from an external site (wingit.blob.core.windows.net), use the one
created in the windows-build job, to work around quota issues at
the external site.

* js/ci-sdk-download-fix:
  ci: avoid pounding on the poor ci-artifacts container

3 years agoMerge branch 'en/merge-rename-rename-worktree-fix'
Junio C Hamano [Wed, 20 May 2020 15:33:27 +0000 (08:33 -0700)] 
Merge branch 'en/merge-rename-rename-worktree-fix'

When a binary file gets modified and renamed on both sides of history
to different locations, both files would be written to the working
tree but both would have the contents from "ours".  This has been
corrected so that the path from each side gets their original content.

* en/merge-rename-rename-worktree-fix:
  merge-recursive: fix rename/rename(1to2) for working tree with a binary

3 years agoMerge branch 'cb/no-more-gmtime'
Junio C Hamano [Wed, 20 May 2020 15:33:27 +0000 (08:33 -0700)] 
Merge branch 'cb/no-more-gmtime'

Code clean-up by removing a compatibility implementation of a
function we no longer use.

* cb/no-more-gmtime:
  compat: remove gmtime

3 years agoMerge branch 'dd/t1509-i18n-fix'
Junio C Hamano [Wed, 20 May 2020 15:33:26 +0000 (08:33 -0700)] 
Merge branch 'dd/t1509-i18n-fix'

A few tests were not i18n clean.

* dd/t1509-i18n-fix:
  t1509: correct i18n test

3 years agocommit-slab-decl.h: update include guard
Abhishek Kumar [Mon, 18 May 2020 14:30:23 +0000 (20:00 +0530)] 
commit-slab-decl.h: update include guard

When a9f1f1f9f8 ("commit-slab.h: code split", 2018-05-19) split
commit-slab.h into commit-slab-decl.h and commit-slab-impl.h header
files, commit-slab-decl.h were left to use "COMMIT_SLAB_HDR_H",
while commit-slab-impl.h gained its own macro, "COMMIT_SLAB_IMPL_H".

As these two files use different include guards, there is nothing
broken, but let's update commit-slab-decl.h to match the convention
to name the include guard after the filename.

Signed-off-by: Abhishek Kumar <abhishekkumar8222@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoRevert "tests: when run in Bash, annotate test failures with file name/line number"
Junio C Hamano [Fri, 15 May 2020 16:47:51 +0000 (09:47 -0700)] 
Revert "tests: when run in Bash, annotate test failures with file name/line number"

This reverts commit 662f9cf1548cf069cb819e9e95f224657015fcf9,
to fix the TAP output broken for bash.

3 years agoRevert "ci: add a problem matcher for GitHub Actions"
Junio C Hamano [Fri, 15 May 2020 17:24:02 +0000 (10:24 -0700)] 
Revert "ci: add a problem matcher for GitHub Actions"

This reverts commit 676eb0c1ce0d380478eb16bdc5a3f2a7bc01c1d2;
as we will be reverting the change to show these extra output
tokens under bash, the pattern would not match anything.

Helped-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoRevert "t/test_lib: avoid naked bash arrays in file_lineno"
Junio C Hamano [Fri, 15 May 2020 16:47:18 +0000 (09:47 -0700)] 
Revert "t/test_lib: avoid naked bash arrays in file_lineno"

This reverts commit 303775a25f0b4ac5d6ad2e96eb4404c24209cad8;
instead of trying to salvage the tap-breaking change, let's
revert the whole thing for now.

3 years agoprogress: call trace2_region_leave() only after calling _enter()
Derrick Stolee [Fri, 15 May 2020 16:09:28 +0000 (09:09 -0700)] 
progress: call trace2_region_leave() only after calling _enter()

A user of progress API calls start_progress() conditionally and
depends on the display_progress() and stop_progress() functions to
become no-op when start_progress() hasn't been called.

As we added a call to trace2_region_enter() to start_progress(), the
calls to other trace2 API calls from the progress API functions must
make sure that these trace2 calls are skipped when start_progress()
hasn't been called on the progress struct.  Specifically, do not
call trace2_region_leave() from stop_progress() when we haven't
called start_progress(), which would have called the matching
trace2_region_enter().

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoci: avoid pounding on the poor ci-artifacts container
Johannes Schindelin [Fri, 15 May 2020 07:55:18 +0000 (07:55 +0000)] 
ci: avoid pounding on the poor ci-artifacts container

When this developer tested how the git-sdk-64-minimal artifact could be
served to all the GitHub workflow runs that need it, Azure Blobs looked
like a pretty good choice: it is reliable, fast and we already use it in
Git for Windows to serve components like OpenSSL, cURL, etc

It came as an unpleasant surprise just _how many_ times this artifact
was downloaded. It exploded the bandwidth to a point where the free tier
would no longer be enough, threatening to block other, essential Git for
Windows services.

Let's switch back to using the Build Artifacts of our trusty Azure
Pipeline for the time being.

To avoid unnecessary hammering of the Azure Pipeline artifacts, we use
the GitHub Action `actions/upload-artifact` in the `windows-build` job
and the GitHub Action `actions/download-artifact` in the `windows-test`
and `vs-test` jobs (the latter now depends on `windows-build` for that
reason, too).

Helped-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agounpack-trees: also allow get_progress() to work on a different index
Elijah Newren [Thu, 14 May 2020 19:53:22 +0000 (19:53 +0000)] 
unpack-trees: also allow get_progress() to work on a different index

commit b0a5a12a60 ("unpack-trees: allow check_updates() to work on a
different index", 2020-03-27) allowed check_updates() to work on a
different index, but it called get_progress() which was hardcoded to
work on o->result much like check_updates() had been.  Update it to also
accept an index parameter and have check_updates() pass that parameter
along so that both are working on the same index.

Noticed-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoGit 2.27-rc0 v2.27.0-rc0
Junio C Hamano [Thu, 14 May 2020 21:39:28 +0000 (14:39 -0700)] 
Git 2.27-rc0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'es/trace-log-progress'
Junio C Hamano [Thu, 14 May 2020 21:39:45 +0000 (14:39 -0700)] 
Merge branch 'es/trace-log-progress'

Teach codepaths that show progress meter to also use the
start_progress() and the stop_progress() calls as a "region" to be
traced.

* es/trace-log-progress:
  trace2: log progress time and throughput

3 years agoMerge branch 'jt/t5500-unflake'
Junio C Hamano [Thu, 14 May 2020 21:39:45 +0000 (14:39 -0700)] 
Merge branch 'jt/t5500-unflake'

Test fix for a topic already in 'master' and meant for 'maint'.

* jt/t5500-unflake:
  t5500: count objects through stderr, not trace

3 years agoMerge branch 'sn/midx-repack-with-config'
Junio C Hamano [Thu, 14 May 2020 21:39:44 +0000 (14:39 -0700)] 
Merge branch 'sn/midx-repack-with-config'

"git multi-pack-index repack" has been taught to honor some
repack.* configuration variables.

* sn/midx-repack-with-config:
  multi-pack-index: respect repack.packKeptObjects=false
  midx: teach "git multi-pack-index repack" honor "git repack" configurations

3 years agoMerge branch 'ds/bloom-cleanup'
Junio C Hamano [Thu, 14 May 2020 21:39:44 +0000 (14:39 -0700)] 
Merge branch 'ds/bloom-cleanup'

Code cleanup and typofixes

* ds/bloom-cleanup:
  completion: offer '--(no-)patch' among 'git log' options
  bloom: use num_changes not nr for limit detection
  bloom: de-duplicate directory entries
  Documentation: changed-path Bloom filters use byte words
  bloom: parse commit before computing filters
  test-bloom: fix usage typo
  bloom: fix whitespace around tab length

3 years agoMerge branch 'rs/fsck-duplicate-names-in-trees'
Junio C Hamano [Thu, 14 May 2020 21:39:43 +0000 (14:39 -0700)] 
Merge branch 'rs/fsck-duplicate-names-in-trees'

"git fsck" ensures that the paths recorded in tree objects are
sorted and without duplicates, but it failed to notice a case where
a blob is followed by entries that sort before a tree with the same
name.  This has been corrected.

* rs/fsck-duplicate-names-in-trees:
  fsck: report non-consecutive duplicate names in trees

3 years agoMerge branch 'ao/p4-d-f-conflict-recover'
Junio C Hamano [Thu, 14 May 2020 21:39:43 +0000 (14:39 -0700)] 
Merge branch 'ao/p4-d-f-conflict-recover'

"git p4" learned to recover from a (broken) state where a directory
and a file are recorded at the same path in the Perforce repository
the same way as their clients do.

* ao/p4-d-f-conflict-recover:
  git-p4: recover from inconsistent perforce history

3 years agoMerge branch 'js/rebase-autosquash-double-fixup-fix'
Junio C Hamano [Thu, 14 May 2020 21:39:43 +0000 (14:39 -0700)] 
Merge branch 'js/rebase-autosquash-double-fixup-fix'

"rebase -i" segfaulted when rearranging a sequence that has a
fix-up that applies another fix-up (which may or may not be a
fix-up of yet another step).

* js/rebase-autosquash-double-fixup-fix:
  rebase --autosquash: fix a potential segfault

3 years agoMerge branch 'jc/codingstyle-compare-with-null'
Junio C Hamano [Thu, 14 May 2020 21:39:42 +0000 (14:39 -0700)] 
Merge branch 'jc/codingstyle-compare-with-null'

Doc update.

* jc/codingstyle-compare-with-null:
  CodingGuidelines: do not ==/!= compare with 0 or '\0' or NULL

3 years agoMerge branch 'cw/bisect-replay-with-dos'
Junio C Hamano [Thu, 14 May 2020 21:39:41 +0000 (14:39 -0700)] 
Merge branch 'cw/bisect-replay-with-dos'

"git bisect replay" had trouble with input files when they used
CRLF line ending, which has been corrected.

* cw/bisect-replay-with-dos:
  bisect: allow CRLF line endings in "git bisect replay" input

3 years agoMerge branch 'es/bugreport-with-hooks'
Junio C Hamano [Thu, 14 May 2020 21:39:40 +0000 (14:39 -0700)] 
Merge branch 'es/bugreport-with-hooks'

"git bugreport" learned to report enabled hooks in the repository.

* es/bugreport-with-hooks:
  bugreport: collect list of populated hooks

3 years agocompat: remove gmtime
Carlo Marcelo Arenas Belón [Thu, 14 May 2020 19:18:54 +0000 (12:18 -0700)] 
compat: remove gmtime

ccd469450a (date.c: switch to reentrant {gm,local}time_r, 2019-11-28)
removes the only gmtime() call we had and moves to gmtime_r() which
doesn't have the same portability problems.

Remove the compat gmtime code since it is no longer needed, and confirm
by successfull running t4212 in FreeBSD 9.3 amd64 (the oldest I could
get a hold off).

Further work might be needed to ensure 32bit time_t systems (like FreeBSD
i386) will handle correctly the overflows tested in t4212, but that is
orthogonal to this change, and it doesn't change the current behaviour
as neither gmtime() or gmtime_r() will ever return NULL on those systems
because time_t is unsigned.

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agomerge-recursive: fix rename/rename(1to2) for working tree with a binary
Elijah Newren [Wed, 13 May 2020 23:56:32 +0000 (23:56 +0000)] 
merge-recursive: fix rename/rename(1to2) for working tree with a binary

With a rename/rename(1to2) conflict, we attempt to do a three-way merge
of the file contents, so that the correct contents can be placed in the
working tree at both paths.  If the file is a binary, however, no
content merging is possible and we should just use the original version
of the file at each of the paths.

Reported-by: Chunlin Zhang <zhangchunlin@gmail.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoThe ninth batch
Junio C Hamano [Wed, 13 May 2020 18:31:14 +0000 (11:31 -0700)] 
The ninth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'cc/upload-pack-v2-fetch-fix'
Junio C Hamano [Wed, 13 May 2020 19:19:21 +0000 (12:19 -0700)] 
Merge branch 'cc/upload-pack-v2-fetch-fix'

Serving a "git fetch" client over "git://" and "ssh://" protocols
using the on-wire protocol version 2 was buggy on the server end
when the client needs to make a follow-up request to
e.g. auto-follow tags.

* cc/upload-pack-v2-fetch-fix:
  upload-pack: clear filter_options for each v2 fetch command

3 years agoMerge branch 'ds/sparse-updates-oob-access-fix'
Junio C Hamano [Wed, 13 May 2020 19:19:20 +0000 (12:19 -0700)] 
Merge branch 'ds/sparse-updates-oob-access-fix'

The code to skip unmerged paths in the index when sparse checkout
is in use would have made out-of-bound access of the in-core index
when the last path was unmerged, which has been corrected.

* ds/sparse-updates-oob-access-fix:
  unpack-trees: avoid array out-of-bounds error

3 years agoMerge branch 'ss/submodule-set-url-in-c'
Junio C Hamano [Wed, 13 May 2020 19:19:20 +0000 (12:19 -0700)] 
Merge branch 'ss/submodule-set-url-in-c'

Rewriting various parts of "git submodule" in C continues.

* ss/submodule-set-url-in-c:
  submodule: port subcommand 'set-url' from shell to C

3 years agoMerge branch 'dd/bloom-sparse-fix'
Junio C Hamano [Wed, 13 May 2020 19:19:20 +0000 (12:19 -0700)] 
Merge branch 'dd/bloom-sparse-fix'

Code clean-up.

* dd/bloom-sparse-fix:
  bloom: fix `make sparse` warning

3 years agoMerge branch 'jk/ci-only-on-selected-branches'
Junio C Hamano [Wed, 13 May 2020 19:19:19 +0000 (12:19 -0700)] 
Merge branch 'jk/ci-only-on-selected-branches'

Instead of always building all branches at GitHub via Actions,
users can specify which branches to build.

* jk/ci-only-on-selected-branches:
  ci: allow per-branch config for GitHub Actions

3 years agoMerge branch 'ss/faq-fetch-pull'
Junio C Hamano [Wed, 13 May 2020 19:19:19 +0000 (12:19 -0700)] 
Merge branch 'ss/faq-fetch-pull'

Random bits of FAQ.

* ss/faq-fetch-pull:
  gitfaq: fetching and pulling a repository

3 years agoMerge branch 'ss/faq-ignore'
Junio C Hamano [Wed, 13 May 2020 19:19:19 +0000 (12:19 -0700)] 
Merge branch 'ss/faq-ignore'

Random bits of FAQ.

* ss/faq-ignore:
  gitfaq: files in .gitignore are tracked

3 years agoMerge branch 'jc/auto-gc-quiet'
Junio C Hamano [Wed, 13 May 2020 19:19:19 +0000 (12:19 -0700)] 
Merge branch 'jc/auto-gc-quiet'

Teach "am", "commit", "merge" and "rebase", when they are run with
the "--quiet" option, to pass "--quiet" down to "gc --auto".

* jc/auto-gc-quiet:
  auto-gc: pass --quiet down from am, commit, merge and rebase
  auto-gc: extract a reusable helper from "git fetch"

3 years agoMerge branch 'cb/credential-doc-fixes'
Junio C Hamano [Wed, 13 May 2020 19:19:18 +0000 (12:19 -0700)] 
Merge branch 'cb/credential-doc-fixes'

Minor in-code comments and documentation updates around credential
API.

* cb/credential-doc-fixes:
  credential: document protocol updates
  credential: update gitcredentials documentation
  credential: correct order of parameters for credential_match
  credential: update description for credential_from_url_gently

3 years agoMerge branch 'tb/bitmap-walk-with-tree-zero-filter'
Junio C Hamano [Wed, 13 May 2020 19:19:18 +0000 (12:19 -0700)] 
Merge branch 'tb/bitmap-walk-with-tree-zero-filter'

The object walk with object filter "--filter=tree:0" can now take
advantage of the pack bitmap when available.

* tb/bitmap-walk-with-tree-zero-filter:
  pack-bitmap: pass object filter to fill-in traversal
  pack-bitmap.c: support 'tree:0' filtering
  pack-bitmap.c: make object filtering functions generic
  list-objects-filter: treat NULL filter_options as "disabled"

3 years agoMerge branch 'tb/shallow-cleanup'
Junio C Hamano [Wed, 13 May 2020 19:19:18 +0000 (12:19 -0700)] 
Merge branch 'tb/shallow-cleanup'

Code cleanup.

* tb/shallow-cleanup:
  shallow: use struct 'shallow_lock' for additional safety
  shallow.h: document '{commit,rollback}_shallow_file'
  shallow: extract a header file for shallow-related functions
  commit: make 'commit_graft_pos' non-static

3 years agot1509: correct i18n test
Đoàn Trần Công Danh [Wed, 13 May 2020 13:23:06 +0000 (20:23 +0700)] 
t1509: correct i18n test

git-init(1)'s messages is subjected to i18n.
They should be tested by test_i18n* family.

Fix them.

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agotrace2: log progress time and throughput
Emily Shaffer [Tue, 12 May 2020 21:44:20 +0000 (14:44 -0700)] 
trace2: log progress time and throughput

Rather than teaching only one operation, like 'git fetch', how to write
down throughput to traces, we can learn about a wide range of user
operations that may seem slow by adding tooling to the progress library
itself. Operations which display progress are likely to be slow-running
and the kind of thing we want to monitor for performance anyways. By
showing object counts and data transfer size, we should be able to
make some derived measurements to ensure operations are scaling the way
we expect.

Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocompletion: offer '--(no-)patch' among 'git log' options
SZEDER Gábor [Mon, 11 May 2020 11:56:14 +0000 (11:56 +0000)] 
completion: offer '--(no-)patch' among 'git log' options

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agobloom: use num_changes not nr for limit detection
Derrick Stolee [Mon, 11 May 2020 11:56:13 +0000 (11:56 +0000)] 
bloom: use num_changes not nr for limit detection

As diff_tree_oid() computes a diff, it will terminate early if the
total number of changed paths is strictly larger than max_changes.
This includes the directories that changed, not just the file paths.
However, only the file paths are reflected in the resulting diff
queue's "nr" value.

Use the "num_changes" from diffopt to check if the diff terminated
early. This is incredibly important, as it can result in incorrect
filters! For example, the first commit in the Linux kernel repo
reports only 471 changes, but since these are nested inside several
directories they expand to 513 "real" changes, and in fact the
total list of changes is not reported. Thus, the computed filter
for this commit is incorrect.

Demonstrate the subtle difference by using one fewer file change
in the 'get bloom filter for commit with 513 changes' test. Before,
this edited 513 files inside "bigDir" which hit this inequality.
However, dropping the file count by one demonstrates how the
previous inequality was incorrect but the new one is correct.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agobloom: de-duplicate directory entries
Derrick Stolee [Mon, 11 May 2020 11:56:12 +0000 (11:56 +0000)] 
bloom: de-duplicate directory entries

When computing a changed-path Bloom filter, we need to take the
files that changed from the diff computation and extract the parent
directories. That way, a directory pathspec such as "Documentation"
could match commits that change "Documentation/git.txt".

However, the current code does a poor job of this process. The paths
are added to a hashmap, but we do not check if an entry already
exists with that path. This can create many duplicate entries and
cause the filter to have a much larger length than it should. This
means that the filter is more sparse than intended, which helps the
false positive rate, but wastes a lot of space.

Properly use hashmap_get() before hashmap_add(). Also be sure to
include a comparison function so these can be matched correctly.

This has an effect on a test in t0095-bloom.sh. This makes sense,
there are ten changes inside "smallDir" so the total number of
paths in the filter should be 11. This would result in 11 * 10 bits
required, and with 8 bits per byte, this results in 14 bytes.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoDocumentation: changed-path Bloom filters use byte words
Derrick Stolee [Mon, 11 May 2020 11:56:11 +0000 (11:56 +0000)] 
Documentation: changed-path Bloom filters use byte words

In Documentation/technical/commit-graph-format.txt, the definition
of the BIDX chunk specifies the length is a number of 8-byte words.
During development we discovered that using 8-byte words in the
Murmur3 hash algorithm causes issues with big-endian versus little-
endian machines. Thus, the hash algorithm was adapted to work on a
byte-by-byte basis. However, this caused a change in the definition
of a "word" in bloom.h. Now, a "word" is a single byte, which allows
filters to be as small as two bytes. These length-two filters are
demonstrated in t0095-bloom.sh, and a larger filter of length 25 is
demonstrated as well.

The original point of using 8-byte words was for alignment reasons.
It also presented opportunities for extremely sparse Bloom filters
when there were a small number of changes at a commit, creating a
very low false-positive rate. However, modifying the format at this
point is unlikely to be a valuable exercise. Also, this use of
single-byte granularity does present opportunities to save space.
It is unclear if 8-byte alignment of the filters would present any
meaningful performance benefits.

Modify the format document to reflect reality.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agobloom: parse commit before computing filters
Derrick Stolee [Mon, 11 May 2020 11:56:10 +0000 (11:56 +0000)] 
bloom: parse commit before computing filters

When computing changed-path Bloom filters for a commit, we need to
know if the commit has a parent or not. If the commit is not parsed,
then its parent pointer will be NULL.

As far as I can tell, the only opportunity to reach this code
without parsing the commit is inside "test-tool bloom
get_filter_for_commit" but it is best to be safe.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agofsck: report non-consecutive duplicate names in trees
René Scharfe [Sun, 10 May 2020 16:12:16 +0000 (18:12 +0200)] 
fsck: report non-consecutive duplicate names in trees

Tree entries are sorted in path order, meaning that directory names get
a slash ('/') appended implicitly.  Git fsck checks if trees contains
consecutive duplicates, but due to that ordering there can be
non-consecutive duplicates as well if one of them is a directory and the
other one isn't.  Such a tree cannot be fully checked out.

Find these duplicates by recording candidate file names on a stack and
check candidate directory names against that stack to find matches.

Suggested-by: Brandon Williams <bwilliamseng@gmail.com>
Original-test-by: Brandon Williams <bwilliamseng@gmail.com>
Signed-off-by: René Scharfe <l.s.r@web.de>
Reviewed-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogit-p4: recover from inconsistent perforce history
Andrew Oakley [Sun, 10 May 2020 10:16:50 +0000 (11:16 +0100)] 
git-p4: recover from inconsistent perforce history

Perforce allows you commit files and directories with the same name,
so you could have files //depot/foo and //depot/foo/bar both checked
in.  A p4 sync of a repository in this state fails.  Deleting one of
the files recovers the repository.

When this happens we want git-p4 to recover in the same way as
perforce.

Note that Perforce has this change in their 2017.1 version:

     Bugs fixed in 2017.1
     #1489051 (Job #2170) **
        Submitting a file with the same name as an existing depot
        directory path (or vice versa) will now be rejected.

so people hopefully will not creating damaged Perforce repos
anymore, but "git p4" needs to be able to interact with already
corrupt ones.

Signed-off-by: Andrew Oakley <andrew@adoakley.name>
Reviewed-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agomulti-pack-index: respect repack.packKeptObjects=false
Derrick Stolee [Sun, 10 May 2020 16:07:34 +0000 (16:07 +0000)] 
multi-pack-index: respect repack.packKeptObjects=false

When selecting a batch of pack-files to repack in the "git
multi-pack-index repack" command, Git should respect the
repack.packKeptObjects config option. When false, this option says that
the pack-files with an associated ".keep" file should not be repacked.
This config value is "false" by default.

There are two cases for selecting a batch of objects. The first is the
case where the input batch-size is zero, which specifies "repack
everything". The second is with a non-zero batch size, which selects
pack-files using a greedy selection criteria. Both of these cases are
updated and tested.

Reported-by: Son Luong Ngoc <sluongng@gmail.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agomidx: teach "git multi-pack-index repack" honor "git repack" configurations
Son Luong Ngoc [Sun, 10 May 2020 16:07:33 +0000 (16:07 +0000)] 
midx: teach "git multi-pack-index repack" honor "git repack" configurations

When the "repack" subcommand of "git multi-pack-index" command
creates new packfile(s), it does not call the "git repack"
command but instead directly calls the "git pack-objects"
command, and the configuration variables meant for the "git
repack" command, like "repack.usedaeltabaseoffset", are ignored.

Check the configuration variables used by "git repack" ourselves
in "git multi-index-pack" and pass the corresponding options to
underlying "git pack-objects".

Note that `repack.writeBitmaps` configuration is ignored, as the
pack bitmap facility is useful only with a single packfile.

Signed-off-by: Son Luong Ngoc <sluongng@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agorebase --autosquash: fix a potential segfault
Johannes Schindelin [Sat, 9 May 2020 19:23:39 +0000 (19:23 +0000)] 
rebase --autosquash: fix a potential segfault

When rearranging the todo list so that the fixups/squashes are reordered
just after the commits they intend to fix up, we use two arrays to
maintain that list: `next` and `tail`.

The idea is that `next[i]`, if set to a non-negative value, contains the
index of the item that should be rearranged just after the `i`th item.

To avoid having to walk the entire `next` chain when appending another
fixup/squash, we also store the end of the `next` chain in `tail[i]`.

The logic we currently use to update these array items is based on the
assumption that given a fixup/squash item at index `i`, we just found
the index `i2` indicating the first item in that fixup chain.

However, as reported by Paul Ganssle, that need not be true: the special
form `fixup! <commit-hash>` is allowed to point to _another_ fixup
commit in the middle of the fixup chain.

Example:

* 0192a To fixup
* 02f12 fixup! To fixup
* 03763 fixup! To fixup
* 04ecb fixup! 02f12

Note how the fourth commit targets the second commit, which is already a
fixup that targets the first commit.

Previously, we would update `next` and `tail` under our assumption that
every `fixup!` commit would find the start of the `fixup!`/`squash!`
chain. This would lead to a segmentation fault because we would actually
end up with a `next[i]` pointing to a `fixup!` but the corresponding
`tail[i]` pointing nowhere, which would the lead to a segmentation
fault.

Let's fix this by _inserting_, rather than _appending_, the item. In
other words, if we make a given line successor of another line, we do
not simply forget any previously set successor of the latter, but make
it a successor of the former.

In the above example, at the point when we insert 04ecb just after
02f12, 03763 would already be recorded as a successor of 04ecb, and we
now "squeeze in" 04ecb.

To complete the idea, we now no longer assume that `next[i]` pointing to
a line means that `last[i]` points to a line, too. Instead, we extend
the concept of `last` to cover also partial `fixup!`/`squash!` chains,
i.e. chains starting in the middle of a larger such chain.

In the above example, after processing all lines, `last[0]`
(corresponding to 0192a) would point to 03763, which indeed is the end
of the overall `fixup!` chain, and `last[1]` (corresponding to 02f12)
would point to 04ecb (which is the last `fixup!` targeting 02f12, but it
has 03763 as successor, i.e. it is not the end of overall `fixup!`
chain).

Reported-by: Paul Ganssle <paul@ganssle.io>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoThe eighth batch
Junio C Hamano [Fri, 8 May 2020 21:24:44 +0000 (14:24 -0700)] 
The eighth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'cb/test-bash-lineno-fix'
Junio C Hamano [Fri, 8 May 2020 21:25:12 +0000 (14:25 -0700)] 
Merge branch 'cb/test-bash-lineno-fix'

Recent change to show files and line numbers of a breakage during
test (only available when running the tests with bash) were hurting
other shells with syntax errors, which has been corrected.

* cb/test-bash-lineno-fix:
  t/test_lib: avoid naked bash arrays in file_lineno

3 years agoMerge branch 'cb/t0000-use-the-configured-shell'
Junio C Hamano [Fri, 8 May 2020 21:25:12 +0000 (14:25 -0700)] 
Merge branch 'cb/t0000-use-the-configured-shell'

The basic test did not honor $TEST_SHELL_PATH setting, which has
been corrected.

* cb/t0000-use-the-configured-shell:
  t/t0000-basic: make sure subtests also use TEST_SHELL_PATH

3 years agoMerge branch 'bc/doc-credential-helper-value'
Junio C Hamano [Fri, 8 May 2020 21:25:10 +0000 (14:25 -0700)] 
Merge branch 'bc/doc-credential-helper-value'

Doc update.

* bc/doc-credential-helper-value:
  docs: document credential.helper allowed values

3 years agoMerge branch 'dl/doc-stash-remove-mention-of-reflog'
Junio C Hamano [Fri, 8 May 2020 21:25:09 +0000 (14:25 -0700)] 
Merge branch 'dl/doc-stash-remove-mention-of-reflog'

Doc update.

* dl/doc-stash-remove-mention-of-reflog:
  Doc: reference the "stash list" in autostash docs

3 years agoMerge branch 'cb/avoid-colliding-with-netbsd-hmac'
Junio C Hamano [Fri, 8 May 2020 21:25:09 +0000 (14:25 -0700)] 
Merge branch 'cb/avoid-colliding-with-netbsd-hmac'

The <stdlib.h> header on NetBSD brings in its own definition of
hmac() function (eek), which conflicts with our own and unrelated
function with the same name.  Our function has been renamed to work
around the issue.

* cb/avoid-colliding-with-netbsd-hmac:
  builtin/receive-pack: avoid generic function name hmac()

3 years agoMerge branch 'es/restore-staged-from-head-by-default'
Junio C Hamano [Fri, 8 May 2020 21:25:08 +0000 (14:25 -0700)] 
Merge branch 'es/restore-staged-from-head-by-default'

"git restore --staged --worktree" now defaults to take the contents
out of "HEAD", instead of erring out.

* es/restore-staged-from-head-by-default:
  restore: default to HEAD when combining --staged and --worktree

3 years agoMerge branch 'jk/arith-expansion-coding-guidelines'
Junio C Hamano [Fri, 8 May 2020 21:25:07 +0000 (14:25 -0700)] 
Merge branch 'jk/arith-expansion-coding-guidelines'

The coding guideline for shell scripts instructed to refer to a
variable with dollar-sign inside arithmetic expansion to work
around a bug in old versions of dash, which is a thing of the past.
Now we are not forbidden from writing $((var+1)).

* jk/arith-expansion-coding-guidelines:
  CodingGuidelines: drop arithmetic expansion advice to use "$x"

3 years agoMerge branch 'ds/sparse-allow-empty-working-tree'
Junio C Hamano [Fri, 8 May 2020 21:25:06 +0000 (14:25 -0700)] 
Merge branch 'ds/sparse-allow-empty-working-tree'

The sparse-checkout patterns have been forbidden from excluding all
paths, leaving an empty working tree, for a long time.  This
limitation has been lifted.

* ds/sparse-allow-empty-working-tree:
  sparse-checkout: stop blocking empty workdirs

3 years agoMerge branch 'jt/commit-graph-plug-memleak'
Junio C Hamano [Fri, 8 May 2020 21:25:05 +0000 (14:25 -0700)] 
Merge branch 'jt/commit-graph-plug-memleak'

Fix a leak noticed by fuzzer.

* jt/commit-graph-plug-memleak:
  commit-graph: avoid memory leaks

3 years agoMerge branch 'jk/for-each-ref-multi-key-sort-fix'
Junio C Hamano [Fri, 8 May 2020 21:25:04 +0000 (14:25 -0700)] 
Merge branch 'jk/for-each-ref-multi-key-sort-fix'

"git branch" and other "for-each-ref" variants accepted multiple
--sort=<key> options in the increasing order of precedence, but it
had a few breakages around "--ignore-case" handling, and tie-breaking
with the refname, which have been fixed.

* jk/for-each-ref-multi-key-sort-fix:
  ref-filter: apply fallback refname sort only after all user sorts
  ref-filter: apply --ignore-case to all sorting keys

3 years agoMerge branch 'jk/credential-sample-update'
Junio C Hamano [Fri, 8 May 2020 21:25:02 +0000 (14:25 -0700)] 
Merge branch 'jk/credential-sample-update'

The samples in the credential documentation has been updated to
make it clear that we depict what would appear in the .git/config
file, by adding appropriate quotes as needed..

* jk/credential-sample-update:
  gitcredentials(7): make shell-snippet example more realistic
  gitcredentials(7): clarify quoting of helper examples

3 years agoMerge branch 'ah/userdiff-markdown'
Junio C Hamano [Fri, 8 May 2020 21:25:01 +0000 (14:25 -0700)] 
Merge branch 'ah/userdiff-markdown'

The userdiff patterns for Markdown documents have been added.

* ah/userdiff-markdown:
  userdiff: support Markdown

3 years agoMerge branch 'cb/credential-store-ignore-bogus-lines'
Junio C Hamano [Fri, 8 May 2020 21:25:01 +0000 (14:25 -0700)] 
Merge branch 'cb/credential-store-ignore-bogus-lines'

With the recent tightening of the code that is used to parse
various parts of a URL for use in the credential subsystem, a
hand-edited credential-store file causes the credential helper to
die, which is a bit too harsh to the users.  Demote the error
behaviour to just ignore and keep using well-formed lines instead.

* cb/credential-store-ignore-bogus-lines:
  credential-store: ignore bogus lines from store file
  credential-store: document the file format a bit more

3 years agoMerge branch 'dl/switch-c-option-in-error-message'
Junio C Hamano [Fri, 8 May 2020 21:25:00 +0000 (14:25 -0700)] 
Merge branch 'dl/switch-c-option-in-error-message'

In error messages that "git switch" mentions its option to create a
new branch, "-b/-B" options were shown, where "-c/-C" options
should be, which has been corrected.

* dl/switch-c-option-in-error-message:
  switch: fix errors and comments related to -c and -C

3 years agoCodingGuidelines: do not ==/!= compare with 0 or '\0' or NULL
Junio C Hamano [Fri, 8 May 2020 17:51:21 +0000 (13:51 -0400)] 
CodingGuidelines: do not ==/!= compare with 0 or '\0' or NULL

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoupload-pack: clear filter_options for each v2 fetch command
Christian Couder [Fri, 8 May 2020 08:01:15 +0000 (10:01 +0200)] 
upload-pack: clear filter_options for each v2 fetch command

Because of the request/response model of protocol v2, the
upload_pack_v2() function is sometimes called twice in the same
process, while 'struct list_objects_filter_options filter_options'
was declared as static at the beginning of 'upload-pack.c'.

This made the check in list_objects_filter_die_if_populated(), which
is called by process_args(), fail the second time upload_pack_v2() is
called, as filter_options had already been populated the first time.

To fix that, filter_options is not static any more. It's now owned
directly by upload_pack(). It's now also part of 'struct
upload_pack_data', so that it's owned indirectly by upload_pack_v2().

In the long term, the goal is to also have upload_pack() use
'struct upload_pack_data', so adding filter_options to this struct
makes more sense than to have it owned directly by upload_pack_v2().

This fixes the first of the 2 bugs documented by d0badf8797
(partial-clone: demonstrate bugs in partial fetch, 2020-02-21).

Helped-by: Derrick Stolee <dstolee@microsoft.com>
Helped-by: Jeff King <peff@peff.net>
Helped-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agounpack-trees: avoid array out-of-bounds error
Derrick Stolee [Thu, 7 May 2020 13:17:33 +0000 (13:17 +0000)] 
unpack-trees: avoid array out-of-bounds error

The loop in warn_conflicted_path() that checks for the count of
entries with the same path uses "i+count" for the array
entry. However, the loop only verifies that the value of count is
below the array size. Fix this by adding i to the condition.

I hit this condition during a test of the in-tree sparse-checkout
feature, so it is exercised by the end of the series.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
[jc: readability fix]
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agobisect: allow CRLF line endings in "git bisect replay" input
Christopher Warrington [Thu, 7 May 2020 21:29:40 +0000 (21:29 +0000)] 
bisect: allow CRLF line endings in "git bisect replay" input

We advertise that the bisect log can be corrected in your editor
before being fed to "git bisect replay", but some editors may
turn the line endings to CRLF.

Update the parser of the input lines so that the CR at the end of
the line gets ignored.

Were anyone to intentionally be using terms/revs with embedded CRs,
replaying such bisects will no longer work with this change. I suspect
that this is incredibly rare.

Signed-off-by: Christopher Warrington <chwarr@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agosubmodule: port subcommand 'set-url' from shell to C
Shourya Shukla [Fri, 8 May 2020 06:21:36 +0000 (11:51 +0530)] 
submodule: port subcommand 'set-url' from shell to C

Convert submodule subcommand 'set-url' to a builtin. Port 'set-url' to
'submodule--helper.c' and call the latter via 'git-submodule.sh'.

Signed-off-by: Shourya Shukla <shouryashukla.oo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agobugreport: collect list of populated hooks
Emily Shaffer [Fri, 8 May 2020 00:53:57 +0000 (17:53 -0700)] 
bugreport: collect list of populated hooks

Occasionally a failure a user is seeing may be related to a specific
hook which is being run, perhaps without the user realizing. While the
contents of hooks can be sensitive - containing user data or process
information specific to the user's organization - simply knowing that a
hook is being run at a certain stage can help us to understand whether
something is going wrong.

Without a definitive list of hook names within the code, we compile our
own list from the documentation. This is likely prone to bitrot, but
designing a single source of truth for acceptable hooks is too much
overhead for this small change to the bugreport tool.

Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agobloom: fix `make sparse` warning
Đoàn Trần Công Danh [Thu, 7 May 2020 23:51:02 +0000 (00:51 +0100)] 
bloom: fix `make sparse` warning

* We need a `final_new_line` to make our source code as text file, per
  POSIX and C specification.
* `bloom_filters` should be limited to interal linkage only

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocredential: document protocol updates
Carlo Marcelo Arenas Belón [Wed, 6 May 2020 21:47:26 +0000 (14:47 -0700)] 
credential: document protocol updates

Document protocol changes after CVE-2020-11008, including the removal of
references to the override of attributes which is no longer recommended
after CVE-2020-5260 and that might be removed in the future.

While at it do some improvements for clarity and consistency.

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocredential: update gitcredentials documentation
Carlo Marcelo Arenas Belón [Wed, 6 May 2020 21:47:25 +0000 (14:47 -0700)] 
credential: update gitcredentials documentation

Clarify the expected effect of all attributes and how the helpers
are expected to handle them and the context where they operate.

While at it, space the descriptions for clarity, and add a paragraph
mentioning the early termination in the list processing of helpers,
to complement the one about the special "quit" attribute.

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot/test_lib: avoid naked bash arrays in file_lineno
Carlo Marcelo Arenas Belón [Thu, 7 May 2020 17:57:06 +0000 (10:57 -0700)] 
t/test_lib: avoid naked bash arrays in file_lineno

662f9cf154 (tests: when run in Bash, annotate test failures with file
name/line number, 2020-04-11), introduces a way to report the location
(file:lineno) of a failed test case by traversing the bash callstack.

The implementation requires bash and uses shell arrays and is therefore
protected by a guard but NetBSD sh will still have to parse the function
and therefore will result in:

  ** t0000-basic.sh ***
  ./test-lib.sh: 681: Syntax error: Bad substitution

Enclose the bash specific code inside an eval to avoid parsing errors in
the same way than 5826b7b595 (test-lib: check Bash version for '-x'
without using shell arrays, 2019-01-03)

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot/t0000-basic: make sure subtests also use TEST_SHELL_PATH
Carlo Marcelo Arenas Belón [Thu, 7 May 2020 01:07:46 +0000 (18:07 -0700)] 
t/t0000-basic: make sure subtests also use TEST_SHELL_PATH

3f824e91c8 (t/Makefile: introduce TEST_SHELL_PATH, 2017-12-08) allows for
setting a shell for running the tests, but the generated subtests weren't
updated.

Correct that and while at it update it to use write_script.

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoci: allow per-branch config for GitHub Actions
Jeff King [Thu, 7 May 2020 16:20:11 +0000 (12:20 -0400)] 
ci: allow per-branch config for GitHub Actions

Depending on the workflows of individual developers, it can either be
convenient or annoying that our GitHub Actions CI jobs are run on every
branch. As an example of annoying: if you carry many half-finished
work-in-progress branches and rebase them frequently against master,
you'd get tons of failure reports that aren't interesting (not to
mention the wasted CPU).

This commit adds a new job which checks a special branch within the
repository for CI config, and then runs a shell script it finds there to
decide whether to skip the rest of the tests. The default will continue
to run tests for all refs if that branch or script is missing.

There have been a few alternatives discussed:

One option is to carry information in the commit itself about whether it
should be tested, either in the tree itself (changing the workflow YAML
file) or in the commit message (a "[skip ci]" flag or similar). But
these are frustrating and error-prone to use:

  - you have to manually apply them to each branch that you want to mark

  - it's easy for them to leak into other workflows, like emailing patches

We could likewise try to get some information from the branch name. But
that leads to debates about whether the default should be "off" or "on",
and overriding still ends up somewhat awkward. If we default to "on",
you have to remember to name your branches appropriately to skip CI. And
if "off", you end up having to contort your branch names or duplicate
your pushes with an extra refspec.

By comparison, this commit's solution lets you specify your config once
and forget about it, and all of the data is off in its own ref, where it
can be changed by individual forks without touching the main tree.

There were a few design decisions that came out of on-list discussion.
I'll summarize here:

 - we could use GitHub's API to retrieve the config ref, rather than a
   real checkout (and then just operate on it via some javascript). We
   still have to spin up a VM and contact GitHub over the network from
   it either way, so it ends up not being much faster. I opted to go
   with shell to keep things similar to our other tools (and really
   could implement allow-refs in any language you want). This also makes
   it easy to test your script locally, and to modify it within the
   context of a normal git.git tree.

 - we could keep the well-known refname out of refs/heads/ to avoid
   cluttering the branch namespace. But that makes it awkward to
   manipulate. By contrast, you can just "git checkout ci-config" to
   make changes.

 - we could assume the ci-config ref has nothing in it except config
   (i.e., a branch unrelated to the rest of git.git). But dealing with
   orphan branches is awkward. Instead, we'll do our best to efficiently
   check out only the ci/config directory using a shallow partial clone,
   which allows your ci-config branch to be just a normal branch, with
   your config changes on top.

 - we could provide a simpler interface, like a static list of ref
   patterns. But we can't get out of spinning up a whole VM anyway, so
   we might as well use that feature to make the config as flexible as
   possible. If we add more config, we should be able to reuse our
   partial-clone to set more outputs.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoauto-gc: pass --quiet down from am, commit, merge and rebase
Junio C Hamano [Wed, 6 May 2020 20:18:30 +0000 (13:18 -0700)] 
auto-gc: pass --quiet down from am, commit, merge and rebase

These commands take the --quiet option for their own operation, but
they forget to pass the option down when they invoke "git gc --auto"
internally.

Teach them to do so using the run_auto_gc() helper we added in the
previous step.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoauto-gc: extract a reusable helper from "git fetch"
Junio C Hamano [Wed, 6 May 2020 20:18:29 +0000 (13:18 -0700)] 
auto-gc: extract a reusable helper from "git fetch"

Back in 1991006c (fetch: convert argv_gc_auto to struct argv_array,
2014-08-16), we taught "git fetch --quiet" to pass the "--quiet"
option down to "gc --auto".  This issue, however, is not limited to
"fetch":

    $ git grep -e 'gc.*--auto' \*.c

finds hits in "am", "commit", "merge", and "rebase" and these
commands do not pass "--quiet" down to "gc --auto" when they
themselves are told to be quiet.

As a preparatory step, let's introduce a helper function
run_auto_gc(), that the caller can pass a boolean "quiet",
and redo the fix to "git fetch" using the helper.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot5500: count objects through stderr, not trace
Jonathan Tan [Wed, 6 May 2020 22:07:40 +0000 (15:07 -0700)] 
t5500: count objects through stderr, not trace

In two tests introduced by 4fa3f00abb ("fetch-pack: in protocol v2,
in_vain only after ACK", 2020-04-28) and 2f0a093dd6 ("fetch-pack: in
protocol v2, reset in_vain upon ACK", 2020-04-28), the count of objects
downloaded is checked by grepping for a specific message in the packet
trace. However, this is flaky as that specific message may be delivered
over 2 or more packet lines.

Instead, grep over stderr, just like the "fetch creating new shallow
root" test in the same file.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogitfaq: fetching and pulling a repository
Shourya Shukla [Wed, 6 May 2020 17:11:10 +0000 (22:41 +0530)] 
gitfaq: fetching and pulling a repository

Add an issue in 'Common Issues' section which addresses the confusion
between performing a 'fetch' and a 'pull'.

Helped-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Shourya Shukla <shouryashukla.oo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agodocs: document credential.helper allowed values
brian m. carlson [Tue, 5 May 2020 23:12:26 +0000 (23:12 +0000)] 
docs: document credential.helper allowed values

gitcredentials(7) already mentions several possible invocations that one
can use as the value for credential.helper.  However, many people are
not aware that there are other options than a simple credential helper
name, so let's place some explanatory text in the documentation for
credential.helper as well.

We still refer the user to gitcredential(7) for additional explanations
and helpful examples.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogitfaq: files in .gitignore are tracked
Shourya Shukla [Wed, 6 May 2020 08:00:20 +0000 (13:30 +0530)] 
gitfaq: files in .gitignore are tracked

Add issue in 'Common Issues' section which addresses the problem of
Git tracking files/paths mentioned in '.gitignore'.

Signed-off-by: Shourya Shukla <shouryashukla.oo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoDoc: reference the "stash list" in autostash docs
Denton Liu [Tue, 5 May 2020 13:00:59 +0000 (09:00 -0400)] 
Doc: reference the "stash list" in autostash docs

In documentation pertaining to autostash behavior, we refer to the
"stash reflog". This description is too low-level as the reflog refers
to an implementation detail of how the stash works and, for end-users,
they do not need to be aware of this at all.

Change references of "stash reflog" to "stash list", which should
provide more accessible terminology for end-users.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoThe seventh batch
Junio C Hamano [Tue, 5 May 2020 21:51:29 +0000 (14:51 -0700)] 
The seventh batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'js/partial-urlmatch'
Junio C Hamano [Tue, 5 May 2020 21:54:29 +0000 (14:54 -0700)] 
Merge branch 'js/partial-urlmatch'

The same as js/partial-urlmatch-2.17, built on more recent codebase
to avoid unnecessary merge conflicts.

* js/partial-urlmatch:
  credential: handle `credential.<partial-URL>.<key>` again
  credential: optionally allow partial URLs in credential_from_url_gently()

3 years agoMerge branch 'js/partial-urlmatch-2.17'
Junio C Hamano [Tue, 5 May 2020 21:54:29 +0000 (14:54 -0700)] 
Merge branch 'js/partial-urlmatch-2.17'

Recent updates broke parsing of "credential.<url>.<key>" where
<url> is not a full URL (e.g. [credential "https://"] helper = ...)
stopped working, which has been corrected.

* js/partial-urlmatch-2.17:
  credential: handle `credential.<partial-URL>.<key>` again
  credential: optionally allow partial URLs in credential_from_url_gently()
  credential: fix grammar

3 years agoMerge branch 'tb/commit-graph-perm-bits'
Junio C Hamano [Tue, 5 May 2020 21:54:28 +0000 (14:54 -0700)] 
Merge branch 'tb/commit-graph-perm-bits'

Some of the files commit-graph subsystem keeps on disk did not
correctly honor the core.sharedRepository settings and some were
left read-write.

* tb/commit-graph-perm-bits:
  commit-graph.c: make 'commit-graph-chain's read-only
  commit-graph.c: ensure graph layers respect core.sharedRepository
  commit-graph.c: write non-split graphs as read-only
  lockfile.c: introduce 'hold_lock_file_for_update_mode'
  tempfile.c: introduce 'create_tempfile_mode'

3 years agoMerge branch 'dl/push-recurse-submodules-fix'
Junio C Hamano [Tue, 5 May 2020 21:54:28 +0000 (14:54 -0700)] 
Merge branch 'dl/push-recurse-submodules-fix'

Code cleanup.

* dl/push-recurse-submodules-fix:
  push: unset PARSE_OPT_OPTARG for --recurse-submodules

3 years agoMerge branch 'dl/opt-callback-cleanup'
Junio C Hamano [Tue, 5 May 2020 21:54:27 +0000 (14:54 -0700)] 
Merge branch 'dl/opt-callback-cleanup'

Code cleanup.

* dl/opt-callback-cleanup:
  Use OPT_CALLBACK and OPT_CALLBACK_F

3 years agoMerge branch 'jk/test-fail-prereqs-fix'
Junio C Hamano [Tue, 5 May 2020 21:54:27 +0000 (14:54 -0700)] 
Merge branch 'jk/test-fail-prereqs-fix'

Test update.

* jk/test-fail-prereqs-fix:
  t0000: disable GIT_TEST_FAIL_PREREQS in sub-tests

3 years agoMerge branch 'dd/iso-8601-updates'
Junio C Hamano [Tue, 5 May 2020 21:54:26 +0000 (14:54 -0700)] 
Merge branch 'dd/iso-8601-updates'

The approxidate parser learns to parse seconds with fraction.

* dd/iso-8601-updates:
  date.c: allow compact version of ISO-8601 datetime
  date.c: skip fractional second part of ISO-8601
  date.c: validate and set time in a helper function
  date.c: s/is_date/set_date/

3 years agoMerge branch 'bc/wildcard-credential'
Junio C Hamano [Tue, 5 May 2020 21:54:26 +0000 (14:54 -0700)] 
Merge branch 'bc/wildcard-credential'

Update the parser used for credential.<URL>.<variable>
configuration, to handle <URL>s with '/' in them correctly.

* bc/wildcard-credential:
  credential: fix matching URLs with multiple levels in path

3 years agorestore: default to HEAD when combining --staged and --worktree
Eric Sunshine [Tue, 5 May 2020 07:17:16 +0000 (03:17 -0400)] 
restore: default to HEAD when combining --staged and --worktree

By default, files are restored from the index for --worktree, and from
HEAD for --staged. When --worktree and --staged are combined, --source
must be specified to disambiguate the restore source[1], thus making it
cumbersome to restore a file in both the worktree and the index.

However, HEAD is also a reasonable default for --worktree when combined
with --staged, so make it the default anytime --staged is used (whether
combined with --worktree or not).

[1]: Due to an oversight, the --source requirement, though documented,
is not actually enforced.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agobuiltin/receive-pack: avoid generic function name hmac()
Carlo Marcelo Arenas Belón [Tue, 5 May 2020 09:53:26 +0000 (02:53 -0700)] 
builtin/receive-pack: avoid generic function name hmac()

fabec2c5c3 (builtin/receive-pack: switch to use the_hash_algo, 2019-08-18)
renames hmac_sha1 to hmac, as it was updated to use the hash function used
by git (which won't be sha1 in the future).

hmac() is provided by NetBSD >= 8 libc and therefore conflicts as shown by :

builtin/receive-pack.c:421:13: error: conflicting types for 'hmac'
 static void hmac(unsigned char *out,
             ^~~~
In file included from ./git-compat-util.h:172:0,
                 from ./builtin.h:4,
                 from builtin/receive-pack.c:1:
/usr/include/stdlib.h:305:10: note: previous declaration of 'hmac' was here
 ssize_t  hmac(const char *, const void *, size_t, const void *, size_t, void *,
          ^~~~

Rename it again to hmac_hash to reflect it will use the git's defined hash
function and avoid the conflict, while at it update a comment to better
describe the HMAC function that was used.

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocredential: correct order of parameters for credential_match
Carlo Marcelo Arenas Belón [Tue, 5 May 2020 01:39:06 +0000 (18:39 -0700)] 
credential: correct order of parameters for credential_match

Since the beginning in 118250728e (credential: apply helper config,
2011-12-10), the declaration for that function used a different order
than the implementation.

All callers use the same order than the implementation, so update
the declaration in credential.h to match.

Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocredential: update description for credential_from_url_gently
Carlo Marcelo Arenas Belón [Tue, 5 May 2020 01:39:05 +0000 (18:39 -0700)] 
credential: update description for credential_from_url_gently

c44088ecc4 (credential: treat URL without scheme as invalid, 2020-04-18)
changes the implementation for this function to return -1 if protocol is
missing.

Update blurb to match implementation.

Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agopack-bitmap: pass object filter to fill-in traversal
Jeff King [Mon, 4 May 2020 23:12:38 +0000 (17:12 -0600)] 
pack-bitmap: pass object filter to fill-in traversal

Sometimes a bitmap traversal still has to walk some commits manually,
because those commits aren't included in the bitmap packfile (e.g., due
to a push or commit since the last full repack). If we're given an
object filter, we don't pass it down to this traversal. It's not
necessary for correctness because the bitmap code has its own filters to
post-process the bitmap result (which it must, to filter out the objects
that _are_ mentioned in the bitmapped packfile).

And with blob filters, there was no performance reason to pass along
those filters, either. The fill-in traversal could omit them from the
result, but it wouldn't save us any time to do so, since we'd still have
to walk each tree entry to see if it's a blob or not.

But now that we support tree filters, there's opportunity for savings. A
tree:depth=0 filter means we can avoid accessing trees entirely, since
we know we won't them (or any of the subtrees or blobs they point to).
The new test in p5310 shows this off (the "partial bitmap" state is one
where HEAD~100 and its ancestors are all in a bitmapped pack, but
HEAD~100..HEAD are not). Here are the results (run against linux.git):

  Test                                                  HEAD^               HEAD
  -------------------------------------------------------------------------------------------------
  [...]
  5310.16: rev-list with tree filter (partial bitmap)   0.19(0.17+0.02)     0.03(0.02+0.01) -84.2%

The absolute number of savings isn't _huge_, but keep in mind that we
only omitted 100 first-parent links (in the version of linux.git here,
that's 894 actual commits). In a more pathological case, we might have a
much larger proportion of non-bitmapped commits. I didn't bother
creating such a case in the perf script because the setup is expensive,
and this is plenty to show the savings as a percentage.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>