]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
3 years agocommit-reach: use one walk in remove_redundant()
Derrick Stolee [Fri, 19 Feb 2021 12:34:07 +0000 (12:34 +0000)] 
commit-reach: use one walk in remove_redundant()

The current implementation of remove_redundant() uses several calls to
paint_down_to_common() to determine that commits are independent of each
other. This leads to quadratic behavior when many inputs are passed to
commands such as 'git merge-base'.

For example, in the Linux kernel repository, I tested the performance
by passing all tags:

 git merge-base --independent $(git for-each-ref refs/tags --format="$(refname)")

(Note: I had to delete the tags v2.6.11-tree and v2.6.11 as they do
not point to commits.)

Here is the performance improvement introduced by this change:

 Before: 16.4s
  After:  1.1s

This performance improvement requires the commit-graph file to be
present. We keep the old algorithm around as remove_redundant_no_gen()
and use it when generation_numbers_enabled() is false. This is similar
to other algorithms within commit-reach.c. The new algorithm is
implemented in remove_redundant_with_gen().

The basic approach is to do one commit walk instead of many. First, scan
all commits in the list and mark their _parents_ with the STALE flag.
This flag will indicate commits that are reachable from one of the
inputs, except not including themselves. Then, walk commits until
covering all commits up to the minimum generation number pushing the
STALE flag throughout.

At the end, we need to clear the STALE bit from all of the commits
we walked. We move the non-stale commits in 'array' to the beginning of
the list, and this might overwrite stale commits. However, we store an
array of commits that started the walk, and use clear_commit_marks() on
each of those starting commits. That method will walk the reachable
commits with the STALE bit and clear them all. This makes the algorithm
safe for re-entry or for other uses of those commits after this walk.

This logic is covered by tests in t6600-test-reach.sh, so the behavior
does not change. This is tested both in the case with a commit-graph and
without.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocommit-reach: reduce requirements for remove_redundant()
Derrick Stolee [Mon, 1 Feb 2021 12:47:23 +0000 (12:47 +0000)] 
commit-reach: reduce requirements for remove_redundant()

Remove a comment at the beggining of remove_redundant() that mentions a
reordering of the input array to have the initial segment be the
independent commits and the final segment be the redundant commits.
While this behavior is followed in remove_redundant(), no callers rely
on that behavior.

Remove the final loop that copies this final segment and update the
comment to match the new behavior.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agodoc: add corrected commit date info
Abhishek Kumar [Sat, 16 Jan 2021 18:11:18 +0000 (18:11 +0000)] 
doc: add corrected commit date info

With generation data chunk and corrected commit dates implemented, let's
update the technical documentation for commit-graph.

Signed-off-by: Abhishek Kumar <abhishekkumar8222@gmail.com>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocommit-reach: use corrected commit dates in paint_down_to_common()
Abhishek Kumar [Sat, 16 Jan 2021 18:11:17 +0000 (18:11 +0000)] 
commit-reach: use corrected commit dates in paint_down_to_common()

091f4cf (commit: don't use generation numbers if not needed,
2018-08-30) changed paint_down_to_common() to use commit dates instead
of generation numbers v1 (topological levels) as the performance
regressed on certain topologies. With generation number v2 (corrected
commit dates) implemented, we no longer have to rely on commit dates and
can use generation numbers.

For example, the command `git merge-base v4.8 v4.9` on the Linux
repository walks 167468 commits, taking 0.135s for committer date and
167496 commits, taking 0.157s for corrected committer date respectively.

While using corrected commit dates, Git walks nearly the same number of
commits as commit date, the process is slower as for each comparision we
have to access a commit-slab (for corrected committer date) instead of
accessing struct member (for committer date).

This change incidentally broke the fragile t6404-recursive-merge test.
t6404-recursive-merge sets up a unique repository where all commits have
the same committer date without a well-defined merge-base.

While running tests with GIT_TEST_COMMIT_GRAPH unset, we use committer
date as a heuristic in paint_down_to_common(). 6404.1 'combined merge
conflicts' merges commits in the order:
- Merge C with B to form an intermediate commit.
- Merge the intermediate commit with A.

With GIT_TEST_COMMIT_GRAPH=1, we write a commit-graph and subsequently
use the corrected committer date, which changes the order in which
commits are merged:
- Merge A with B to form an intermediate commit.
- Merge the intermediate commit with C.

While resulting repositories are equivalent, 6404.4 'virtual trees were
processed' fails with GIT_TEST_COMMIT_GRAPH=1 as we are selecting
different merge-bases and thus have different object ids for the
intermediate commits.

As this has already causes problems (as noted in 859fdc0 (commit-graph:
define GIT_TEST_COMMIT_GRAPH, 2018-08-29)), we disable commit graph
within t6404-recursive-merge.

Signed-off-by: Abhishek Kumar <abhishekkumar8222@gmail.com>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocommit-graph: use generation v2 only if entire chain does
Abhishek Kumar [Sat, 16 Jan 2021 18:11:16 +0000 (18:11 +0000)] 
commit-graph: use generation v2 only if entire chain does

Since there are released versions of Git that understand generation
numbers in the commit-graph's CDAT chunk but do not understand the GDAT
chunk, the following scenario is possible:

1. "New" Git writes a commit-graph with the GDAT chunk.
2. "Old" Git writes a split commit-graph on top without a GDAT chunk.

If each layer of split commit-graph is treated independently, as it was
the case before this commit, with Git inspecting only the current layer
for chunk_generation_data pointer, commits in the lower layer (one with
GDAT) whould have corrected commit date as their generation number,
while commits in the upper layer would have topological levels as their
generation. Corrected commit dates usually have much larger values than
topological levels. This means that if we take two commits, one from the
upper layer, and one reachable from it in the lower layer, then the
expectation that the generation of a parent is smaller than the
generation of a child would be violated.

It is difficult to expose this issue in a test. Since we _start_ with
artificially low generation numbers, any commit walk that prioritizes
generation numbers will walk all of the commits with high generation
number before walking the commits with low generation number. In all the
cases I tried, the commit-graph layers themselves "protect" any
incorrect behavior since none of the commits in the lower layer can
reach the commits in the upper layer.

This issue would manifest itself as a performance problem in this case,
especially with something like "git log --graph" since the low
generation numbers would cause the in-degree queue to walk all of the
commits in the lower layer before allowing the topo-order queue to write
anything to output (depending on the size of the upper layer).

Therefore, When writing the new layer in split commit-graph, we write a
GDAT chunk only if the topmost layer has a GDAT chunk. This guarantees
that if a layer has GDAT chunk, all lower layers must have a GDAT chunk
as well.

Rewriting layers follows similar approach: if the topmost layer below
the set of layers being rewritten (in the split commit-graph chain)
exists, and it does not contain GDAT chunk, then the result of rewrite
does not have GDAT chunks either.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Abhishek Kumar <abhishekkumar8222@gmail.com>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocommit-graph: implement generation data chunk
Abhishek Kumar [Sat, 16 Jan 2021 18:11:15 +0000 (18:11 +0000)] 
commit-graph: implement generation data chunk

As discovered by Ævar, we cannot increment graph version to
distinguish between generation numbers v1 and v2 [1]. Thus, one of
pre-requistes before implementing generation number v2 was to
distinguish between graph versions in a backwards compatible manner.

We are going to introduce a new chunk called Generation DATa chunk (or
GDAT). GDAT will store corrected committer date offsets whereas CDAT
will still store topological level.

