]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
5 years agoMerge https://github.com/prati0100/git-gui
Junio C Hamano [Thu, 4 Mar 2021 20:38:50 +0000 (12:38 -0800)] 
Merge https://github.com/prati0100/git-gui

* https://github.com/prati0100/git-gui:
  Revert "git-gui: remove lines starting with the comment character"

5 years agol10n: tr: v2.31.0-rc1
Emir Sarı [Thu, 4 Mar 2021 19:29:24 +0000 (22:29 +0300)] 
l10n: tr: v2.31.0-rc1

Signed-off-by: Emir Sarı <bitigchi@me.com>
5 years agol10n: sv.po: Update Swedish translation (5104t0f0u)
Peter Krefting [Thu, 4 Mar 2021 18:10:43 +0000 (19:10 +0100)] 
l10n: sv.po: Update Swedish translation (5104t0f0u)

Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
5 years agol10n: git.pot: v2.31.0 round 2 (9 new, 8 removed)
Jiang Xin [Thu, 4 Mar 2021 14:41:21 +0000 (22:41 +0800)] 
l10n: git.pot: v2.31.0 round 2 (9 new, 8 removed)

Generate po/git.pot from v2.31.0-rc1 for git v2.31.0 l10n round 2.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
5 years agoMerge branch 'master' of github.com:git/git
Jiang Xin [Thu, 4 Mar 2021 14:40:13 +0000 (22:40 +0800)] 
Merge branch 'master' of github.com:git/git

* 'master' of github.com:git/git: (63 commits)
  Git 2.31-rc1
  Hopefully the last batch before -rc1
  Revert "commit-graph: when incompatible with graphs, indicate why"
  read-cache: make the index write buffer size 128K
  dir: fix malloc of root untracked_cache_dir
  commit-graph.c: display correct number of chunks when writing
  doc/reftable: document how to handle windows
  fetch-pack: print and use dangling .gitmodules
  fetch-pack: with packfile URIs, use index-pack arg
  http-fetch: allow custom index-pack args
  http: allow custom index-pack args
  chunk-format: add technical docs
  chunk-format: restore duplicate chunk checks
  midx: use 64-bit multiplication for chunk sizes
  midx: use chunk-format read API
  commit-graph: use chunk-format read API
  chunk-format: create read chunk API
  midx: use chunk-format API in write_midx_internal()
  midx: drop chunk progress during write
  midx: return success/failure in chunk write methods
  ...

5 years agoMerge branch 'py/revert-commit-comments'
Pratyush Yadav [Thu, 4 Mar 2021 08:29:45 +0000 (13:59 +0530)] 
Merge branch 'py/revert-commit-comments'

This commit causes breakage on macOS, or in fact any platform using
older versions of Tcl. Revert it.

* py/revert-commit-comments:
  Revert "git-gui: remove lines starting with the comment character"

5 years agoRevert "git-gui: remove lines starting with the comment character"
Pratyush Yadav [Thu, 4 Mar 2021 08:23:27 +0000 (13:53 +0530)] 
Revert "git-gui: remove lines starting with the comment character"

This reverts commit b9a43869c9f96d3577d6f568c1bda1940c8f0e31.

This commit causes breakage on macOS (10.13). It causes errors on
startup and completely breaks the commit functionality. There are two
main problems. First, it uses `string cat` which is not supported on
older Tcl versions. Second, it does a half close of the bidirectional
pipe to git-stripspace which is also not supported on older Tcl
versions.

Reported-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>
5 years agodoc: .gitignore documentation typofix
Julien Richard [Wed, 3 Mar 2021 12:40:54 +0000 (12:40 +0000)] 
doc: .gitignore documentation typofix

Signed-off-by: Julien Richard <julien.richard@ubisoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agot9801: replace test -f with test_path_is_file
Shubham Verma [Tue, 2 Mar 2021 18:50:56 +0000 (00:20 +0530)] 
t9801: replace test -f with test_path_is_file

Although `test -f` has the same functionality as test_path_is_file(), in
the case where test_path_is_file() fails, we get much better debugging
information.

Replace `test -f` with test_path_is_file so that future developers
will have a better experience debugging these test cases.

Signed-off-by: Shubham Verma <shubhunic@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agogit mv foo FOO ; git mv foo bar gave an assert
Torsten Bögershausen [Mon, 1 Mar 2021 21:41:42 +0000 (22:41 +0100)] 
git mv foo FOO ; git mv foo bar gave an assert

The following sequence, on a case-insensitive file system,
(strictly speeking with core.ignorecase=true)
leads to an assertion failure and leaves .git/index.lock behind.

git init
echo foo >foo
git add foo
git mv foo FOO
git mv foo bar

This regression was introduced in Commit 9b906af657,
"git-mv: improve error message for conflicted file"

The bugfix is to change the "file exist case-insensitive in the index"
into the correct "file exist (case-sensitive) in the index".

This avoids the "assert" later in the code and keeps setting up the
"ce" pointer for ce_stage(ce) done in the next else if.

This fixes
https://github.com/git-for-windows/git/issues/2920

Reported-By: Dan Moseley <Dan.Moseley@microsoft.com>
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agogit-cat-file.txt: remove references to "sha1"
Denton Liu [Wed, 3 Mar 2021 09:21:56 +0000 (01:21 -0800)] 
git-cat-file.txt: remove references to "sha1"

As part of the hash-transition, git can operate on more than just SHA-1
repositories. Replace "sha1"-specific documentation with hash-agnostic
terminology.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agogit-cat-file.txt: monospace args, placeholders and filenames
Denton Liu [Wed, 3 Mar 2021 09:21:55 +0000 (01:21 -0800)] 
git-cat-file.txt: monospace args, placeholders and filenames

In modern documentation, args, placeholders and filenames are
monospaced. Apply monospace formatting to these objects.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoGit 2.31-rc1 v2.31.0-rc1
Junio C Hamano [Wed, 3 Mar 2021 06:41:13 +0000 (22:41 -0800)] 
Git 2.31-rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agol10n: tr: v2.31.0-rc0
Emir Sarı [Sat, 27 Feb 2021 09:02:50 +0000 (12:02 +0300)] 
l10n: tr: v2.31.0-rc0

Signed-off-by: Emir Sarı <bitigchi@me.com>
5 years agoHopefully the last batch before -rc1
Junio C Hamano [Mon, 1 Mar 2021 22:02:42 +0000 (14:02 -0800)] 
Hopefully the last batch before -rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoMerge branch 'jh/untracked-cache-fix'
Junio C Hamano [Mon, 1 Mar 2021 22:02:58 +0000 (14:02 -0800)] 
Merge branch 'jh/untracked-cache-fix'

An under-allocation for the untracked cache data has been corrected.

* jh/untracked-cache-fix:
  dir: fix malloc of root untracked_cache_dir

5 years agoMerge branch 'ns/raise-write-index-buffer-size'
Junio C Hamano [Mon, 1 Mar 2021 22:02:58 +0000 (14:02 -0800)] 
Merge branch 'ns/raise-write-index-buffer-size'

Raise the buffer size used when writing the index file out from
(obviously too small) 8kB to (clearly sufficiently large) 128kB.