Old Git does not understand GDAT chunk and would ignore it, reading
topological levels from CDAT. New Git can parse GDAT and take advantage
of newer generation numbers, falling back to topological levels when
GDAT chunk is missing (as it would happen with a commit-graph written
by old Git).

We introduce a test environment variable 'GIT_TEST_COMMIT_GRAPH_NO_GDAT'
which forces commit-graph file to be written without generation data
chunk to emulate a commit-graph file written by old Git.

To minimize the space required to store corrrected commit date, Git
stores corrected commit date offsets into the commit-graph file, instea
of corrected commit dates. This saves us 4 bytes per commit, decreasing
the GDAT chunk size by half, but it's possible for the offset to
overflow the 4-bytes allocated for storage. As such overflows are and
should be exceedingly rare, we use the following overflow management
scheme:

We introduce a new commit-graph chunk, Generation Data OVerflow ('GDOV')
to store corrected commit dates for commits with offsets greater than
GENERATION_NUMBER_V2_OFFSET_MAX.

If the offset is greater than GENERATION_NUMBER_V2_OFFSET_MAX, we set
the MSB of the offset and the other bits store the position of corrected
commit date in GDOV chunk, similar to how Extra Edge List is maintained.

We test the overflow-related code with the following repo history:

           F - N - U
          /         \
U - N - U            N
         \          /
  N - F - N

Where the commits denoted by U have committer date of zero seconds
since Unix epoch, the commits denoted by N have committer date of
1112354055 (default committer date for the test suite) seconds since
Unix epoch and the commits denoted by F have committer date of
(2 ^ 31 - 2) seconds since Unix epoch.

The largest offset observed is 2 ^ 31, just large enough to overflow.

[1]: https://lore.kernel.org/git/87a7gdspo4.fsf@evledraar.gmail.com/

Signed-off-by: Abhishek Kumar <abhishekkumar8222@gmail.com>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocommit-graph: implement corrected commit date
Abhishek Kumar [Sat, 16 Jan 2021 18:11:14 +0000 (18:11 +0000)] 
commit-graph: implement corrected commit date

With most of preparations done, let's implement corrected commit date.

The corrected commit date for a commit is defined as:

* A commit with no parents (a root commit) has corrected commit date
  equal to its committer date.
* A commit with at least one parent has corrected commit date equal to
  the maximum of its commit date and one more than the largest corrected
  commit date among its parents.

As a special case, a root commit with timestamp of zero (01.01.1970
00:00:00Z) has corrected commit date of one, to be able to distinguish
from GENERATION_NUMBER_ZERO (that is, an uncomputed corrected commit
date).

To minimize the space required to store corrected commit date, Git
stores corrected commit date offsets into the commit-graph file. The
corrected commit date offset for a commit is defined as the difference
between its corrected commit date and actual commit date.

Storing corrected commit date requires sizeof(timestamp_t) bytes, which
in most cases is 64 bits (uintmax_t). However, corrected commit date
offsets can be safely stored using only 32-bits. This halves the size
of GDAT chunk, which is a reduction of around 6% in the size of
commit-graph file.

However, using offsets be problematic if a commit is malformed but valid
and has committer date of 0 Unix time, as the offset would be the same
as corrected commit date and thus require 64-bits to be stored properly.

While Git does not write out offsets at this stage, Git stores the
corrected commit dates in member generation of struct commit_graph_data.
It will begin writing commit date offsets with the introduction of
generation data chunk.

Signed-off-by: Abhishek Kumar <abhishekkumar8222@gmail.com>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocommit-graph: return 64-bit generation number
Abhishek Kumar [Sat, 16 Jan 2021 18:11:13 +0000 (18:11 +0000)] 
commit-graph: return 64-bit generation number

In a preparatory step for introducing corrected commit dates, let's
return timestamp_t values from commit_graph_generation(), use
timestamp_t for local variables and define GENERATION_NUMBER_INFINITY
as (2 ^ 63 - 1) instead.

We rename GENERATION_NUMBER_MAX to GENERATION_NUMBER_V1_MAX to
represent the largest topological level we can store in the commit data
chunk.

With corrected commit dates implemented, we will have two such *_MAX
variables to denote the largest offset and largest topological level
that can be stored.

Signed-off-by: Abhishek Kumar <abhishekkumar8222@gmail.com>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocommit-graph: add a slab to store topological levels
Abhishek Kumar [Sat, 16 Jan 2021 18:11:12 +0000 (18:11 +0000)] 
commit-graph: add a slab to store topological levels

In a later commit we will introduce corrected commit date as the
generation number v2. Corrected commit dates will be stored in the new
seperate Generation Data chunk. However, to ensure backwards
compatibility with "Old" Git we need to continue to write generation
number v1 (topological levels) to the commit data chunk. Thus, we need
to compute and store both versions of generation numbers to write the
commit-graph file.

Therefore, let's introduce a commit-slab `topo_level_slab` to store
topological levels; corrected commit date will be stored in the member
`generation` of struct commit_graph_data.

The macros `GENERATION_NUMBER_INFINITY` and `GENERATION_NUMBER_ZERO`
mark commits not in the commit-graph file and commits written by a
version of Git that did not compute generation numbers respectively.
Generation numbers are computed identically for both kinds of commits.

A "slab-miss" should return `GENERATION_NUMBER_INFINITY` as the commit
is not in the commit-graph file. However, since the slab is
zero-initialized, it returns 0 (or rather `GENERATION_NUMBER_ZERO`).
Thus, we no longer need to check if the topological level of a commit is
`GENERATION_NUMBER_INFINITY`.

We will add a pointer to the slab in `struct write_commit_graph_context`
and `struct commit_graph` to populate the slab in
`fill_commit_graph_info` if the commit has a pre-computed topological
level as in case of split commit-graphs.

Signed-off-by: Abhishek Kumar <abhishekkumar8222@gmail.com>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot6600-test-reach: generalize *_three_modes
Abhishek Kumar [Sat, 16 Jan 2021 18:11:11 +0000 (18:11 +0000)] 
t6600-test-reach: generalize *_three_modes

In a preparatory step to implement generation number v2, we add tests to
ensure Git can read and parse commit-graph files without Generation Data
chunk. These files represent commit-graph files written by Old Git and
are neccesary for backward compatability.

We extend run_three_modes() and test_three_modes() to *_all_modes() with
the fourth mode being "commit-graph without generation data chunk".

Signed-off-by: Abhishek Kumar <abhishekkumar8222@gmail.com>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocommit-graph: consolidate fill_commit_graph_info
Abhishek Kumar [Sat, 16 Jan 2021 18:11:10 +0000 (18:11 +0000)] 
commit-graph: consolidate fill_commit_graph_info

Both fill_commit_graph_info() and fill_commit_in_graph() parse
information present in commit data chunk. Let's simplify the
implementation by calling fill_commit_graph_info() within
fill_commit_in_graph().

fill_commit_graph_info() used to not load committer data from commit data
chunk. However, with the upcoming switch to using corrected committer
date as generation number v2, we will have to load committer date to
compute generation number value anyway.

e51217e15 (t5000: test tar files that overflow ustar headers,
30-06-2016) introduced a test 'generate tar with future mtime' that
creates a commit with committer date of (2^36 + 1) seconds since
EPOCH. The CDAT chunk provides 34-bits for storing committer date, thus
committer time overflows into generation number (within CDAT chunk) and
has undefined behavior.