* ns/raise-write-index-buffer-size:
  read-cache: make the index write buffer size 128K

5 years agoMerge branch 'hv/trailer-formatting'
Junio C Hamano [Mon, 1 Mar 2021 22:02:57 +0000 (14:02 -0800)] 
Merge branch 'hv/trailer-formatting'

The logic to handle "trailer" related placeholders in the
"--format=" mechanisms in the "log" family and "for-each-ref"
family is getting unified.

* hv/trailer-formatting:
  ref-filter: use pretty.c logic for trailers
  pretty.c: capture invalid trailer argument
  pretty.c: refactor trailer logic to `format_set_trailers_options()`
  t6300: use function to test trailer options

5 years agoMerge branch 'hn/reftable-tables-doc-update'
Junio C Hamano [Mon, 1 Mar 2021 22:02:57 +0000 (14:02 -0800)] 
Merge branch 'hn/reftable-tables-doc-update'

Documentation update.

* hn/reftable-tables-doc-update:
  doc/reftable: document how to handle windows

5 years agoMerge branch 'sv/t7001-modernize'
Junio C Hamano [Mon, 1 Mar 2021 22:02:57 +0000 (14:02 -0800)] 
Merge branch 'sv/t7001-modernize'

Test script modernization.

* sv/t7001-modernize:
  t7001: use `test` rather than `[`
  t7001: use here-docs instead of echo
  t7001: put each command on a separate line
  t7001: use '>' rather than 'touch'
  t7001: avoid using `cd` outside of subshells
  t7001: remove whitespace after redirect operators
  t7001: modernize subshell formatting
  t7001: remove unnecessary blank lines
  t7001: indent with TABs instead of spaces
  t7001: modernize test formatting

5 years agoMerge branch 'jt/transfer-fsck-across-packs'
Junio C Hamano [Mon, 1 Mar 2021 22:02:57 +0000 (14:02 -0800)] 
Merge branch 'jt/transfer-fsck-across-packs'

The approach to "fsck" the incoming objects in "index-pack" is
attractive for performance reasons (we have them already in core,
inflated and ready to be inspected), but fundamentally cannot be
applied fully when we receive more than one pack stream, as a tree
object in one pack may refer to a blob object in another pack as
".gitmodules", when we want to inspect blobs that are used as
".gitmodules" file, for example.  Teach "index-pack" to emit
objects that must be inspected later and check them in the calling
"fetch-pack" process.

* jt/transfer-fsck-across-packs:
  fetch-pack: print and use dangling .gitmodules
  fetch-pack: with packfile URIs, use index-pack arg
  http-fetch: allow custom index-pack args
  http: allow custom index-pack args

5 years agoMerge branch 'ds/chunked-file-api'
Junio C Hamano [Mon, 1 Mar 2021 22:02:57 +0000 (14:02 -0800)] 
Merge branch 'ds/chunked-file-api'

The common code to deal with "chunked file format" that is shared
by the multi-pack-index and commit-graph files have been factored
out, to help codepaths for both filetypes to become more robust.

* ds/chunked-file-api:
  commit-graph.c: display correct number of chunks when writing
  chunk-format: add technical docs
  chunk-format: restore duplicate chunk checks
  midx: use 64-bit multiplication for chunk sizes
  midx: use chunk-format read API
  commit-graph: use chunk-format read API
  chunk-format: create read chunk API
  midx: use chunk-format API in write_midx_internal()
  midx: drop chunk progress during write
  midx: return success/failure in chunk write methods
  midx: add num_large_offsets to write_midx_context
  midx: add pack_perm to write_midx_context
  midx: add entries to write_midx_context
  midx: use context in write_midx_pack_names()
  midx: rename pack_info to write_midx_context
  commit-graph: use chunk-format write API
  chunk-format: create chunk format write API
  commit-graph: anonymize data in chunk_write_fn

5 years agoMerge branch 'en/diffcore-rename'
Junio C Hamano [Mon, 1 Mar 2021 22:02:56 +0000 (14:02 -0800)] 
Merge branch 'en/diffcore-rename'

Performance optimization work on the rename detection continues.

* en/diffcore-rename:
  merge-ort: call diffcore_rename() directly
  gitdiffcore doc: mention new preliminary step for rename detection
  diffcore-rename: guide inexact rename detection based on basenames
  diffcore-rename: complete find_basename_matches()
  diffcore-rename: compute basenames of source and dest candidates
  t4001: add a test comparing basename similarity and content similarity
  diffcore-rename: filter rename_src list when possible
  diffcore-rename: no point trying to find a match better than exact

5 years agoMerge branch 'jh/fsmonitor-prework'
Junio C Hamano [Mon, 1 Mar 2021 22:02:56 +0000 (14:02 -0800)] 
Merge branch 'jh/fsmonitor-prework'

Preliminary changes to fsmonitor integration.

* jh/fsmonitor-prework:
  fsmonitor: refactor initialization of fsmonitor_last_update token
  fsmonitor: allow all entries for a folder to be invalidated
  fsmonitor: log FSMN token when reading and writing the index
  fsmonitor: log invocation of FSMonitor hook to trace2
  read-cache: log the number of scanned files to trace2
  read-cache: log the number of lstat calls to trace2
  preload-index: log the number of lstat calls to trace2
  p7519: add trace logging during perf test
  p7519: move watchman cleanup earlier in the test
  p7519: fix watchman watch-list test on Windows
  p7519: do not rely on "xargs -d" in test

5 years agopretty: document multiple %(describe) being inconsistent
René Scharfe [Sun, 28 Feb 2021 11:22:34 +0000 (12:22 +0100)] 
pretty: document multiple %(describe) being inconsistent

Each %(describe) placeholder is expanded using a separate git describe
call.  Their outputs depend on the tags present at the time, so there's
no consistency guarantee.  Document that fact.

Reported-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agot4205: assert %(describe) test coverage
René Scharfe [Sun, 28 Feb 2021 11:22:26 +0000 (12:22 +0100)] 
t4205: assert %(describe) test coverage

Document that the test is covering both describable and
undescribable commits.

Suggested-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoMerge https://github.com/prati0100/git-gui
Junio C Hamano [Mon, 1 Mar 2021 17:22:18 +0000 (09:22 -0800)] 
Merge https://github.com/prati0100/git-gui

* https://github.com/prati0100/git-gui:
  git-gui: remove lines starting with the comment character
  git-gui: fix typo in russian locale

5 years agoMerge branch 'js/commit-graph-warning'
Junio C Hamano [Mon, 1 Mar 2021 17:21:24 +0000 (09:21 -0800)] 
Merge branch 'js/commit-graph-warning'

* js/commit-graph-warning:
  Revert "commit-graph: when incompatible with graphs, indicate why"

5 years agoRevert "commit-graph: when incompatible with graphs, indicate why"
Junio C Hamano [Mon, 1 Mar 2021 17:19:37 +0000 (09:19 -0800)] 
Revert "commit-graph: when incompatible with graphs, indicate why"

This reverts commit c85eec7fc37e1ca79072f263ae6ea1ee305ba38c, as
it is a bit overzealous, we are in prerelease freeze, and we want
to have enough time to get this right and cook in 'next'.

cf. <8735xgkvuo.fsf@evledraar.gmail.com>

5 years agoconfig.mak.uname: enable OPEN_RETURNS_EINTR for macOS Big Sur
Jeff King [Mon, 1 Mar 2021 09:29:47 +0000 (04:29 -0500)] 
config.mak.uname: enable OPEN_RETURNS_EINTR for macOS Big Sur

We've had mixed reports on whether the latest release of macOS needs
this Makefile knob set. In most reported cases, there's antivirus
software running (which one might imagine could cause an open() call to
be delayed). However, one of the (off-list) reports I've gotten
indicated that it happened on an otherwise clean install of Big Sur.

Since the symptom is so bad (checkout randomly fails to write several
fails when the progress meter kicks in), and since the workaround is so
lightweight (if we don't see EINTR, it's just an extra conditional
check), let's just turn it on by default.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agogithooks.txt: clarify documentation on reference-transaction hook
Patrick Steinhardt [Mon, 1 Mar 2021 09:43:55 +0000 (10:43 +0100)] 
githooks.txt: clarify documentation on reference-transaction hook

The reference-transaction hook doesn't clearly document its scope and
what values it receives as input. Document it to make it less surprising
and clearly delimit its (current) scope.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agogithooks.txt: replace mentions of SHA-1 specific properties
Patrick Steinhardt [Mon, 1 Mar 2021 09:43:47 +0000 (10:43 +0100)] 
githooks.txt: replace mentions of SHA-1 specific properties

The githooks(5) documentation states in several places that the hook
will receive a SHA-1 or hashes of 40 characters length. Given that we're
transitioning to a world where both SHA-1 and SHA-256 are supported,
this is inaccurate.

Fix the issue by replacing mentions of SHA-1 with "object name" and not
explicitly mentioning the hash size.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoMerge branch 'master' of github.com:nafmo/git-l10n-sv
Jiang Xin [Mon, 1 Mar 2021 02:01:02 +0000 (10:01 +0800)] 
Merge branch 'master' of github.com:nafmo/git-l10n-sv

* 'master' of github.com:nafmo/git-l10n-sv:
  l10n: sv.po: Update Swedish translation (5103t0f0u)

5 years agoMerge branch 'pl' of github.com:Arusekk/git-po
Jiang Xin [Mon, 1 Mar 2021 01:59:07 +0000 (09:59 +0800)] 
Merge branch 'pl' of github.com:Arusekk/git-po

* 'pl' of github.com:Arusekk/git-po:
  l10n: pl.po: Update translation

5 years agol10n: sv.po: Update Swedish translation (5103t0f0u)
Peter Krefting [Sun, 28 Feb 2021 21:22:46 +0000 (22:22 +0100)] 
l10n: sv.po: Update Swedish translation (5103t0f0u)

Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
5 years agol10n: pl.po: Update translation
Arusekk [Sat, 27 Feb 2021 15:12:59 +0000 (16:12 +0100)] 
l10n: pl.po: Update translation

Signed-off-by: Arusekk <arek_koz@o2.pl>
5 years agol10n: fr: v2.31.0 rnd 1
Jean-Noël Avila [Sat, 27 Feb 2021 14:47:45 +0000 (15:47 +0100)] 
l10n: fr: v2.31.0 rnd 1

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
5 years agodiffcore-rename: compute dir_rename_guess from dir_rename_counts
Elijah Newren [Sat, 27 Feb 2021 00:30:48 +0000 (00:30 +0000)] 
diffcore-rename: compute dir_rename_guess from dir_rename_counts

dir_rename_counts has a mapping of a mapping, in particular, it has
   old_dir => { new_dir => count }
We want a simple mapping of
   old_dir => new_dir
based on which new_dir had the highest count for a given old_dir.
Compute this and store it in dir_rename_guess.

This is the final piece of the puzzle needed to make our guesses at
which directory files have been moved to when basenames aren't unique.