The test used to pass as fill_commit_graph_info() would not set struct
member `date` of struct commit and load committer date from the object
database, generating a tar file with the expected mtime.

However, with corrected commit date, we will load the committer date
from CDAT chunk (truncated to lower 34-bits to populate the generation
number. Thus, Git sets date and generates tar file with the truncated
mtime.

The ustar format (the header format used by most modern tar programs)
only has room for 11 (or 12, depending on some implementations) octal
digits for the size and mtime of each file.

As the CDAT chunk is overflow by 12-octal digits but not 11-octal
digits, we split the existing tests to test both implementations
separately and add a new explicit test for 11-digit implementation.

To test the 11-octal digit implementation, we create a future commit
with committer date of 2^34 - 1, which overflows 11-octal digits without
overflowing 34-bits of the Commit Date chunks.

To test the 12-octal digit implementation, the smallest committer date
possible is 2^36 + 1, which overflows the CDAT chunk and thus
commit-graph must be disabled for the test.

Signed-off-by: Abhishek Kumar <abhishekkumar8222@gmail.com>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agorevision: parse parent in indegree_walk_step()
Abhishek Kumar [Sat, 16 Jan 2021 18:11:09 +0000 (18:11 +0000)] 
revision: parse parent in indegree_walk_step()

In indegree_walk_step(), we add unvisited parents to the indegree queue.
However, parents are not guaranteed to be parsed. As the indegree queue
sorts by generation number, let's parse parents before inserting them to
ensure the correct priority order.

Signed-off-by: Abhishek Kumar <abhishekkumar8222@gmail.com>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocommit-graph: fix regression when computing Bloom filters
Abhishek Kumar [Sat, 16 Jan 2021 18:11:08 +0000 (18:11 +0000)] 
commit-graph: fix regression when computing Bloom filters

Before computing Bloom filters, the commit-graph machinery uses
commit_gen_cmp to sort commits by generation order for improved diff
performance. 3d11275505 (commit-graph: examine commits by generation
number, 2020-03-30) claims that this sort can reduce the time spent to
compute Bloom filters by nearly half.

But since c49c82aa4c (commit: move members graph_pos, generation to a
slab, 2020-06-17), this optimization is broken, since asking for a
'commit_graph_generation()' directly returns GENERATION_NUMBER_INFINITY
while writing.

Not all hope is lost, though: 'commit_gen_cmp()' falls back to
comparing commits by their date when they have equal generation number,
and so since c49c82aa4c is purely a date comparison function. This
heuristic is good enough that we don't seem to loose appreciable
performance while computing Bloom filters.

Applying this patch (compared with v2.30.0) speeds up computing Bloom
filters by factors ranging from 0.40% to 5.19% on various repositories [1].

So, avoid the useless 'commit_graph_generation()' while writing by
instead accessing the slab directly. This returns the newly-computed
generation numbers, and allows us to avoid the heuristic by directly
comparing generation numbers.

[1]: https://lore.kernel.org/git/20210105094535.GN8396@szeder.dev/

Signed-off-by: Abhishek Kumar <abhishekkumar8222@gmail.com>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoGit 2.30 v2.30.0
Junio C Hamano [Sun, 27 Dec 2020 23:15:23 +0000 (15:15 -0800)] 
Git 2.30

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'pb/doc-git-linkit-fix'
Junio C Hamano [Sun, 27 Dec 2020 23:14:31 +0000 (15:14 -0800)] 
Merge branch 'pb/doc-git-linkit-fix'

Docfix.

* pb/doc-git-linkit-fix:
  git.txt: fix typos in 'linkgit' macro invocation

3 years agoMerge tag 'l10n-2.30.0-rnd2' of https://github.com/git-l10n/git-po
Junio C Hamano [Sun, 27 Dec 2020 23:01:16 +0000 (15:01 -0800)] 
Merge tag 'l10n-2.30.0-rnd2' of https://github.com/git-l10n/git-po

l10n for Git 2.30.0 round 2

* tag 'l10n-2.30.0-rnd2' of https://github.com/git-l10n/git-po:
  l10n: zh_CN: for git v2.30.0 l10n round 1 and 2
  l10n: zh_TW.po: v2.30.0 round 2 (1 untranslated)
  l10n: pl.po: add translation and set team leader
  l10n: pl.po: started Polish translation
  l10n: de.po: Update German translation for Git 2.30.0
  l10n: Update Catalan translation
  l10n: bg.po: Updated Bulgarian translation (5037t)
  l10n: fr.po v2.30.0 rnd 2
  l10n: tr: v2.30.0-r2
  l10n: sv.po: Update Swedish translation (5037t0f0u)
  l10n: vi.po(5037t): v2.30.0 rnd 2
  l10n: git.pot: v2.30.0 round 2 (1 new, 2 removed)
  l10n: Update Catalan translation
  l10n: fr.po: v2.30.0 rnd 1
  l10n: fr.po Fix a typo
  l10n: fr fix misleading message
  l10n: tr: v2.30.0-r1
  l10n: sv.po: Update Swedish translation (5038t0f0u)
  l10n: git.pot: v2.30.0 round 1 (70 new, 45 removed)

3 years agol10n: zh_CN: for git v2.30.0 l10n round 1 and 2
Jiang Xin [Mon, 7 Dec 2020 00:10:10 +0000 (08:10 +0800)] 
l10n: zh_CN: for git v2.30.0 l10n round 1 and 2

Translate 71 new messages (5037t0f0u) for git 2.30.0.

Reviewed-by: 依云 <lilydjwg@gmail.com>
Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
3 years agoMerge branch 'l10n/zh_TW/201223' of github.com:l10n-tw/git-po
Jiang Xin [Fri, 25 Dec 2020 07:12:02 +0000 (15:12 +0800)] 
Merge branch 'l10n/zh_TW/201223' of github.com:l10n-tw/git-po

* 'l10n/zh_TW/201223' of github.com:l10n-tw/git-po:
  l10n: zh_TW.po: v2.30.0 round 2 (1 untranslated)

3 years agol10n: zh_TW.po: v2.30.0 round 2 (1 untranslated)
pan93412 [Wed, 23 Dec 2020 13:52:18 +0000 (21:52 +0800)] 
l10n: zh_TW.po: v2.30.0 round 2 (1 untranslated)

Signed-off-by: pan93412 <pan93412@gmail.com>
3 years agol10n: pl.po: add translation and set team leader
Arusekk [Wed, 2 Dec 2020 23:19:58 +0000 (00:19 +0100)] 
l10n: pl.po: add translation and set team leader

Signed-off-by: Arusekk <arek_koz@o2.pl>
3 years agoGit 2.30-rc2 v2.30.0-rc2
Junio C Hamano [Wed, 23 Dec 2020 21:57:41 +0000 (13:57 -0800)] 
Git 2.30-rc2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'nk/refspecs-negative-fix'
Junio C Hamano [Wed, 23 Dec 2020 21:59:46 +0000 (13:59 -0800)] 
Merge branch 'nk/refspecs-negative-fix'

Hotfix for recent regression.

* nk/refspecs-negative-fix:
  negative-refspec: improve comment on query_matches_negative_refspec
  negative-refspec: fix segfault on : refspec

3 years agoMerge branch 'ma/maintenance-crontab-fix'
Junio C Hamano [Wed, 23 Dec 2020 21:59:46 +0000 (13:59 -0800)] 
Merge branch 'ma/maintenance-crontab-fix'

Hotfix for a topic of this cycle.

* ma/maintenance-crontab-fix:
  t7900-maintenance: test for magic markers
  gc: fix handling of crontab magic markers
  git-maintenance.txt: add missing word

3 years agoMerge branch 'dl/checkout-p-merge-base'
Junio C Hamano [Wed, 23 Dec 2020 21:59:46 +0000 (13:59 -0800)] 
Merge branch 'dl/checkout-p-merge-base'

Fix to a regression introduced during this cycle.

* dl/checkout-p-merge-base:
  checkout -p: handle tree arguments correctly again

3 years agoMerge branch 'js/no-more-prepare-for-main-in-test'
Junio C Hamano [Wed, 23 Dec 2020 21:59:46 +0000 (13:59 -0800)] 
Merge branch 'js/no-more-prepare-for-main-in-test'

Test coverage fix.

* js/no-more-prepare-for-main-in-test:
  tests: drop the `PREPARE_FOR_MAIN_BRANCH` prereq
  t9902: use `main` as initial branch name
  t6302: use `main` as initial branch name
  t5703: use `main` as initial branch name
  t5510: use `main` as initial branch name
  t5505: finalize transitioning to using the branch name `main`
  t3205: finalize transitioning to using the branch name `main`
  t3203: complete the transition to using the branch name `main`
  t3201: finalize transitioning to using the branch name `main`
  t3200: finish transitioning to the initial branch name `main`
  t1400: use `main` as initial branch name

3 years agoMerge branch 'jx/pack-redundant-on-single-pack'
Junio C Hamano [Wed, 23 Dec 2020 21:59:46 +0000 (13:59 -0800)] 
Merge branch 'jx/pack-redundant-on-single-pack'

"git pack-redandant" when there is only one packfile used to crash,
which has been corrected.

* jx/pack-redundant-on-single-pack:
  pack-redundant: fix crash when one packfile in repo

3 years agol10n: pl.po: started Polish translation
m4sk1n [Mon, 16 Jan 2017 19:31:10 +0000 (20:31 +0100)] 
l10n: pl.po: started Polish translation

Signed-off-by: Arusekk <arek_koz@o2.pl>
3 years agol10n: de.po: Update German translation for Git 2.30.0
Matthias Rüster [Sat, 19 Dec 2020 12:53:23 +0000 (13:53 +0100)] 
l10n: de.po: Update German translation for Git 2.30.0

Reviewed-by: Ralf Thielow <ralf.thielow@gmail.com>
Reviewed-by: Phillip Szelat <phillip.szelat@gmail.com>
Signed-off-by: Matthias Rüster <matthias.ruester@gmail.com>
3 years agoMerge branch 'master' of github.com:Softcatala/git-po
Jiang Xin [Wed, 23 Dec 2020 00:44:44 +0000 (08:44 +0800)] 
Merge branch 'master' of github.com:Softcatala/git-po

* 'master' of github.com:Softcatala/git-po:
  l10n: Update Catalan translation

3 years agogit.txt: fix typos in 'linkgit' macro invocation
Philippe Blain [Tue, 22 Dec 2020 15:44:42 +0000 (15:44 +0000)] 
git.txt: fix typos in 'linkgit' macro invocation

The 'linkgit' Asciidoc macro is misspelled as 'linkit' in the
description of 'GIT_SEQUENCE_EDITOR' since the addition of that variable
to git(1) in 902a126eca (doc: mention GIT_SEQUENCE_EDITOR and
'sequence.editor' more, 2020-08-31). Also, it uses two colons instead of
one.

Fix that.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agol10n: Update Catalan translation
Jordi Mas [Tue, 22 Dec 2020 17:04:53 +0000 (18:04 +0100)] 
l10n: Update Catalan translation

Signed-off-by: Jordi Mas <jmas@softcatala.org>
3 years agol10n: bg.po: Updated Bulgarian translation (5037t)
Alexander Shopov [Sun, 20 Dec 2020 18:00:54 +0000 (19:00 +0100)] 
l10n: bg.po: Updated Bulgarian translation (5037t)

Signed-off-by: Alexander Shopov <ash@kambanaria.org>
3 years agonegative-refspec: improve comment on query_matches_negative_refspec
Nipunn Koorapati [Tue, 22 Dec 2020 03:58:17 +0000 (03:58 +0000)] 
negative-refspec: improve comment on query_matches_negative_refspec

Comment did not adequately explain how the two loops work
together to achieve the goal of querying for matching of any
negative refspec.

Signed-off-by: Nipunn Koorapati <nipunn@dropbox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agonegative-refspec: fix segfault on : refspec
Nipunn Koorapati [Tue, 22 Dec 2020 03:58:16 +0000 (03:58 +0000)] 
negative-refspec: fix segfault on : refspec

The logic added to check for negative pathspec match by c0192df630
(refspec: add support for negative refspecs, 2020-09-30) looks at
refspec->src assuming it is never NULL, however when
remote.origin.push is set to ":", then refspec->src is NULL,
causing a segfault within strcmp.

Tell git to handle matching refspec by adding the needle to the
set of positively matched refspecs, since matching ":" refspecs
match anything as src.

Add test for matching refspec pushes fetch-negative-refspec
both individually and in combination with a negative refspec.

Signed-off-by: Nipunn Koorapati <nipunn@dropbox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'fr_2.30_rnd2' of github.com:jnavila/git
Jiang Xin [Tue, 22 Dec 2020 00:46:17 +0000 (08:46 +0800)] 
Merge branch 'fr_2.30_rnd2' of github.com:jnavila/git

* 'fr_2.30_rnd2' of github.com:jnavila/git:
  l10n: fr.po v2.30.0 rnd 2

3 years agot7900-maintenance: test for magic markers
Martin Ågren [Mon, 21 Dec 2020 21:26:33 +0000 (22:26 +0100)] 
t7900-maintenance: test for magic markers

When we insert our "BEGIN" and "END" markers into the cron table, it's
so that a Git version from many years into the future would be able to
identify this region in the cron table. Let's add a test to make sure
that these markers don't ever change.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Acked-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogc: fix handling of crontab magic markers
Martin Ågren [Mon, 21 Dec 2020 21:26:32 +0000 (22:26 +0100)] 
gc: fix handling of crontab magic markers

On `git maintenance start`, we add a few entries to the user's cron
table. We wrap our entries using two magic markers, "# BEGIN GIT
MAINTENANCE SCHEDULE" and "# END GIT MAINTENANCE SCHEDULE". At a later
`git maintenance stop`, we will go through the table and remove these
lines. Or rather, we will remove the "BEGIN" marker, the "END" marker
and everything between them.

Alas, we have a bug in how we detect the "END" marker: we don't. As we
loop through all the lines of the crontab, if we are in the "old
region", i.e., the region we're aiming to remove, we make an early
`continue` and don't get as far as checking for the "END" marker. Thus,
once we've seen our "BEGIN", we remove everything until the end of the
file.

Rewrite the logic for identifying these markers. There are four cases
that are mutually exclusive: The current line starts a region or it ends
it, or it's firmly within the region, or it's outside of it (and should
be printed).

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Acked-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogit-maintenance.txt: add missing word
Martin Ågren [Mon, 21 Dec 2020 21:26:31 +0000 (22:26 +0100)] 
git-maintenance.txt: add missing word

Add a missing "a" before "bunch".

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Acked-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocheckout -p: handle tree arguments correctly again
Johannes Schindelin [Sat, 19 Dec 2020 14:55:59 +0000 (14:55 +0000)] 
checkout -p: handle tree arguments correctly again

This fixes a segmentation fault.

The bug is caused by dereferencing `new_branch_info->commit` when it is
`NULL`, which is the case when the tree-ish argument is actually a tree,
not a commit-ish. This was introduced in 5602b500c3c (builtin/checkout:
fix `git checkout -p HEAD...` bug, 2020-10-07), where we tried to ensure
that the special tree-ish `HEAD...` is handled correctly.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agol10n: fr.po v2.30.0 rnd 2
Jean-Noël Avila [Mon, 21 Dec 2020 17:53:19 +0000 (18:53 +0100)] 
l10n: fr.po v2.30.0 rnd 2

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
3 years agol10n: tr: v2.30.0-r2
Emir Sarı [Mon, 21 Dec 2020 09:32:52 +0000 (12:32 +0300)] 
l10n: tr: v2.30.0-r2

Signed-off-by: Emir Sarı <bitigchi@me.com>
3 years agol10n: sv.po: Update Swedish translation (5037t0f0u)
Peter Krefting [Mon, 21 Dec 2020 07:10:43 +0000 (08:10 +0100)] 
l10n: sv.po: Update Swedish translation (5037t0f0u)

Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
3 years agol10n: vi.po(5037t): v2.30.0 rnd 2
Tran Ngoc Quan [Mon, 21 Dec 2020 01:45:38 +0000 (08:45 +0700)] 
l10n: vi.po(5037t): v2.30.0 rnd 2

Signed-off-by: Tran Ngoc Quan <vnwildman@gmail.com>
3 years agol10n: git.pot: v2.30.0 round 2 (1 new, 2 removed)
Jiang Xin [Sun, 20 Dec 2020 23:11:59 +0000 (07:11 +0800)] 
l10n: git.pot: v2.30.0 round 2 (1 new, 2 removed)

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

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
3 years agoMerge remote-tracking branch 'github/master' into git-po-master
Jiang Xin [Sun, 20 Dec 2020 23:10:19 +0000 (07:10 +0800)] 
Merge remote-tracking branch 'github/master' into git-po-master

* github/master: (42 commits)
  Git 2.30-rc1
  git-gui: use gray background for inactive text widgets
  Another batch before 2.30-rc1
  git-gui: Fix selected text colors
  Makefile: conditionally include GIT-VERSION-FILE
  git-gui: fix colored label backgrounds when using themed widgets
  config.mak.uname: remove old NonStop compatibility settings
  diff: correct interaction between --exit-code and -I<pattern>
  t/perf: fix test_export() failure with BSD `sed`
  style: do not "break" in switch() after "return"
  compat-util: pretend that stub setitimer() always succeeds
  strmap: make callers of strmap_remove() to call it in void context
  doc: mention Python 3.x supports
  index-format.txt: document v2 format of file system monitor extension
  docs: multi-pack-index: remove note about future 'verify' work
  init: provide useful advice about init.defaultBranch
  get_default_branch_name(): prepare for showing some advice
  branch -m: allow renaming a yet-unborn branch
  init: document `init.defaultBranch` better
  t7900: use --fixed-value in git-maintenance tests
  ...

3 years agol10n: Update Catalan translation
Jordi Mas [Sat, 19 Dec 2020 22:52:12 +0000 (23:52 +0100)] 
l10n: Update Catalan translation

Signed-off-by: Jordi Mas <jmas@softcatala.org>
3 years agoGit 2.30-rc1 v2.30.0-rc1
Junio C Hamano [Fri, 18 Dec 2020 23:14:30 +0000 (15:14 -0800)] 
Git 2.30-rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'jc/diff-I-status-fix'
Junio C Hamano [Fri, 18 Dec 2020 23:15:18 +0000 (15:15 -0800)] 
Merge branch 'jc/diff-I-status-fix'

"git diff -I<pattern> -exit-code" should exit with 0 status when
all the changes match the ignored pattern, but it didn't.

* jc/diff-I-status-fix:
  diff: correct interaction between --exit-code and -I<pattern>

3 years agoMerge branch 'es/perf-export-fix'
Junio C Hamano [Fri, 18 Dec 2020 23:15:18 +0000 (15:15 -0800)] 
Merge branch 'es/perf-export-fix'

Dev-support fix for BSD.

* es/perf-export-fix:
  t/perf: fix test_export() failure with BSD `sed`

3 years agoMerge branch 'rb/nonstop-config-mak-uname-update'
Junio C Hamano [Fri, 18 Dec 2020 23:15:18 +0000 (15:15 -0800)] 
Merge branch 'rb/nonstop-config-mak-uname-update'

Build update.

* rb/nonstop-config-mak-uname-update:
  config.mak.uname: remove old NonStop compatibility settings

3 years agoMerge branch 'ab/unreachable-break'
Junio C Hamano [Fri, 18 Dec 2020 23:15:17 +0000 (15:15 -0800)] 
Merge branch 'ab/unreachable-break'

Code clean-up.

* ab/unreachable-break:
  style: do not "break" in switch() after "return"

3 years agoMerge branch 'jc/strmap-remove-typefix'
Junio C Hamano [Fri, 18 Dec 2020 23:15:17 +0000 (15:15 -0800)] 
Merge branch 'jc/strmap-remove-typefix'

C-std compliance fix.

* jc/strmap-remove-typefix:
  strmap: make callers of strmap_remove() to call it in void context

3 years agoMerge branch 'jc/compat-util-setitimer-fix'
Junio C Hamano [Fri, 18 Dec 2020 23:15:17 +0000 (15:15 -0800)] 
Merge branch 'jc/compat-util-setitimer-fix'

Fix a recent bug in a rarely used replacement code.

* jc/compat-util-setitimer-fix:
  compat-util: pretend that stub setitimer() always succeeds

3 years agoMerge branch 'dd/doc-p4-requirements-update'
Junio C Hamano [Fri, 18 Dec 2020 23:15:17 +0000 (15:15 -0800)] 
Merge branch 'dd/doc-p4-requirements-update'

Doc update.

* dd/doc-p4-requirements-update:
  doc: mention Python 3.x supports

3 years agoMerge branch 'js/init-defaultbranch-advice'
Junio C Hamano [Fri, 18 Dec 2020 23:15:17 +0000 (15:15 -0800)] 
Merge branch 'js/init-defaultbranch-advice'

Our users are going to be trained to prepare for future change of
init.defaultBranch configuration variable.

* js/init-defaultbranch-advice:
  init: provide useful advice about init.defaultBranch
  get_default_branch_name(): prepare for showing some advice
  branch -m: allow renaming a yet-unborn branch
  init: document `init.defaultBranch` better

3 years agoMerge https://github.com/prati0100/git-gui
Junio C Hamano [Fri, 18 Dec 2020 23:07:10 +0000 (15:07 -0800)] 
Merge https://github.com/prati0100/git-gui

* https://github.com/prati0100/git-gui:
  git-gui: use gray background for inactive text widgets
  git-gui: Fix selected text colors
  Makefile: conditionally include GIT-VERSION-FILE
  git-gui: fix colored label backgrounds when using themed widgets
  git-gui: ssh-askpass: add a checkbox to show the input text
  git-gui: update Russian translation
  git-gui: use commit message template
  git-gui: Only touch GITGUI_MSG when needed

3 years agoMerge branch 'sh/inactive-background'
Pratyush Yadav [Fri, 18 Dec 2020 19:32:34 +0000 (01:02 +0530)] 
Merge branch 'sh/inactive-background'

Set a different background color for selections in inactive widgets.
This inactive color is calculated from the current theme colors to make
sure it works for all themes.

* sh/inactive-background:
  git-gui: use gray background for inactive text widgets

3 years agogit-gui: use gray background for inactive text widgets
Stefan Haller [Fri, 18 Dec 2020 09:43:14 +0000 (10:43 +0100)] 
git-gui: use gray background for inactive text widgets

This makes it easier to see at a glance which of the four main views has the
keyboard focus.

Signed-off-by: Stefan Haller <stefan@haller-berlin.de>
Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>
3 years agoAnother batch before 2.30-rc1
Junio C Hamano [Thu, 17 Dec 2020 23:04:26 +0000 (15:04 -0800)] 
Another batch before 2.30-rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'jh/index-v2-doc-on-fsmn'
Junio C Hamano [Thu, 17 Dec 2020 23:06:42 +0000 (15:06 -0800)] 
Merge branch 'jh/index-v2-doc-on-fsmn'

Doc update.

* jh/index-v2-doc-on-fsmn:
  index-format.txt: document v2 format of file system monitor extension

3 years agoMerge branch 'jb/midx-doc-update'
Junio C Hamano [Thu, 17 Dec 2020 23:06:41 +0000 (15:06 -0800)] 
Merge branch 'jb/midx-doc-update'

Doc update.

* jb/midx-doc-update:
  docs: multi-pack-index: remove note about future 'verify' work

3 years agoMerge branch 'rj/make-clean'
Junio C Hamano [Thu, 17 Dec 2020 23:06:40 +0000 (15:06 -0800)] 
Merge branch 'rj/make-clean'

Build optimization.

* rj/make-clean:
  Makefile: don't use a versioned temp distribution directory
  Makefile: don't try to clean old debian build product
  gitweb/Makefile: conditionally include ../GIT-VERSION-FILE
  Documentation/Makefile: conditionally include ../GIT-VERSION-FILE
  Documentation/Makefile: conditionally include doc.dep

3 years agoMerge branch 'js/t7064-master-to-initial'
Junio C Hamano [Thu, 17 Dec 2020 23:06:40 +0000 (15:06 -0800)] 
Merge branch 'js/t7064-master-to-initial'

Test update.

* js/t7064-master-to-initial:
  t7064: avoid relying on a specific default branch name

3 years agoMerge branch 'js/t6300-hardcode-main'
Junio C Hamano [Thu, 17 Dec 2020 23:06:40 +0000 (15:06 -0800)] 
Merge branch 'js/t6300-hardcode-main'

Test update.

* js/t6300-hardcode-main:
  t6300: avoid using the default name of the initial branch

3 years agoMerge branch 'jk/oid-array-cleanup'
Junio C Hamano [Thu, 17 Dec 2020 23:06:40 +0000 (15:06 -0800)] 
Merge branch 'jk/oid-array-cleanup'

Code clean-up.

* jk/oid-array-cleanup:
  commit-graph: use size_t for array allocation and indexing
  commit-graph: replace packed_oid_list with oid_array
  commit-graph: drop count_distinct_commits() function
  oid-array: provide a for-loop iterator
  oid-array: make sort function public
  cache.h: move hash/oid functions to hash.h
  t0064: make duplicate tests more robust
  t0064: drop sha1 mention from filename
  oid-array.h: drop sha1 mention from header guard

3 years agoMerge branch 'tb/partial-clone-filters-fix'
Junio C Hamano [Thu, 17 Dec 2020 23:06:40 +0000 (15:06 -0800)] 
Merge branch 'tb/partial-clone-filters-fix'

Fix potential server side resource deallocation issues when
responding to a partial clone request.

* tb/partial-clone-filters-fix:
  upload-pack.c: don't free allowed_filters util pointers
  builtin/clone.c: don't ignore transport_fetch_refs() errors

3 years agoMerge branch 'js/t7900-protect-pwd-in-config-get'
Junio C Hamano [Thu, 17 Dec 2020 23:06:39 +0000 (15:06 -0800)] 
Merge branch 'js/t7900-protect-pwd-in-config-get'

Hotfix for test breakage.

* js/t7900-protect-pwd-in-config-get:
  t7900: use --fixed-value in git-maintenance tests

3 years agoMerge branch 'st/selected-text-colors'
Pratyush Yadav [Thu, 17 Dec 2020 20:22:26 +0000 (01:52 +0530)] 
Merge branch 'st/selected-text-colors'

Set colors for selected text properly.

* st/selected-text-colors:
  git-gui: Fix selected text colors

3 years agogit-gui: Fix selected text colors
Serg Tereshchenko [Sun, 22 Nov 2020 13:32:33 +0000 (15:32 +0200)] 
git-gui: Fix selected text colors

Added selected state colors for text widget.

Same colors for active and inactive selection, to match previous
behaviour.

Signed-off-by: Serg Tereshchenko <serg.partizan@gmail.com>
Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>
3 years agoMerge branch 'rj/clean-speedup'
Pratyush Yadav [Thu, 17 Dec 2020 19:12:14 +0000 (00:42 +0530)] 
Merge branch 'rj/clean-speedup'

Speed up 'make clean' on Cygwin.

* rj/clean-speedup:
  Makefile: conditionally include GIT-VERSION-FILE

3 years agoMakefile: conditionally include GIT-VERSION-FILE
Ramsay Jones [Mon, 7 Dec 2020 00:39:30 +0000 (00:39 +0000)] 
Makefile: conditionally include GIT-VERSION-FILE

The 'clean' target is noticeably slow on cygwin, even for a 'do-nothing'
invocation of 'make clean'. For example, the second 'make clean' given
below:

  $ make clean >/dev/null 2>&1
  $ make clean
  GITGUI_VERSION = 0.21.0.85.g3e5c
  rm -rf git-gui lib/tclIndex po/*.msg
  rm -rf GIT-VERSION-FILE GIT-GUI-VARS
  $

has been timed at 1.934s on my laptop (an old core i5-4200M @ 2.50GHz,
8GB RAM, 1TB HDD).

Notice that the Makefile, as part of processing the 'clean' target, is
updating the 'GIT-VERSION-FILE' file.  This is to ensure that the
$(GITGUI_VERSION) make variable is set, once that file had been included.
However, the 'clean' target does not use the $(GITGUI_VERSION) variable,
so this is wasted effort.

In order to eliminate such wasted effort, use the value of the internal
$(MAKECMDGOALS) variable to only '-include GIT-VERSION-FILE' when the
target is not 'clean'. (This drops the time down to 0.676s, on my laptop,
giving an improvement of 65.05%).

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>
3 years agoMerge branch 'sh/macos-labels'
Pratyush Yadav [Thu, 17 Dec 2020 19:02:06 +0000 (00:32 +0530)] 
Merge branch 'sh/macos-labels'

Fix label background colors on MacOS when ttk is enabled.

* sh/macos-labels:
  git-gui: fix colored label backgrounds when using themed widgets

3 years agogit-gui: fix colored label backgrounds when using themed widgets
Stefan Haller [Sun, 22 Nov 2020 19:45:37 +0000 (20:45 +0100)] 
git-gui: fix colored label backgrounds when using themed widgets

The aqua theme on Mac doesn't support changing the background color for labels
and frames [1]. Since the red, green, and yellow backgrounds of the labels for
unstaged and staged files and the diff pane are so important design elements of
git gui's main window, it's not acceptable for them to have grey backgrounds on
Mac.

To work around this, simply use non-themed widgets for all labels on Mac. This
is not a big problem because labels don't look extremely different between the
themed and non-themed versions. There are subtle differences, but they are not
as bad as having the wrong background color.

[1] https://stackoverflow.com/a/6723911

Signed-off-by: Stefan Haller <stefan@haller-berlin.de>
Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>
3 years agoconfig.mak.uname: remove old NonStop compatibility settings
Randall S. Becker [Wed, 16 Dec 2020 22:07:52 +0000 (17:07 -0500)] 
config.mak.uname: remove old NonStop compatibility settings

The MKDIR_WO_TRAILING_SLASH and NO_SETITIMER options are no longer
needed on the NonStop platforms as both are now supported by the
oldest supported operating system revision.

Signed-off-by: Randall S. Becker <rsbecker@nexbridge.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agopack-redundant: fix crash when one packfile in repo
Jiang Xin [Thu, 17 Dec 2020 01:57:09 +0000 (20:57 -0500)] 
pack-redundant: fix crash when one packfile in repo

Command `git pack-redundant --all` will crash if there is only one
packfile in the repository.  This is because, if there is only one
packfile in local_packs, `cmp_local_packs` will do nothing and will
leave `pl->unique_objects` as uninitialized.

Also add testcases for repository with no packfile and one packfile
in t5323.

Reported-by: Daniel C. Klauer <daniel.c.klauer@web.de>
Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agotests: drop the `PREPARE_FOR_MAIN_BRANCH` prereq
Johannes Schindelin [Thu, 17 Dec 2020 01:07:10 +0000 (01:07 +0000)] 
tests: drop the `PREPARE_FOR_MAIN_BRANCH` prereq

We no longer use it.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot9902: use `main` as initial branch name
Johannes Schindelin [Thu, 17 Dec 2020 01:07:09 +0000 (01:07 +0000)] 
t9902: use `main` as initial branch name

In 8164360fc86 (t9902: prepare a test for the upcoming default branch
name, 2020-10-23), we started adjusting this test script for the default
initial branch name changing to `main`.

However, there is no need to wait for that: let's adjust the test script
to stop relying on a specific initial branch name by setting it
explicitly. This allows us to drop the `PREPARE_FOR_MAIN_BRANCH` prereq
from one test case.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot6302: use `main` as initial branch name
Johannes Schindelin [Thu, 17 Dec 2020 01:07:08 +0000 (01:07 +0000)] 
t6302: use `main` as initial branch name

In 66713e84e71 (tests: prepare aligned mentions of the default branch
name, 2020-10-23), we started adjusting this test script for the default
initial branch name changing to `main`.

However, there is no need to wait for that: let's adjust the test script
to stop relying on a specific initial branch name by setting it
explicitly. This allows us to drop the `PREPARE_FOR_MAIN_BRANCH` prereq
from six test cases.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot5703: use `main` as initial branch name
Johannes Schindelin [Thu, 17 Dec 2020 01:07:07 +0000 (01:07 +0000)] 
t5703: use `main` as initial branch name

In 97cf8d50b59 (t5703: adjust a test case for the upcoming default
branch name, 2020-10-23), we prepared this test script for a world when
the default initial branch name would be `main`.

However, there is no need to wait for that: let's adjust the test script
to stop relying on a specific initial branch name by setting it
explicitly. This allows us to drop the `PREPARE_FOR_MAIN_BRANCH` prereq
from one test case.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot5510: use `main` as initial branch name
Johannes Schindelin [Thu, 17 Dec 2020 01:07:06 +0000 (01:07 +0000)] 
t5510: use `main` as initial branch name

In 66713e84e71 (tests: prepare aligned mentions of the default branch
name, 2020-10-23), we prepared this test script for a time when the
default initial branch name would be `main`.

However, there is no need to wait for that: let's adjust the test script
to stop relying on a specific initial branch name by setting it
explicitly. This allows us to drop the `PREPARE_FOR_MAIN_BRANCH` prereq
from two test cases.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot5505: finalize transitioning to using the branch name `main`
Johannes Schindelin [Thu, 17 Dec 2020 01:07:05 +0000 (01:07 +0000)] 
t5505: finalize transitioning to using the branch name `main`

In 66713e84e71 (tests: prepare aligned mentions of the default branch
name, 2020-10-23), we started that transition, trying to prepare for a
time when `git init` would use that name for the initial branch.

Even if that time has not arrived, we can complete the transition by
making the test script independent of the default branch name. This also
allows us to drop the `PREPARE_FOR_MAIN_BRANCH` prereq from four test
cases.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot3205: finalize transitioning to using the branch name `main`
Johannes Schindelin [Thu, 17 Dec 2020 01:07:04 +0000 (01:07 +0000)] 
t3205: finalize transitioning to using the branch name `main`

In 66713e84e71 (tests: prepare aligned mentions of the default branch
name, 2020-10-23), we started that transition, trying to prepare for a
time when `git init` would use that name for the initial branch.

Even if that time has not arrived, we can complete the transition by
making the test script independent of the default branch name. This also
allows us to drop the `PREPARE_FOR_MAIN_BRANCH` prereq from one test
case.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot3203: complete the transition to using the branch name `main`
Johannes Schindelin [Thu, 17 Dec 2020 01:07:03 +0000 (01:07 +0000)] 
t3203: complete the transition to using the branch name `main`

In 66713e84e71 (tests: prepare aligned mentions of the default branch
name, 2020-10-23), we started that transition, trying to prepare for a
time when `git init` would use that name for the initial branch.

Even if that time has not arrived, we can complete the transition by
making the test script independent of the default branch name. This also
allows us to drop the `PREPARE_FOR_MAIN_BRANCH` prereq from one test
case.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot3201: finalize transitioning to using the branch name `main`
Johannes Schindelin [Thu, 17 Dec 2020 01:07:02 +0000 (01:07 +0000)] 
t3201: finalize transitioning to using the branch name `main`

In 66713e84e71 (tests: prepare aligned mentions of the default branch
name, 2020-10-23), we started that transition, trying to prepare for a
time when `git init` would use that name for the initial branch.

Even if that time has not arrived, we can complete the transition by
making the test script independent of the default branch name. This also
allows us to drop the `PREPARE_FOR_MAIN_BRANCH` prereq from one test
case.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot3200: finish transitioning to the initial branch name `main`
Johannes Schindelin [Thu, 17 Dec 2020 01:07:01 +0000 (01:07 +0000)] 
t3200: finish transitioning to the initial branch name `main`

In 56300ff356b (t3200: prepare for `main` being shorter than `master`,
2020-10-23) and in 66713e84e71 (tests: prepare aligned mentions of the
default branch name, 2020-10-23), we started to prepare t3200 for a new
world where `git init` uses the branch name `main` for the initial
branch.

We do not even have to wait for that new world: we can easily ensure
that that branch name is used, independent of the exact name `git init`
will give the initial branch, so let's do that.

This also lets us remove the `PREPARE_FOR_MAIN_BRANCH` prereq from three
test cases in that script.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot1400: use `main` as initial branch name
Johannes Schindelin [Thu, 17 Dec 2020 01:07:00 +0000 (01:07 +0000)] 
t1400: use `main` as initial branch name

In 3224b0f0bb7 (t1400: prepare for `main` being default branch name,
2020-10-23), we prepared t1400 for a time when the default initial
branch name would be `main`.

However, there is no need to wait that long: let's adjust the test
script to stop relying on a specific initial branch name by setting it
explicitly. This allows us to drop the `PREPARE_FOR_MAIN_BRANCH` prereq
from two test cases.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agodiff: correct interaction between --exit-code and -I<pattern>
Junio C Hamano [Thu, 17 Dec 2020 01:27:13 +0000 (17:27 -0800)] 
diff: correct interaction between --exit-code and -I<pattern>

Just like "git diff -w --exit-code" should exit with 0 when ignoring
whitespace differences results in no changes shown, if ignoring
certain changes with "git diff -I<pattern> --exit-code" result in an
empty patch, we should exit with 0.

The test suite did not cover the interaction between "--exit-code"
and "-w"; add one while adding a new test for "--exit-code" + "-I".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'fr_next' of github.com:jnavila/git into git-po-master
Jiang Xin [Thu, 17 Dec 2020 00:41:27 +0000 (08:41 +0800)] 
Merge branch 'fr_next' of github.com:jnavila/git into git-po-master

* 'fr_next' of github.com:jnavila/git:
  l10n: fr.po: v2.30.0 rnd 1
  l10n: fr.po Fix a typo
  l10n: fr fix misleading message

3 years agoMerge branch '2.30-rc1' of github.com:bitigchi/git-po
Jiang Xin [Thu, 17 Dec 2020 00:39:48 +0000 (08:39 +0800)] 
Merge branch '2.30-rc1' of github.com:bitigchi/git-po

* '2.30-rc1' of github.com:bitigchi/git-po:
  l10n: tr: v2.30.0-r1

3 years agol10n: fr.po: v2.30.0 rnd 1
Jean-Noël Avila [Wed, 16 Dec 2020 21:26:55 +0000 (22:26 +0100)] 
l10n: fr.po: v2.30.0 rnd 1

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
3 years agol10n: fr.po Fix a typo
Baptiste Fontaine [Tue, 27 Oct 2020 12:06:12 +0000 (13:06 +0100)] 
l10n: fr.po Fix a typo

Signed-off-by: Baptiste Fontaine <b@ptistefontaine.fr>
3 years agol10n: fr fix misleading message
Jean-Noël Avila [Tue, 27 Oct 2020 21:01:24 +0000 (22:01 +0100)] 
l10n: fr fix misleading message

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Reported-by: Sami Boukortt <sami@boukortt.com>
3 years agot/perf: fix test_export() failure with BSD `sed`
Eric Sunshine [Wed, 16 Dec 2020 07:39:07 +0000 (02:39 -0500)] 
t/perf: fix test_export() failure with BSD `sed`

test_perf() runs each test in its own subshell which makes it difficult
to persist variables between tests. test_export() addresses this
shortcoming by grabbing the values of specified variables after a test
runs but before the subshell exits, and writes those values to a file
which is loaded into the environment of subsequent tests.

To grab the values to be persisted, test_export() pipes the output of
the shell's builtin `set` command through `sed` which plucks them out
using a regular expression along the lines of `s/^(var1|var2)/.../p`.
Unfortunately, though, this use of alternation is not portable. For
instance, BSD-lineage `sed` (including macOS `sed`) does not support it
in the default "basic regular expression" mode (BRE). It may be possible
to enable "extended regular expression" mode (ERE) in some cases with
`sed -E`, however, `-E` is neither portable nor part of POSIX.

Fortunately, alternation is unnecessary in this case and can easily be
avoided, so replace it with a series of simple expressions such as
`s/^var1/.../p;s/^var2/.../p`.

While at it, tighten the expressions so they match the variable names
exactly rather than matching prefixes (i.e. use `s/^var1=/.../p`).

If the requirements of test_export() become more complex in the future,
then an alternative would be to replace `sed` with `perl` which supports
alternation on all platforms, however, the simple elimination of
alternation via multiple `sed` expressions suffices for the present.

Reported-by: Sangeeta <sangunb09@gmail.com>
Diagnosed-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agol10n: tr: v2.30.0-r1
Emir Sarı [Wed, 16 Dec 2020 12:31:50 +0000 (15:31 +0300)] 
l10n: tr: v2.30.0-r1

Signed-off-by: Emir Sarı <bitigchi@me.com>
3 years agostyle: do not "break" in switch() after "return"
Ævar Arnfjörð Bjarmason [Tue, 15 Dec 2020 23:50:27 +0000 (00:50 +0100)] 
style: do not "break" in switch() after "return"

Remove this unreachable code. It was found by SunCC, it's found by a
non-fatal warning emitted by SunCC. It's one of the things it's more
vehement about than GCC & Clang.

It complains about a lot of other similarly unreachable code, e.g. a
BUG(...) without a "return", and a "return 0" after a long if/else,
both of whom have "return" statements. Those are also genuine
redundancies to a compiler, but arguably make the code a bit easier to
read & less fragile to maintain.

These return/break cases are just unnecessary however, and as seen
here the surrounding code just did a plain "return" without a "break"
already.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocompat-util: pretend that stub setitimer() always succeeds
Junio C Hamano [Tue, 15 Dec 2020 21:26:17 +0000 (13:26 -0800)] 
compat-util: pretend that stub setitimer() always succeeds

When 15b52a44 (compat-util: type-check parameters of no-op
replacement functions, 2020-08-06) turned a handful of no-op
C-preprocessor macros into static inline functions to give the
callers a better type checking for their parameters, it forgot
to return anything from the stubbed out setitimer() function,
even though the function was defined to return an int just like the
real thing.

Since the original C-preprocessor macro implementation was to just
turn the call to the function an empty statement, we know that the
existing callers do not check the return value from it, and it does
not matter what value we return.  But it is safer to pretend that
the call succeeded by returning 0 than making it fail by returning -1
and clobbering errno with some value.

Reported-by: Randall S. Becker <rsbecker@nexbridge.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agostrmap: make callers of strmap_remove() to call it in void context
Junio C Hamano [Tue, 15 Dec 2020 21:25:36 +0000 (13:25 -0800)] 
strmap: make callers of strmap_remove() to call it in void context

Two "static inline" functions, both of which return void, call
strmap_remove() and tries to return the value it returns as their
return value, which is just bogus, as strmap_remove() returns void
itself.  Call it in the void context and fall-thru the control to
the end instead.

Reported-by: Randall S. Becker <rsbecker@nexbridge.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agol10n: sv.po: Update Swedish translation (5038t0f0u)
Peter Krefting [Tue, 15 Dec 2020 20:42:13 +0000 (21:42 +0100)] 
l10n: sv.po: Update Swedish translation (5038t0f0u)

Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
3 years agol10n: git.pot: v2.30.0 round 1 (70 new, 45 removed)
Jiang Xin [Tue, 15 Dec 2020 08:27:56 +0000 (16:27 +0800)] 
l10n: git.pot: v2.30.0 round 1 (70 new, 45 removed)

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

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
3 years agodoc: mention Python 3.x supports
Đoàn Trần Công Danh [Thu, 10 Dec 2020 14:30:17 +0000 (21:30 +0700)] 
doc: mention Python 3.x supports

Commit 0b4396f068, (git-p4: make python2.7 the oldest supported version,
2019-12-13) pointed out that git-p4 uses Python 2.7-or-later features
in the code.

In addition, git-p4 gained enough support for Python 3 from
6cec21a82f, (git-p4: encode/decode communication with p4 for
python3, 2019-12-13).

Let's update our documentation to reflect that fact.

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>