For the testcases mentioned in commit 557ac0350d ("merge-ort: begin
performance work; instrument with trace2_region_* calls", 2020-10-28),
this change improves the performance as follows:

                            Before                  After
    no-renames:       12.775 s ±  0.062 s    12.596 s ±  0.061 s
    mega-renames:    188.754 s ±  0.284 s   130.465 s ±  0.259 s
    just-one-mega:     5.599 s ±  0.019 s     3.958 s ±  0.010 s

Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agodiffcore-rename: limit dir_rename_counts computation to relevant dirs
Elijah Newren [Sat, 27 Feb 2021 00:30:47 +0000 (00:30 +0000)] 
diffcore-rename: limit dir_rename_counts computation to relevant dirs

We are using dir_rename_counts to count the number of other directories
that files within a directory moved to.  We only need this information
for directories that disappeared, though, so we can return early from
update_dir_rename_counts() for other paths.

If dirs_removed is passed to diffcore_rename_extended(), then it
provides the relevant bits of information for us to limit this counting
to relevant dirs.  If dirs_removed is not passed, we would need to
compute some replacement in order to do this limiting.  Introduce a new
info->relevant_source_dirs variable for this purpose, even though at
this stage we will only set it to dirs_removed for simplicity.

Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agodiffcore-rename: compute dir_rename_counts in stages
Elijah Newren [Sat, 27 Feb 2021 00:30:46 +0000 (00:30 +0000)] 
diffcore-rename: compute dir_rename_counts in stages

Compute dir_rename_counts based just on exact renames to start, as that
can provide us useful information in find_basename_matches().  This is
done by moving the code from compute_dir_rename_counts() into
initialize_dir_rename_info(), resulting in it being computed earlier and
based just on exact renames.  Since that's an incomplete result, we
augment the counts via calling update_dir_rename_counts() after each
basename-guide and inexact rename detection match is found.

Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agodiffcore-rename: extend cleanup_dir_rename_info()
Elijah Newren [Sat, 27 Feb 2021 00:30:45 +0000 (00:30 +0000)] 
diffcore-rename: extend cleanup_dir_rename_info()

When diffcore_rename_extended() is passed a NULL dir_rename_count, we
will still want to create a temporary one for use by
find_basename_matches(), but have it fully deallocated before
diffcore_rename_extended() returns.  However, when
diffcore_rename_extended() is passed a dir_rename_count, we want to fill
that strmap with appropriate values and return it.  However, for our
interim purposes we may also add entries corresponding to directories
that cannot have been renamed due to still existing on both sides.

Extend cleanup_dir_rename_info() to handle these two different cases,
cleaning up the relevant bits of information for each case.

Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agodiffcore-rename: move dir_rename_counts into dir_rename_info struct
Elijah Newren [Sat, 27 Feb 2021 00:30:44 +0000 (00:30 +0000)] 
diffcore-rename: move dir_rename_counts into dir_rename_info struct

This continues the migration of the directory rename detection code into
diffcore-rename, now taking the simple step of combining it with the
dir_rename_info struct.  Future commits will then make dir_rename_counts
be computed in stages, and add computation of dir_rename_guess.

Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agodiffcore-rename: add function for clearing dir_rename_count
Elijah Newren [Sat, 27 Feb 2021 00:30:43 +0000 (00:30 +0000)] 
diffcore-rename: add function for clearing dir_rename_count

As we adjust the usage of dir_rename_count we want to have a function
for clearing, or partially clearing it out.  Add a
partial_clear_dir_rename_count() function for this purpose.

Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoMove computation of dir_rename_count from merge-ort to diffcore-rename
Elijah Newren [Sat, 27 Feb 2021 00:30:42 +0000 (00:30 +0000)] 
Move computation of dir_rename_count from merge-ort to diffcore-rename

Move the computation of dir_rename_count from merge-ort.c to
diffcore-rename.c, making slight adjustments to the data structures
based on the move.  While the diffstat looks large, viewing this commit
with --color-moved makes it clear that only about 20 lines changed.

With this patch, the computation of dir_rename_count is still only done
after inexact rename detection, but subsequent commits will add a
preliminary computation of dir_rename_count after exact rename
detection, followed by some updates after inexact rename detection.

Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agodiffcore-rename: add a mapping of destination names to their indices
Elijah Newren [Sat, 27 Feb 2021 00:30:41 +0000 (00:30 +0000)] 
diffcore-rename: add a mapping of destination names to their indices

Compute a mapping of full filename to the index within rename_dst where
that filename is found, and store it in idx_map.  idx_possible_rename()
needs this to quickly finding an array entry in rename_dst given the
pathname.

While at it, add placeholder initializations for dir_rename_count and
dir_rename_guess; these will be more fully populated in subsequent
commits.

Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agodiffcore-rename: provide basic implementation of idx_possible_rename()
Elijah Newren [Sat, 27 Feb 2021 00:30:40 +0000 (00:30 +0000)] 
diffcore-rename: provide basic implementation of idx_possible_rename()

Add a new struct dir_rename_info with various values we need inside our
idx_possible_rename() function introduced in the previous commit.  Add a
basic implementation for this function showing how we plan to use the
variables, but which will just return early with a value of -1 (not
found) when those variables are not set up.

Future commits will do the work necessary to set up those other
variables so that idx_possible_rename() does not always return -1.

Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agodiffcore-rename: use directory rename guided basename comparisons
Elijah Newren [Sat, 27 Feb 2021 00:30:39 +0000 (00:30 +0000)] 
diffcore-rename: use directory rename guided basename comparisons

A previous commit noted that it is very common for people to move files
across directories while keeping their filename the same.  The last few
commits took advantage of this and showed that we can accelerate rename
detection significantly using basenames; since files with the same
basename serve as likely rename candidates, we can check those first and
remove them from the rename candidate pool if they are sufficiently
similar.

Unfortunately, the previous optimization was limited by the fact that
the remaining basenames after exact rename detection are not always
unique.  Many repositories have hundreds of build files with the same
name (e.g. Makefile, .gitignore, build.gradle, etc.), and may even have
hundreds of source files with the same name.  (For example, the linux
kernel has 100 setup.c, 87 irq.c, and 112 core.c files.  A repository at
$DAYJOB has a lot of ObjectFactory.java and Plugin.java files).

For these files with non-unique basenames, we are faced with the task of
attempting to determine or guess which directory they may have been
relocated to.  Such a task is precisely the job of directory rename
detection.  However, there are two catches: (1) the directory rename
detection code has traditionally been part of the merge machinery rather
than diffcore-rename.c, and (2) directory rename detection currently
runs after regular rename detection is complete.  The 1st catch is just
an implementation issue that can be overcome by some code shuffling.
The 2nd requires us to add a further approximation: we only have access
to exact renames at this point, so we need to do directory rename
detection based on just exact renames.  In some cases we won't have
exact renames, in which case this extra optimization won't apply.  We
also choose to not apply the optimization unless we know that the
underlying directory was removed, which will require extra data to be
passed in to diffcore_rename_extended().  Also, even if we get a
prediction about which directory a file may have relocated to, we will
still need to check to see if there is a file in the predicted
directory, and then compare the two files to see if they meet the higher
min_basename_score threshold required for marking the two files as
renames.

This commit introduces an idx_possible_rename() function which will
do this directory rename detection for us and give us the index within
rename_dst of the resulting filename.  For now, this function is
hardcoded to return -1 (not found) and just hooks up how its results
would be used once we have a more complete implementation in place.

Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agopack-revindex.c: don't close unopened file descriptors
Taylor Blau [Fri, 26 Feb 2021 16:31:02 +0000 (11:31 -0500)] 
pack-revindex.c: don't close unopened file descriptors

When opening a reverse index, load_revindex_from_disk() jumps to the
'cleanup' label in case something goes wrong: the reverse index had the
wrong size, an unrecognized version, or similar.

It also jumps to this label when the reverse index couldn't be opened in
the first place, which will cause an error with the unguarded close()
call in the label.

Guard this call with "if (fd >= 0)" to make sure that we have a valid
file descriptor to close before attempting to close it.

Reported-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agot/perf: avoid copying worktree files from test repo
Jeff King [Fri, 26 Feb 2021 07:13:15 +0000 (02:13 -0500)] 
t/perf: avoid copying worktree files from test repo

When running the perf suite, we copy files from an existing $GIT_DIR to
a scratch repository to give us a realistic setup on which to operate.
Since the perf scripts themselves may modify the scratch repository, we
want to make sure we've scrubbed any references back to the original.

One existing example is that we avoid copying the file "commondir" at
the top-level of the repository. In a worktree git-dir (e.g.,
.git/worktrees/foo), that file contains the path to the parent
repository; copying it could mean ref updates in the scratch repository
affect the original.

But there are other files we should cover, too:

  - "gitdir" in a worktree git-dir contains the path to the actual .git
    file in the working tree. We _shouldn't_ end up looking at it at
    all, since the lack of a "commondir" file means Git won't consider
    this to be a worktree git-dir. But it's best to err on the safe
    side.

  - in a parent repository that contains worktrees, the
    "$GIT_DIR/worktrees" directory will contain the git dirs for the
    individual worktrees. Which will themselves contain commondir and
    gitdir files that may reference the original repository. We should
    likewise remove them.

    Note that this does mean that the perf suite's scratch repositories
    will never have any worktrees. That's OK; we don't have any perf tests
    that are influenced by their presence. If we add any, they'd
    probably want to create the worktrees themselves anyway.

This patch adds both paths to the set of omissions in
test_perf_copy_repo_contents(). Note that we won't get confused here by
matching arbitrary names like refs/heads/commondir. This list is always
matching top-level entries in $GIT_DIR (we rely on "cp -R" to do the
actual recursion).

Suggested-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agot/perf: handle worktrees as test repos
Jeff King [Fri, 26 Feb 2021 07:11:39 +0000 (02:11 -0500)] 
t/perf: handle worktrees as test repos

The perf suite gets confused when test_perf_default_repo is pointed at a
worktree (which includes when it is run from within a worktree at all,
since the default is to use the current repository).

Here's an example:

  $ git worktree add ~/foo
  Preparing worktree (new branch 'foo')
  HEAD is now at 328c109303 The eighth batch
  $ cd ~/foo
  $ make
  [...build output...]
  $ cd t/perf
  $ ./p0000-perf-lib-sanity.sh -v -i
  [...]
  perf 1 - test_perf_default_repo works:
  running:
   foo=$(git rev-parse HEAD) &&
   test_export foo

  fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
  Use '--' to separate paths from revisions, like this:
  'git <command> [<revision>...] -- [<file>...]'

The problem is that we didn't copy all of the necessary files from the
source repository (in this case we got HEAD, but we have no refs!). We
discover the git-dir with "rev-parse --git-dir", but this points to the
worktree's partial repository in .../.git/worktrees/foo.

That partial repository has a "commondir" file which points to the main
repository, where the actual refs are stored, but we don't copy it. This
is the correct thing to do, though! If we did copy it, then our scratch
test repo would be pointing back to the original main repo, and any ref
updates we made in the tests would impact that original repo.

Instead, we need to either:

  1. Make a scratch copy of the original main repo (in addition to the
     worktree repo), and point the scratch worktree repo's commondir at
     it. This preserves the original relationship, but it's doubtful any
     script really cares (if they are testing worktree performance,
     they'd probably make their own worktrees). And it's trickier to get
     right.

  2. Collapse the main and worktree repos into a single scratch repo.
     This can be done by copying everything from both, preferring any
     files from the worktree repo.

This patch does the second one. With this applied, the example above
results in p0000 running successfully.

Reported-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoMakefile: add OPEN_RETURNS_EINTR knob
Jeff King [Fri, 26 Feb 2021 06:14:35 +0000 (01:14 -0500)] 
Makefile: add OPEN_RETURNS_EINTR knob

On some platforms, open() reportedly returns EINTR when opening regular
files and we receive a signal (usually SIGALRM from our progress meter).
This shouldn't happen, as open() should be a restartable syscall, and we
specify SA_RESTART when setting up the alarm handler. So it may actually
be a kernel or libc bug for this to happen. But it has been reported on
at least one version of Linux (on a network filesystem):

  https://lore.kernel.org/git/c8061cce-71e4-17bd-a56a-a5fed93804da@neanderfunk.de/

as well as on macOS starting with Big Sur even on a regular filesystem.

We can work around it by retrying open() calls that get EINTR, just as
we do for read(), etc. Since we don't ever _want_ to interrupt an open()
call, we can get away with just redefining open, rather than insisting
all callsites use xopen().

We actually do have an xopen() wrapper already (and it even does this
retry, though there's no indication of it being an observed problem back
then; it seems simply to have been lifted from xread(), etc). But it is
used hardly anywhere, and isn't suitable for general use because it will
die() on error. In theory we could combine the two, but it's awkward to
do so because of the variable-args interface of open().

This patch adds a Makefile knob for enabling the workaround. It's not
enabled by default for any platforms in config.mak.uname yet, as we
don't have enough data to decide how common this is (I have not been
able to reproduce on either Linux or Big Sur myself). It may be worth
enabling preemptively anyway, since the cost is pretty low (if we don't
see an EINTR, it's just an extra conditional).

However, note that we must not enable this on Windows. It doesn't do
anything there, and the macro overrides the existing mingw_open()
redirection. I've added a preemptive #undef here in the mingw header
(which is processed first) to just quietly disable it (we could also
make it an #error, but there is little point in being so aggressive).

Reported-by: Aleksey Kliger <alklig@microsoft.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoconvert: fail gracefully upon missing clean cmd on required filter
Matheus Tavares [Fri, 26 Feb 2021 16:23:54 +0000 (13:23 -0300)] 
convert: fail gracefully upon missing clean cmd on required filter

The gitattributes documentation mentions that either the clean cmd or
the smudge cmd can be left unspecified in a filter definition. However,
when the filter is marked as 'required', the absence of any one of these
two should be treated as an error. Git already fails under these
circumstances, but not always in a pleasant way: omitting a clean cmd in
a required filter triggers an assertion error which leaves the user with
a quite verbose message:

git: convert.c:1459: convert_to_git_filter_fd: Assertion "ca.drv->clean || ca.drv->process" failed.

This assertion is not really necessary, as the apply_filter() call below
it already performs the same check. And when this condition is not met,
the function returns 0, making the caller die() with a much nicer
message. (Also note that die()-ing here is the right behavior as
`would_convert_to_git_filter_fd() == true` is a precondition to use
convert_to_git_filter_fd(), and the former is only true when the filter
is required.) So remove the assertion and add two regression tests to
make sure that git fails nicely when either the smudge or clean command
is missing on a required filter.

Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agol10n: git.pot: v2.31.0 round 1 (155 new, 89 removed)
Jiang Xin [Fri, 26 Feb 2021 14:09:42 +0000 (22:09 +0800)] 
l10n: git.pot: v2.31.0 round 1 (155 new, 89 removed)

Generate po/git.pot from v2.31.0-rc0 for git v2.31.0 l10n round 1.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
5 years agoGit 2.31-rc0 v2.31.0-rc0
Junio C Hamano [Fri, 26 Feb 2021 00:34:59 +0000 (16:34 -0800)] 
Git 2.31-rc0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoMerge branch 'jc/push-delete-nothing'
Junio C Hamano [Fri, 26 Feb 2021 00:43:32 +0000 (16:43 -0800)] 
Merge branch 'jc/push-delete-nothing'

"git push $there --delete ''" should have been diagnosed as an
error, but instead turned into a matching push, which has been
corrected.

* jc/push-delete-nothing:
  push: do not turn --delete '' into a matching push

5 years agoMerge branch 'sh/mergetools-vimdiff1'
Junio C Hamano [Fri, 26 Feb 2021 00:43:32 +0000 (16:43 -0800)] 
Merge branch 'sh/mergetools-vimdiff1'

Mergetools update.

* sh/mergetools-vimdiff1:
  mergetools/vimdiff: add vimdiff1 merge tool variant

5 years agoMerge branch 'dl/doc-config-camelcase'
Junio C Hamano [Fri, 26 Feb 2021 00:43:32 +0000 (16:43 -0800)] 
Merge branch 'dl/doc-config-camelcase'

A handful of multi-word configuration variable names in
documentation that are spelled in all lowercase have been corrected
to use the more canonical camelCase.

* dl/doc-config-camelcase:
  index-format doc: camelCase core.excludesFile
  blame-options.txt: camelcase blame.blankBoundary
  i18n.txt: camel case and monospace "i18n.commitEncoding"

5 years agoMerge branch 'js/params-vs-args'
Junio C Hamano [Fri, 26 Feb 2021 00:43:32 +0000 (16:43 -0800)] 
Merge branch 'js/params-vs-args'

Messages update.

* js/params-vs-args:
  replace "parameters" by "arguments" in error messages

5 years agoMerge branch 'ug/doc-commit-approxidate'
Junio C Hamano [Fri, 26 Feb 2021 00:43:32 +0000 (16:43 -0800)] 
Merge branch 'ug/doc-commit-approxidate'

Doc update.

* ug/doc-commit-approxidate:
  doc: mention approxidates for git-commit --date

5 years agoMerge branch 'es/maintenance-of-bare-repositories'
Junio C Hamano [Fri, 26 Feb 2021 00:43:32 +0000 (16:43 -0800)] 
Merge branch 'es/maintenance-of-bare-repositories'

The "git maintenance register" command had trouble registering bare
repositories, which had been corrected.

* es/maintenance-of-bare-repositories:
  maintenance: fix incorrect `maintenance.repo` path with bare repository

5 years agoMerge branch 'mt/add-chmod-fixes'
Junio C Hamano [Fri, 26 Feb 2021 00:43:31 +0000 (16:43 -0800)] 
Merge branch 'mt/add-chmod-fixes'

Various fixes on "git add --chmod".

* mt/add-chmod-fixes:
  add: propagate --chmod errors to exit status
  add: mark --chmod error string for translation
  add --chmod: don't update index when --dry-run is used

5 years agoMerge branch 'ds/merge-base-independent'
Junio C Hamano [Fri, 26 Feb 2021 00:43:31 +0000 (16:43 -0800)] 
Merge branch 'ds/merge-base-independent'

The code to implement "git merge-base --independent" was poorly
done and was kept from the very beginning of the feature.

* ds/merge-base-independent:
  commit-reach: stale commits may prune generation further
  commit-reach: use heuristic in remove_redundant()
  commit-reach: move compare_commits_by_gen
  commit-reach: use one walk in remove_redundant()
  commit-reach: reduce requirements for remove_redundant()

5 years agoMerge branch 'ah/rebase-no-fork-point-config'
Junio C Hamano [Fri, 26 Feb 2021 00:43:31 +0000 (16:43 -0800)] 
Merge branch 'ah/rebase-no-fork-point-config'

"git rebase --[no-]fork-point" gained a configuration variable
rebase.forkPoint so that users do not have to keep specifying a
non-default setting.

* ah/rebase-no-fork-point-config:
  rebase: add a config option for --no-fork-point

5 years agoMerge branch 'mt/grep-sparse-checkout'
Junio C Hamano [Fri, 26 Feb 2021 00:43:31 +0000 (16:43 -0800)] 
Merge branch 'mt/grep-sparse-checkout'

"git grep" has been tweaked to be limited to the sparse checkout
paths.

* mt/grep-sparse-checkout:
  grep: honor sparse-checkout on working tree searches

5 years agoMerge branch 'ah/commit-graph-leakplug'
Junio C Hamano [Fri, 26 Feb 2021 00:43:31 +0000 (16:43 -0800)] 
Merge branch 'ah/commit-graph-leakplug'

Plug a minor memory leak.

* ah/commit-graph-leakplug:
  commit-graph: avoid leaking topo_levels slab in write_commit_graph()

5 years agoMerge branch 'zh/difftool-skip-to'
Junio C Hamano [Fri, 26 Feb 2021 00:43:31 +0000 (16:43 -0800)] 
Merge branch 'zh/difftool-skip-to'

"git difftool" learned "--skip-to=<path>" option to restart an
interrupted session from an arbitrary path.

* zh/difftool-skip-to:
  difftool.c: learn a new way start at specified file

5 years agoMerge branch 'cw/pack-config-doc'
Junio C Hamano [Fri, 26 Feb 2021 00:43:30 +0000 (16:43 -0800)] 
Merge branch 'cw/pack-config-doc'

Doc update.

* cw/pack-config-doc:
  doc: mention bigFileThreshold for packing

5 years agoMerge branch 'jc/maint-column-doc-typofix'
Junio C Hamano [Fri, 26 Feb 2021 00:43:30 +0000 (16:43 -0800)] 
Merge branch 'jc/maint-column-doc-typofix'

Doc update.

* jc/maint-column-doc-typofix:
  Documentation: typofix --column description

5 years agoMerge branch 'ma/doc-markup-fix'
Junio C Hamano [Fri, 26 Feb 2021 00:43:30 +0000 (16:43 -0800)] 
Merge branch 'ma/doc-markup-fix'

Docfix.

* ma/doc-markup-fix:
  gitmailmap.txt: fix rendering of e-mail addresses
  git.txt: fix monospace rendering
  rev-list-options.txt: fix rendering of bonus paragraph

5 years agoMerge branch 'jc/diffcore-rotate'
Junio C Hamano [Fri, 26 Feb 2021 00:43:30 +0000 (16:43 -0800)] 
Merge branch 'jc/diffcore-rotate'

"git {diff,log} --{skip,rotate}-to=<path>" allows the user to
discard diff output for early paths or move them to the end of the
output.

* jc/diffcore-rotate:
  diff: --{rotate,skip}-to=<path>

5 years agoMerge branch 'mt/checkout-index-corner-cases'
Junio C Hamano [Fri, 26 Feb 2021 00:43:30 +0000 (16:43 -0800)] 
Merge branch 'mt/checkout-index-corner-cases'

The error codepath around the "--temp/--prefix" feature of "git
checkout-index" has been improved.

* mt/checkout-index-corner-cases:
  checkout-index: omit entries with no tempname from --temp output
  write_entry(): fix misuses of `path` in error messages

5 years agoMerge branch 'js/doc-proto-v2-response-end'
Junio C Hamano [Fri, 26 Feb 2021 00:43:30 +0000 (16:43 -0800)] 
Merge branch 'js/doc-proto-v2-response-end'

Docfix.

* js/doc-proto-v2-response-end:
  doc: fix naming of response-end-pkt

5 years agoMerge branch 'rs/blame-optim'
Junio C Hamano [Fri, 26 Feb 2021 00:43:29 +0000 (16:43 -0800)] 
Merge branch 'rs/blame-optim'

Optimization in "git blame"

* rs/blame-optim:
  blame: remove unnecessary use of get_commit_info()

5 years agoMerge branch 'mz/doc-notes-are-not-anchors'
Junio C Hamano [Fri, 26 Feb 2021 00:43:29 +0000 (16:43 -0800)] 
Merge branch 'mz/doc-notes-are-not-anchors'

Objects that lost references can be pruned away, even when they
have notes attached to it (and these notes will become dangling,
which in turn can be pruned with "git notes prune").  This has been
clarified in the documentation.

* mz/doc-notes-are-not-anchors:
  docs: clarify that refs/notes/ do not keep the attached objects alive

5 years agoMerge branch 'ab/detox-gettext-tests'
Junio C Hamano [Fri, 26 Feb 2021 00:43:29 +0000 (16:43 -0800)] 
Merge branch 'ab/detox-gettext-tests'

Removal of GIT_TEST_GETTEXT_POISON continues.

* ab/detox-gettext-tests:
  tests: remove most uses of test_i18ncmp
  tests: remove last uses of C_LOCALE_OUTPUT
  tests: remove most uses of C_LOCALE_OUTPUT
  tests: remove last uses of GIT_TEST_GETTEXT_POISON=false

5 years agoMerge branch 'jk/rev-list-disk-usage'
Junio C Hamano [Fri, 26 Feb 2021 00:43:28 +0000 (16:43 -0800)] 
Merge branch 'jk/rev-list-disk-usage'

"git rev-list" command learned "--disk-usage" option.

* jk/rev-list-disk-usage:
  docs/rev-list: add some examples of --disk-usage
  docs/rev-list: add an examples section
  rev-list: add --disk-usage option for calculating disk usage
  t: add --no-tag option to test_commit

5 years agocommit-graph: use config to specify generation type
Derrick Stolee [Thu, 25 Feb 2021 18:19:43 +0000 (18:19 +0000)] 
commit-graph: use config to specify generation type

We have two established generation number versions:

 1: topological levels
 2: corrected commit dates

The corrected commit dates are enabled by default, but they also write
extra data in the GDAT and GDOV chunks. Services that host Git data
might want to have more control over when this feature rolls out than
just updating the Git binaries.

Add a new "commitGraph.generationVersion" config option that specifies
the intended generation number version. If this value is less than 2,
then the GDAT chunk is never written _or read_ from an existing file.

This can replace our use of the GIT_TEST_COMMIT_GRAPH_NO_GDAT
environment variable in the test suite. Remove it.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agocommit-graph: create local repository pointer
Derrick Stolee [Thu, 25 Feb 2021 18:19:42 +0000 (18:19 +0000)] 
commit-graph: create local repository pointer

The write_commit_graph() method uses 'the_repository' in a few places. A
new need for a repository pointer is coming in the following change, so
group these instances into a local variable 'r' that could eventually
become part of the method signature, if so desired.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoremote: write camel-cased *.pushRemote on rename
Ævar Arnfjörð Bjarmason [Thu, 25 Feb 2021 01:21:17 +0000 (02:21 +0100)] 
remote: write camel-cased *.pushRemote on rename

When a remote is renamed don't change the canonical "*.pushRemote"
form to "*.pushremote". Fixes and tests for a minor bug in
923d4a5ca4f (remote rename/remove: handle branch.<name>.pushRemote
config values, 2020-01-27). See the preceding commit for why this does
& doesn't matter.

While we're at it let's also test that we handle the "*.pushDefault"
key correctly. The code to handle that was added in
b3fd6cbf294 (remote rename/remove: gently handle remote.pushDefault
config, 2020-02-01) and does the right thing, but nothing tested that
we wrote out the canonical camel-cased form.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoremote: add camel-cased *.tagOpt key, like clone
Ævar Arnfjörð Bjarmason [Thu, 25 Feb 2021 01:21:16 +0000 (02:21 +0100)] 
remote: add camel-cased *.tagOpt key, like clone

Change "git remote add" so that it adds a *.tagOpt key, and not the
lower-cased *.tagopt on "git remote add --no-tags", just as "git clone
--no-tags" would do.

This doesn't matter for anything that reads the config. It's just
prettier if we write config keys in their documented camelCase form to
user-readable config files.

When I added support for "clone -no-tags" in 0dab2468ee5 (clone: add a
--no-tags option to clone without tags, 2017-04-26) I made it use
the *.tagOpt form, but the older "git remote add" added in
111fb858654 (remote add: add a --[no-]tags option, 2010-04-20) has
been using *.tagopt all this time.

It's easy enough to add a test for this, so let's do that. We can't
use "git config -l" there, because it'll normalize the keys to their
lower-cased form. Let's add the test for "git clone" too for good
measure, not just to the "git remote" codepath we're fixing.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoMerge branch 'ds/chunked-file-api' into tb/reverse-midx
Junio C Hamano [Wed, 24 Feb 2021 23:26:14 +0000 (15:26 -0800)] 
Merge branch 'ds/chunked-file-api' into tb/reverse-midx

* ds/chunked-file-api:
  commit-graph.c: display correct number of chunks when writing
  chunk-format: add technical docs
  chunk-format: restore duplicate chunk checks
  midx: use 64-bit multiplication for chunk sizes
  midx: use chunk-format read API
  commit-graph: use chunk-format read API
  chunk-format: create read chunk API
  midx: use chunk-format API in write_midx_internal()
  midx: drop chunk progress during write
  midx: return success/failure in chunk write methods
  midx: add num_large_offsets to write_midx_context
  midx: add pack_perm to write_midx_context
  midx: add entries to write_midx_context
  midx: use context in write_midx_pack_names()
  midx: rename pack_info to write_midx_context
  commit-graph: use chunk-format write API
  chunk-format: create chunk format write API
  commit-graph: anonymize data in chunk_write_fn

5 years agoindex-format doc: camelCase core.excludesFile
Junio C Hamano [Wed, 24 Feb 2021 20:26:41 +0000 (12:26 -0800)] 
index-format doc: camelCase core.excludesFile

Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoblame-options.txt: camelcase blame.blankBoundary
Junio C Hamano [Wed, 24 Feb 2021 20:26:40 +0000 (12:26 -0800)] 
blame-options.txt: camelcase blame.blankBoundary

All other references to blame.* configuration variables are
camelCased already.  Update this one to match.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoi18n.txt: camel case and monospace "i18n.commitEncoding"
Denton Liu [Wed, 24 Feb 2021 20:26:39 +0000 (12:26 -0800)] 
i18n.txt: camel case and monospace "i18n.commitEncoding"

In 95791be750 (doc: camelCase the i18n config variables to improve
readability, 2017-07-17), the other i18n config variables were
camel cased. However, this one instance was missed.

Camel case and monospace "i18n.commitEncoding" so that it matches the
surrounding text.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
[jc: fixed 3 other mistakes that are exactly the same]
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoread-cache: make the index write buffer size 128K
Neeraj Singh [Thu, 18 Feb 2021 02:48:26 +0000 (02:48 +0000)] 
read-cache: make the index write buffer size 128K

Writing an index 8K at a time invokes the OS filesystem and caching code
very frequently, introducing noticeable overhead while writing large
indexes. When experimenting with different write buffer sizes on Windows
writing the Windows OS repo index (260MB), most of the benefit came by
bumping the index write buffer size to 64K. I picked 128K to ensure that
we're past the knee of the curve.

With this change, the time under do_write_index for an index with 3M
files goes from ~1.02s to ~0.72s.

Signed-off-by: Neeraj Singh <neerajsi@ntdev.microsoft.com>
Acked-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoadd: propagate --chmod errors to exit status
Matheus Tavares [Tue, 23 Feb 2021 01:10:35 +0000 (22:10 -0300)] 
add: propagate --chmod errors to exit status

If `add` encounters an error while applying the --chmod changes, it
prints a message to stderr, but exits with a success code. This might
have been an oversight, as the command does exit with a non-zero code in
other situations where it cannot (or refuses to) update all of the
requested paths (e.g. when some of the given paths are ignored). So make
the exit behavior more consistent by also propagating --chmod errors to
the exit status.

Note: the test "all statuses changed in folder if . is given" uses paths
added by previous test cases, some of which might be symbolic links.
Because `git add --chmod` will now fail with such paths, this test would
depend on whether all the previous tests were executed, or only some
of them. Avoid that by running the test on a fresh repo with only
regular files.

Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoadd: mark --chmod error string for translation
Matheus Tavares [Tue, 23 Feb 2021 01:10:34 +0000 (22:10 -0300)] 
add: mark --chmod error string for translation

This error message is intended for humans, so mark it for translation.
Also use error() instead of fprintf(stderr, ...), to make the
corresponding line a bit cleaner, and to display the "error:" prefix,
which helps classifying the nature/severity of the message.

Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoadd --chmod: don't update index when --dry-run is used
Matheus Tavares [Tue, 23 Feb 2021 01:10:33 +0000 (22:10 -0300)] 
add --chmod: don't update index when --dry-run is used

`git add --chmod` applies the mode changes even when `--dry-run` is
used. Fix that and add some tests for this option combination.

Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agodir: fix malloc of root untracked_cache_dir
Jeff Hostetler [Wed, 24 Feb 2021 14:31:57 +0000 (14:31 +0000)] 
dir: fix malloc of root untracked_cache_dir

Use FLEX_ALLOC_STR() to allocate the `struct untracked_cache_dir`
for the root directory.  Get rid of unsafe code that might fail to
initialize the `name` field (if FLEX_ARRAY is not 1).  This will
make it clear that we intend to have a structure with an empty
string following it.

A problem was observed on Windows where the length of the memset() was
too short, so the first byte of the name field was not zeroed.  This
resulted in the name field having garbage from a previous use of that
area of memory.

The record for the root directory was then written to the untracked-cache
extension in the index.  This garbage would then be visible to future
commands when they reloaded the untracked-cache extension.

Since the directory record for the root directory had garbage in the
`name` field, the `t/helper/test-tool dump-untracked-cache` tool
printed this garbage as the path prefix (rather than '/') for each
directory in the untracked cache as it recursed.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agorebase: add a config option for --no-fork-point
Alex Henrie [Tue, 23 Feb 2021 07:18:40 +0000 (00:18 -0700)] 
rebase: add a config option for --no-fork-point

Some users (myself included) would prefer to have this feature off by
default because it can silently drop commits.

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agocommit-graph.c: display correct number of chunks when writing
Taylor Blau [Wed, 24 Feb 2021 17:12:22 +0000 (12:12 -0500)] 
commit-graph.c: display correct number of chunks when writing

When writing a commit-graph, a progress meter is shown which indicates
the number of pieces of data to write (one per commit in each chunk).

In 47410aa837 (commit-graph: use chunk-format write API, 2021-02-18),
the number of chunks became tracked by the new chunk-format API. But a
stray local variable was left behind from when write_commit_graph_file()
used to keep track of the same.

Since this was no longer updated after 47410aa837, the progress meter
appeared broken:

    $ git commit-graph write --reachable
    Expanding reachable commits in commit graph: 837569, done.
    Writing out commit graph in 3 passes: 166% (4187845/2512707), done.

Drop the local variable and rely instead on the chunk-format API to tell
us the correct number of chunks.

Reported-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Acked-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agol10n: Update Catalan translation
Jordi Mas [Wed, 24 Feb 2021 08:14:56 +0000 (09:14 +0100)] 
l10n: Update Catalan translation

Signed-off-by: Jordi Mas <jmas@softcatala.org>
5 years agopush: do not turn --delete '' into a matching push
Junio C Hamano [Tue, 23 Feb 2021 23:13:32 +0000 (15:13 -0800)] 
push: do not turn --delete '' into a matching push

When we added a syntax sugar "git push remote --delete <ref>" to
"git push" as a synonym to the canonical "git push remote :<ref>"
syntax at f517f1f2 (builtin-push: add --delete as syntactic sugar
for :foo, 2009-12-30), we weren't careful enough to make sure that
<ref> is not empty.

Blindly rewriting "--delete <ref>" to ":<ref>" means that an empty
string <ref> results in refspec ":", which is the syntax to ask for
"matching" push that does not delete anything.

Worse yet, if there were matching refs that can be fast-forwarded,
they would have been published prematurely, even if the user feels
that they are not ready yet to be pushed out, which would be a real
disaster.

Noticed-by: Tilman Vogel <tilman.vogel@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agodoc: mention approxidates for git-commit --date
Jeff King [Tue, 23 Feb 2021 20:50:58 +0000 (15:50 -0500)] 
doc: mention approxidates for git-commit --date

We describe the more strict date formats accepted by GIT_COMMITTER_DATE,
etc, but the --date option also allows the looser approxidate formats,
as well. Unfortunately we don't have a good or complete reference for
this format, but let's at least mention that it _is_ looser, and give a
few examples.

If we ever write separate, more complete date-format documentation, we
should refer to it from here.

Based-on-a-patch-by: Utku Gultopu <ugultopu@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoreplace "parameters" by "arguments" in error messages
Johannes Sixt [Tue, 23 Feb 2021 21:11:32 +0000 (22:11 +0100)] 
replace "parameters" by "arguments" in error messages

When an error message informs the user about an incorrect command
invocation, it should refer to "arguments", not "parameters".

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agomergetools/vimdiff: add vimdiff1 merge tool variant
Seth House [Sun, 14 Feb 2021 02:28:40 +0000 (19:28 -0700)] 
mergetools/vimdiff: add vimdiff1 merge tool variant

This adds yet another vimdiff/gvimdiff variant and presents conflicts as
a two-way diff between 'LOCAL' and 'REMOTE'. 'MERGED' is not opened
which deviates from the norm so usage text is echoed as a Vim message on
startup that instructs the user with how to proceed and how to abort.

Vimdiff is well-suited to two-way diffs so this is an option for a more
simple, more streamlined conflict resolution. For example: it is
difficult to communicate differences across more than two files using
only syntax highlighting; default vimdiff commands to get and put
changes between buffers do not need the user to manually specify
a source or destination buffer when only using two buffers.

Like other merge tools that directly compare 'LOCAL' with 'REMOTE', this
tool will benefit when paired with the new `mergetool.hideResolved`
setting.

Signed-off-by: Seth House <seth@eseth.com>
Tested-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agodoc/reftable: document how to handle windows
Han-Wen Nienhuys [Tue, 23 Feb 2021 16:57:23 +0000 (16:57 +0000)] 
doc/reftable: document how to handle windows

On Windows we can't delete or overwrite files opened by other processes. Here we
sketch how to handle this situation.

We propose to use a random element in the filename. It's possible to design an
alternate solution based on counters, but that would assign semantics to the
filenames that complicates implementation.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoMakefile: add {program,xdiff,test,git,fuzz}-objs & objects targets
Ævar Arnfjörð Bjarmason [Tue, 23 Feb 2021 11:41:31 +0000 (12:41 +0100)] 
Makefile: add {program,xdiff,test,git,fuzz}-objs & objects targets

Add targets to compile the various *.o files we declared in commonly
used *_OBJS variables. This is useful for debugging purposes, to
e.g. get to the point where we can compile a git.o. See [1] for a
use-case for this target.

https://lore.kernel.org/git/YBCGtd9if0qtuQxx@coredump.intra.peff.net/

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoMakefile: split OBJECTS into OBJECTS and GIT_OBJS
Ævar Arnfjörð Bjarmason [Tue, 23 Feb 2021 11:41:30 +0000 (12:41 +0100)] 
Makefile: split OBJECTS into OBJECTS and GIT_OBJS

Add a new GIT_OBJS variable, with the objects sufficient to get to a
git.o or common-main.o.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
5 years agoMakefile: sort OBJECTS assignment for subsequent change
Ævar Arnfjörð Bjarmason [Tue, 23 Feb 2021 11:41:29 +0000 (12:41 +0100)] 
Makefile: sort OBJECTS assignment for subsequent change

Change the order of the OBJECTS assignment, this makes a follow-up
change where we split it up into two variables smaller.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>