git
3 years agol10n: git.pot: v2.29.0 round 2 (1 new, 1 removed)
Jiang Xin [Sat, 10 Oct 2020 01:33:19 +0000 (09:33 +0800)] 
l10n: git.pot: v2.29.0 round 2 (1 new, 1 removed)

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

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
3 years agoMerge tag 'v2.29.0-rc1' of github.com:git/git
Jiang Xin [Sat, 10 Oct 2020 01:22:36 +0000 (09:22 +0800)] 
Merge tag 'v2.29.0-rc1' of github.com:git/git

Git 2.29-rc1

* tag 'v2.29.0-rc1' of github.com:git/git:
  Git 2.29-rc1
  doc: fix the bnf like style of some commands
  doc: git-remote fix ups
  doc: use linkgit macro where needed.
  git-bisect-lk2009: make continuation of list indented
  ci: do not skip tagged revisions in GitHub workflows
  ci: skip GitHub workflow runs for already-tested commits/trees
  tests: avoid using the branch name `main`
  t1415: avoid using `main` as ref name
  Makefile: ASCII-sort += lists
  help: do not expect built-in commands to be hardlinked
  index-pack: make get_base_data() comment clearer
  index-pack: drop type_cas mutex
  index-pack: restore "resolving deltas" progress meter
  compat/mingw.h: drop extern from function declaration
  GitHub workflow: automatically follow minor updates of setup-msbuild
  t5534: split stdout and stderr redirection

3 years agocommit-graph: don't write commit-graph when disabled
Derrick Stolee [Fri, 9 Oct 2020 20:53:52 +0000 (20:53 +0000)] 
commit-graph: don't write commit-graph when disabled

The core.commitGraph config setting can be set to 'false' to prevent
parsing commits from the commit-graph file(s). This causes an issue when
trying to write with "--split" which needs to distinguish between
commits that are in the existing commit-graph layers and commits that
are not. The existing mechanism uses parse_commit() and follows by
checking if there is a 'graph_pos' that shows the commit was parsed from
the commit-graph file.

When core.commitGraph=false, we do not parse the commits from the
commit-graph and 'graph_pos' indicates that no commits are in the
existing file. The --split logic moves forward creating a new layer on
top that holds all reachable commits, then possibly merges down into
those layers, resulting in duplicate commits. The previous change makes
that merging process more robust to such a situation in case it happens
in the written commit-graph data.

The easy answer here is to avoid writing a commit-graph if reading the
commit-graph is disabled. Since the resulting commit-graph will would not
be read by subsequent Git processes. This is more natural than forcing
core.commitGraph to be true for the 'write' process.

Reported-by: Thomas Braun <thomas.braun@virtuell-zuhause.de>
Helped-by: Jeff King <peff@peff.net>
Helped-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocommit-graph: ignore duplicates when merging layers
Derrick Stolee [Fri, 9 Oct 2020 20:53:51 +0000 (20:53 +0000)] 
commit-graph: ignore duplicates when merging layers

Thomas reported [1] that a "git fetch" command was failing with an error
saying "unexpected duplicate commit id". The root cause is that they had
fetch.writeCommitGraph enabled which generates commit-graph chains, and
this instance was merging two layers that both contained the same commit
ID.

[1] https://lore.kernel.org/git/55f8f00c-a61c-67d4-889e-a9501c596c39@virtuell-zuhause.de/

The initial assumption is that Git would not write a commit ID into a
commit-graph layer if it already exists in a lower commit-graph layer.
Somehow, this specific case did get into that situation, leading to this
error.

While unexpected, this isn't actually invalid (as long as the two layers
agree on the metadata for the commit). When we parse a commit that does
not have a graph_pos in the commit_graph_data_slab, we use binary search
in the commit-graph layers to find the commit and set graph_pos. That
position is never used again in this case. However, when we parse a
commit from the commit-graph file, we load its parents from the
commit-graph and assign graph_pos at that point. If those parents were
already parsed from the commit-graph, then nothing needs to be done.
Otherwise, this graph_pos is a valid position in the commit-graph so we
can parse the parents, when necessary.

Thus, this die() is too aggressive. The easiest thing to do would be to
ignore the duplicates.

If we only ignore the duplicates, then we will produce a commit-graph
that has identical commit IDs listed in adjacent positions. This excess
data will never be removed from the commit-graph, which could cascade
into significantly bloated file sizes.

Thankfully, we can collapse the list to erase the duplicate commit
pointers. This allows us to get the end result we want without extra
memory costs and minimal CPU time.

The root cause is due to disabling core.commitGraph, which prevents
parsing commits from the lower layers during a 'git commit-graph write
--split' command. Since we use the 'graph_pos' value to determine
whether a commit is in a lower layer, we never discover that those
commits are already in the commit-graph chain and add them to the top
layer. This layer is then merged down, creating duplicates.

The test added in t5324-split-commit-graph.sh fails without this change.
However, we still have not completely removed the need for this
duplicate check. That will come in a follow-up change.

Reported-by: Thomas Braun <thomas.braun@virtuell-zuhause.de>
Helped-by: Taylor Blau <me@ttaylorr.com>
Co-authored-by: Jeff King <peff@peff.net>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoci: github action - add check for whitespace errors
Chris. Webster [Tue, 22 Sep 2020 07:28:04 +0000 (07:28 +0000)] 
ci: github action - add check for whitespace errors

Not all developers are aware of `git diff --check` to warn
about whitespace issues.  Running a check when a pull request is
opened or updated can save time for reviewers and the submitter.

A GitHub workflow will run when a pull request is created or the
contents are updated to check the patch series.  A pull request
provides the necessary information (number of commits) to only
check the patch series.

To ensure the developer is aware of any issues, a comment will be
added to the pull request with the check errors.

Signed-off-by: Chris. Webster <chris@webstech.net>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoGit 2.29-rc1 v2.29.0-rc1
Junio C Hamano [Fri, 9 Oct 2020 04:53:09 +0000 (21:53 -0700)] 
Git 2.29-rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'js/default-branch-name-part-3'
Junio C Hamano [Fri, 9 Oct 2020 04:53:26 +0000 (21:53 -0700)] 
Merge branch 'js/default-branch-name-part-3'

Test preparation for the switch of default branch name continues.

* js/default-branch-name-part-3:
  tests: avoid using the branch name `main`
  t1415: avoid using `main` as ref name

3 years agoMerge branch 'js/ci-ghwf-dedup-tests'
Junio C Hamano [Fri, 9 Oct 2020 04:53:26 +0000 (21:53 -0700)] 
Merge branch 'js/ci-ghwf-dedup-tests'

The logic to skip testing on the tagged commit and the tag itself
was not quite consistent which led to failure of Windows test
tasks.  It has been revamped to consistently skip revisions that
have already been tested, based on the tree object of the revision.

* js/ci-ghwf-dedup-tests:
  ci: do not skip tagged revisions in GitHub workflows
  ci: skip GitHub workflow runs for already-tested commits/trees

3 years agoMerge branch 'ja/misc-doc-fixes'
Junio C Hamano [Fri, 9 Oct 2020 04:53:26 +0000 (21:53 -0700)] 
Merge branch 'ja/misc-doc-fixes'

Doc fixes.

* ja/misc-doc-fixes:
  doc: fix the bnf like style of some commands
  doc: git-remote fix ups
  doc: use linkgit macro where needed.
  git-bisect-lk2009: make continuation of list indented

3 years agoMerge branch 'dl/makefile-sort'
Junio C Hamano [Fri, 9 Oct 2020 04:53:26 +0000 (21:53 -0700)] 
Merge branch 'dl/makefile-sort'

Makefile clean-up.

* dl/makefile-sort:
  Makefile: ASCII-sort += lists

3 years agoMerge branch 'js/no-builtins-on-disk-option'
Junio C Hamano [Fri, 9 Oct 2020 04:53:26 +0000 (21:53 -0700)] 
Merge branch 'js/no-builtins-on-disk-option'

Hotfix to breakage introduced in the topic in v2.29-rc0

* js/no-builtins-on-disk-option:
  help: do not expect built-in commands to be hardlinked

3 years agoMerge branch 'js/ghwf-setup-msbuild-update'
Junio C Hamano [Fri, 9 Oct 2020 04:53:26 +0000 (21:53 -0700)] 
Merge branch 'js/ghwf-setup-msbuild-update'

CI update.

* js/ghwf-setup-msbuild-update:
  GitHub workflow: automatically follow minor updates of setup-msbuild

3 years agoMerge branch 'jk/index-pack-hotfixes'
Junio C Hamano [Fri, 9 Oct 2020 04:53:25 +0000 (21:53 -0700)] 
Merge branch 'jk/index-pack-hotfixes'

Hotfix and clean-up for the jt/threaded-index-pack topic that has
graduated to v2.29-rc0.

* jk/index-pack-hotfixes:
  index-pack: make get_base_data() comment clearer
  index-pack: drop type_cas mutex
  index-pack: restore "resolving deltas" progress meter

3 years agoMerge branch 'dl/mingw-header-cleanup'
Junio C Hamano [Fri, 9 Oct 2020 04:53:25 +0000 (21:53 -0700)] 
Merge branch 'dl/mingw-header-cleanup'

Header clean-up.

* dl/mingw-header-cleanup:
  compat/mingw.h: drop extern from function declaration

3 years agoMerge branch 'hx/push-atomic-with-cert'
Junio C Hamano [Fri, 9 Oct 2020 04:53:25 +0000 (21:53 -0700)] 
Merge branch 'hx/push-atomic-with-cert'

Hotfix to a recently added test script.

* hx/push-atomic-with-cert:
  t5534: split stdout and stderr redirection

3 years agodoc: fix the bnf like style of some commands
Jean-Noël Avila [Thu, 8 Oct 2020 20:23:57 +0000 (22:23 +0200)] 
doc: fix the bnf like style of some commands

In command line options, variables are entered between < and >

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agodoc: git-remote fix ups
Jean-Noël Avila [Thu, 8 Oct 2020 20:23:56 +0000 (22:23 +0200)] 
doc: git-remote fix ups

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agodoc: use linkgit macro where needed.
Jean-Noël Avila [Thu, 8 Oct 2020 20:23:55 +0000 (22:23 +0200)] 
doc: use linkgit macro where needed.

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogit-bisect-lk2009: make continuation of list indented
Jean-Noël Avila [Thu, 8 Oct 2020 20:23:54 +0000 (22:23 +0200)] 
git-bisect-lk2009: make continuation of list indented

That's clearer asciidoc formatting.

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoci: do not skip tagged revisions in GitHub workflows
Johannes Schindelin [Thu, 8 Oct 2020 15:29:35 +0000 (15:29 +0000)] 
ci: do not skip tagged revisions in GitHub workflows

When `master` is tagged, and then both `master` and the tag are pushed,
Travis CI will happily build both. That is a waste of energy, which is
why we skip the build for `master` in that case.

Our GitHub workflow is also triggered by tags. However, the run would
fail because the `windows-test` jobs are _not_ skipped on tags, but the
`windows-build` job _is skipped (and therefore fails to upload the
build artifacts needed by the test jobs).

In addition, we just added logic to our GitHub workflow that will skip
runs altogether if there is already a successful run for the same commit
or at least for the same tree.

Let's just change the GitHub workflow to no longer specifically skip
tagged revisions.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoci: skip GitHub workflow runs for already-tested commits/trees
Johannes Schindelin [Thu, 8 Oct 2020 15:29:34 +0000 (15:29 +0000)] 
ci: skip GitHub workflow runs for already-tested commits/trees

When pushing a commit that has already passed a CI or PR build
successfully, it makes sense to save some energy and time and skip the
new build.

Let's teach our GitHub workflow to do that.

For good measure, we also compare the tree ID, which is what we actually
test (the commit ID might have changed due to a reworded commit message,
which should not affect the outcome of the run).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocontrib/git-resurrect.sh: use hash-agnostic OID pattern
Denton Liu [Thu, 8 Oct 2020 06:44:40 +0000 (23:44 -0700)] 
contrib/git-resurrect.sh: use hash-agnostic OID pattern

Since Git now supports hashes other than SHA-1, the hash length isn't
guaranteed to be 40 characters. Replace $_x40 with a hash-agnostic OID
pattern.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocontrib/git-resurrect.sh: indent with tabs
Denton Liu [Thu, 8 Oct 2020 06:44:39 +0000 (23:44 -0700)] 
contrib/git-resurrect.sh: indent with tabs

In the git-resurrect script, there are a few lines that are mistakenly
indented with spaces. Replace these lines with tabs.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agotests: avoid using the branch name `main`
Johannes Schindelin [Thu, 8 Oct 2020 10:13:47 +0000 (10:13 +0000)] 
tests: avoid using the branch name `main`

In the near future, we want to change Git's default branch name to
`main`. In preparation for that, stop using it as a branch name in the
test suite. Replace that branch name by `topic`, the same name we used
to rename variations of `master` in b6211b89eb3 (tests: avoid variations
of the `master` branch name, 2020-09-26).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot1415: avoid using `main` as ref name
Johannes Schindelin [Thu, 8 Oct 2020 10:13:46 +0000 (10:13 +0000)] 
t1415: avoid using `main` as ref name

In preparation for a patch series that will change the fall-back for
`init.defaultBranch` to `main`, let's not use `main` as ref name in this
test script.

Otherwise, the `git for-each-ref ... | grep main` which wants to catch
those refs would also unexpectedly catch `refs/heads/main`.

Since the refs in question are worktree-local ones (i.e. each worktree
has their own, just like `HEAD`), and since the test case already uses a
secondary worktree called "second", let's use the name "first" for those
refs instead.

While at it, adjust the test titles that talk about a "repo" when they
meant a "worktree" instead.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMakefile: ASCII-sort += lists
Denton Liu [Thu, 8 Oct 2020 07:39:26 +0000 (00:39 -0700)] 
Makefile: ASCII-sort += lists

In 805d9eaf5e (Makefile: ASCII-sort += lists, 2020-03-21), the += lists
in the Makefile were sorted into ASCII order. Since then, more out of
order elements have been introduced.  Sort these lists back into ASCII
order.

This patch is best viewed with `--color-moved`.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agomaintenance: test commit-graph auto condition
Derrick Stolee [Thu, 8 Oct 2020 00:50:39 +0000 (00:50 +0000)] 
maintenance: test commit-graph auto condition

The auto condition for the commit-graph maintenance task walks refs
looking for commits that are not in the commit-graph file. This was
added in 4ddc79b2 (maintenance: add auto condition for commit-graph
task, 2020-09-17) but was left untested.

The initial goal of this change was to demonstrate the feature works
properly by adding tests. However, there was an off-by-one error that
caused the basic tests around maintenance.commit-graph.auto=1 to fail
when it should work.

The subtlety is that if a ref tip is not in the commit-graph, then we
were not adding that to the total count. In the test, we see that we
have only added one commit since our last commit-graph write, so the
auto condition would say there is nothing to do.

The fix is simple: add the check for the commit-graph position to see
that the tip is not in the commit-graph file before starting our walk.
Since this happens before adding to the DFS stack, we do not need to
clear our (currently empty) commit list.

This does add some extra complexity for the test, because we also want
to verify that the walk along the parents actually does some work. This
means we need to add at least two commits in a row without writing the
commit-graph. However, we also need to make sure no additional refs are
pointing to the middle of this list or else the for_each_ref() in
should_write_commit_graph() might visit these commits as tips instead of
doing a DFS walk. Hence, the last two commits are added with "git
commit" instead of "test_commit".

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agouserdiff: expand detected chunk headers for css
Sohom Datta [Thu, 8 Oct 2020 08:36:04 +0000 (08:36 +0000)] 
userdiff: expand detected chunk headers for css

The regex used for the CSS builtin diff driver in git is only
able to show chunk headers for lines that start with a number,
a letter or an underscore.

However, the regex fails to detect classes (starts with a .), ids
(starts with a #), :root and attribute-value based selectors (for
example [class*="col-"]), as well as @based block-level statements
like @page,@keyframes and @media since all of them, start with a
special character.

Allow the selectors and block level statements to begin with these
special characters.

Signed-off-by: Sohom Datta <sohom.datta@learner.manipal.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocheckout: learn to respect checkout.guess
Denton Liu [Thu, 8 Oct 2020 05:48:15 +0000 (22:48 -0700)] 
checkout: learn to respect checkout.guess

The current behavior of git checkout/switch is that --guess is currently
enabled by default. However, some users may not wish for this to happen
automatically. Instead of forcing users to specify --no-guess manually
each time, teach these commands the checkout.guess configuration
variable that gives users the option to set a default behavior.

Teach the completion script to recognize the new config variable and
disable DWIM logic if it is set to false.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'st/dark-mode' into master
Pratyush Yadav [Thu, 8 Oct 2020 13:04:54 +0000 (18:34 +0530)] 
Merge branch 'st/dark-mode' into master

Improve dark mode support. Do not hard-code widget colors and instead
pull them from the current theme and update them in the options
database.

* st/dark-mode:
  git-gui: improve dark mode support

3 years agoMerge branch 'fr_2.29.0_rnd_1' of github.com:jnavila/git
Jiang Xin [Thu, 8 Oct 2020 12:27:51 +0000 (20:27 +0800)] 
Merge branch 'fr_2.29.0_rnd_1' of github.com:jnavila/git

* 'fr_2.29.0_rnd_1' of github.com:jnavila/git:
  l10n: fr: v2.29.0 rnd 1

3 years agohelp: do not expect built-in commands to be hardlinked
Johannes Schindelin [Wed, 7 Oct 2020 21:56:51 +0000 (21:56 +0000)] 
help: do not expect built-in commands to be hardlinked

When building with SKIP_DASHED_BUILT_INS=YesPlease, the built-in
commands are no longer present in the `PATH` as hardlinks to `git`.

As a consequence, `load_command_list()` needs to be taught to find the
names of the built-in commands from elsewhere.

This only affected the output of `git --list-cmds=main`, but not the
output of `git help -a` because the latter includes the built-in
commands by virtue of them being listed in command-list.txt.

The bug was detected via a patch series that turns the merge strategies
included in Git into built-in commands: `git merge -s help` relies on
`load_command_list()` to determine the list of available merge
strategies.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoindex-pack: make get_base_data() comment clearer
Jonathan Tan [Wed, 7 Oct 2020 20:16:58 +0000 (13:16 -0700)] 
index-pack: make get_base_data() comment clearer

A comment mentions that we may free cached delta bases via
find_unresolved_deltas(), but that function went away in f08cbf60fe
(index-pack: make quantum of work smaller, 2020-09-08). Since we need to
rewrite that comment anyway, make the entire comment clearer.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agol10n: fr: v2.29.0 rnd 1
Jean-Noël Avila [Wed, 7 Oct 2020 19:55:55 +0000 (21:55 +0200)] 
l10n: fr: v2.29.0 rnd 1

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
3 years agol10n: it.po: update the Italian translation for Git 2.29.0 round 1
Alessandro Menti [Wed, 7 Oct 2020 19:43:55 +0000 (21:43 +0200)] 
l10n: it.po: update the Italian translation for Git 2.29.0 round 1

Signed-off-by: Alessandro Menti <alessandro.menti@alessandromenti.it>
3 years agoindex-pack: drop type_cas mutex
Jeff King [Wed, 7 Oct 2020 18:19:43 +0000 (14:19 -0400)] 
index-pack: drop type_cas mutex

The type_cas lock lost all of its callers in f08cbf60fe (index-pack:
make quantum of work smaller, 2020-09-08), so we can safely delete it.
The compiler didn't alert us that the variable became unused, because we
still call pthread_mutex_init() and pthread_mutex_destroy() on it.

It's worth considering also whether that commit was in error to remove
the use of the lock. Why don't we need it now, if we did before, as
described in ab791dd138 (index-pack: fix race condition with duplicate
bases, 2014-08-29)? I think the answer is that we now look at and assign
the child_obj->real_type field in the main thread while holding the
work_lock(). So we don't have to worry about racing with the worker
threads.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoindex-pack: restore "resolving deltas" progress meter
Jeff King [Wed, 7 Oct 2020 18:19:23 +0000 (14:19 -0400)] 
index-pack: restore "resolving deltas" progress meter

Commit f08cbf60fe (index-pack: make quantum of work smaller, 2020-09-08)
refactored the main loop in threaded_second_pass(), but also deleted the
call to display_progress() at the top of the loop. This means that users
typically see no progress at all during the delta resolution phase (and
for large repositories, Git appears to hang).

This looks like an accident that was unrelated to the intended change of
that commit, since we continue to update nr_resolved_deltas in
resolve_delta(). Let's restore the call to get that progress back.

We'll also add a test that confirms we generate the expected progress.
This isn't perfect, as it wouldn't catch a bug where progress was
delayed to the end. That was probably possible to trigger when receiving
a thin pack, because we'd eventually call display_progress() from
fix_unresolved_deltas(), but only once after doing all the work.
However, since our test case generates a complete pack, it reliably
demonstrates this particular bug and its fix. And we can't do better
without making the test racy.

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogit-completion.bash: stash-show: complete $__git_diff_common_options
Robert Karszniewicz [Tue, 6 Oct 2020 22:06:37 +0000 (00:06 +0200)] 
git-completion.bash: stash-show: complete $__git_diff_common_options

Signed-off-by: Robert Karszniewicz <avoidr@posteo.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogit-completion.bash: __git_diff_common_options: add --[no-]patch
Robert Karszniewicz [Tue, 6 Oct 2020 22:06:36 +0000 (00:06 +0200)] 
git-completion.bash: __git_diff_common_options: add --[no-]patch

At the same time also deduplicate those options from command completions
which use $__git_diff_common_options.

Signed-off-by: Robert Karszniewicz <avoidr@posteo.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocompat/mingw.h: drop extern from function declaration
Denton Liu [Wed, 7 Oct 2020 08:31:59 +0000 (01:31 -0700)] 
compat/mingw.h: drop extern from function declaration

In 554544276a (*.[ch]: remove extern from function declarations using
spatch, 2019-04-29), `extern` on function declarations were declared to
be redundant and thus removed from the codebase. An `extern` was
accidentally reintroduced in 08809c09aa (mingw: add a helper function to
attach GDB to the current process, 2020-02-13).

Remove this spurious `extern`.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoGitHub workflow: automatically follow minor updates of setup-msbuild
Johannes Schindelin [Wed, 7 Oct 2020 08:17:49 +0000 (08:17 +0000)] 
GitHub workflow: automatically follow minor updates of setup-msbuild

It is the custom to follow minor updates of GitHub Actions
automatically, by using the suffix `@v1`. Actions' maintainers will then
update that `v1` ref to point to the newest.

However, for `microsoft/setup-msbuild`, 889cacb6897 (ci: configure
GitHub Actions for CI/PR, 2020-04-11) uses a very specific `@v1.0.0`
suffix.

In this instance, that is a problem: should `setup-msbuild` release a
new version that intends to fix a critical bug, we won't know it, and we
won't use it.

Such a scenario is not theoretical. It is happening right now:
https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands

Let's simplify our setup, allowing us to benefit from automatically
using the newest v1.x.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot2016: add a NEEDSWORK about the PERL prerequisite
Denton Liu [Wed, 7 Oct 2020 07:56:18 +0000 (00:56 -0700)] 
t2016: add a NEEDSWORK about the PERL prerequisite

Since the builtin add-p is used when $GIT_TEST_ADD_I_USE_BUILTIN is
given, we should replace the PERL prerequisite with an ADD_I
prerequisite which first checks if $GIT_TEST_ADD_I_USE_BUILTIN is
defined before checking PERL.[0] Mark this in a NEEDSWORK so that it can
be addressed at a later time.

[0]: https://lore.kernel.org/git/xmqqsgat7ttf.fsf@gitster.c.googlers.com/

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoadd-patch: add NEEDSWORK about comparing commits
Denton Liu [Wed, 7 Oct 2020 07:56:17 +0000 (00:56 -0700)] 
add-patch: add NEEDSWORK about comparing commits

The two versions of add-patch has special-casing for the literal
revision "HEAD". However, we want to handle other ways of saying "HEAD"
in the same way.[0] Add a NEEDSWORK to the add-patch code that does this
so that it can be addressed later.

[0]: https://lore.kernel.org/git/xmqqsgat7ttf.fsf@gitster.c.googlers.com/

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoDoc: document "A...B" form for <tree-ish> in checkout and switch
Denton Liu [Wed, 7 Oct 2020 07:56:16 +0000 (00:56 -0700)] 
Doc: document "A...B" form for <tree-ish> in checkout and switch

Using "A...B" has been supported for the <tree-ish> argument for a
while. However, its support has never been explicitly documented.

Explicitly document it so that users know that it is available.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agobuiltin/checkout: fix `git checkout -p HEAD...` bug
Denton Liu [Wed, 7 Oct 2020 07:56:15 +0000 (00:56 -0700)] 
builtin/checkout: fix `git checkout -p HEAD...` bug

Running `git checkout -p` with a merge-base rev results in an error:

$ git checkout -p HEAD...
usage: git diff-index [-m] [--cached] [<common-diff-options>] <tree-ish> [<path>...]
common diff options:
  -z            output diff-raw with lines terminated with NUL.
  -p            output patch format.
  -u            synonym for -p.
  --patch-with-raw
output both a patch and the diff-raw format.
  --stat        show diffstat instead of patch.
  --numstat     show numeric diffstat instead of patch.
  --patch-with-stat
output a patch and prepend its diffstat.
  --name-only   show only names of changed files.
  --name-status show names and status of changed files.
  --full-index  show full object name on index lines.
  --abbrev=<n>  abbreviate object names in diff-tree header and diff-raw.
  -R            swap input file pairs.
  -B            detect complete rewrites.
  -M            detect renames.
  -C            detect copies.
  --find-copies-harder
try unchanged files as candidate for copy detection.
  -l<n>         limit rename attempts up to <n> paths.
  -O<file>      reorder diffs according to the <file>.
  -S<string>    find filepair whose only one side contains the string.
  --pickaxe-all
show all files diff when -S is used and hit is found.
  -a  --text    treat all files as text.

Cannot close git diff-index --cached --numstat --summary HEAD... -- () at <redacted>/libexec/git-core/git-add--interactive line 183.

This happens because checkout passes the literal argument (in the
example, `HEAD...`) to diff-index which does not recognise merge-base
revs.

Fix this by using the hex of the found commit instead of the given name.
Note that "HEAD" is handled specially in run_add_interactive() so it's
explicitly not changed.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoDocumentation/config/checkout: replace sq with backticks
Denton Liu [Wed, 7 Oct 2020 05:09:08 +0000 (22:09 -0700)] 
Documentation/config/checkout: replace sq with backticks

The modern style for Git documentation is to use backticks to quote
any command-line documenation so that it is typeset in monospace.
Replace all single quotes with backticks to conform to this.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agouserdiff: recognize 'macro_rules!' as starting a Rust function block
Konrad Borowski [Wed, 7 Oct 2020 13:26:11 +0000 (13:26 +0000)] 
userdiff: recognize 'macro_rules!' as starting a Rust function block

Signed-off-by: Konrad Borowski <konrad@borowski.pw>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agouserdiff: PHP: catch "abstract" and "final" functions
Javier Spagnoletti [Wed, 7 Oct 2020 03:38:18 +0000 (03:38 +0000)] 
userdiff: PHP: catch "abstract" and "final" functions

PHP permits functions to be defined like

       final public function foo() { }
       abstract protected function bar() { }

but our hunk header pattern does not recognize these decorations.
Add "final" and "abstract" to the list of function modifiers.

Helped-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Javier Spagnoletti <phansys@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogit-gui: improve dark mode support
Serg Tereshchenko [Sat, 26 Sep 2020 14:54:43 +0000 (17:54 +0300)] 
git-gui: improve dark mode support

The colors of some ttext widgets are hard-coded. These hard-coded colors
are okay with a light theme but with a dark theme some widgets are dark
colored and the hard-coded ones are still light. This defeats the
purpose of applying the theme and makes the UI look very awkward.

Remove the hard-coded colors in ttext calls and use colors from the
theme for those widgets via Text.Background and Text.Foreground from the
option database.

Similarly, the highlighting for the currently selected file(s) in the
"Staged Files" and "Unstaged Files" sections is also hard-coded. Pull
the colors for that from the current theme to make sure it is in line

Signed-off-by: Serg Tereshchenko <serg.partizan@gmail.com>
Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>
3 years agot5534: split stdout and stderr redirection
Đoàn Trần Công Danh [Tue, 6 Oct 2020 15:08:18 +0000 (22:08 +0700)] 
t5534: split stdout and stderr redirection

On atomic pushing failure with GnuPG, we expect a very specific output
in stdout due to `--porcelain` switch.

On such failure, we also write down some helpful hint into stderr
in order to help user understand what happens and how to continue from
those failures.

On a lot of system, those hint (in stderr) will be flushed first,
then those messages in stdout will be flushed. In such systems, the
current test code is fine as is.

However, we don't have such guarantee, (at least) there're some real
systems that writes those stream interleaved. On such systems, we may
see the stderr stream written in the middle of stdout stream.

Let's split those stream redirection. By splitting those stream,
the output stream will contain exactly what we want to compare,
thus, saving us a "sed" invocation.

While we're at it, change the `test_i18ncmp` to `test_cmp` because we
will never translate those messages (because of `--porcelain`).

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agol10n: tr: v2.29.0 round 1
Emir Sarı [Tue, 6 Oct 2020 13:44:21 +0000 (16:44 +0300)] 
l10n: tr: v2.29.0 round 1

Signed-off-by: Emir Sarı <bitigchi@me.com>
3 years agol10n: Update Catalan translation
Jordi Mas [Tue, 6 Oct 2020 09:36:15 +0000 (11:36 +0200)] 
l10n: Update Catalan translation

Signed-off-by: Jordi Mas <jmas@softcatala.org>
3 years agol10n: git.pot: v2.29.0 round 1 (124 new, 42 removed)
Jiang Xin [Tue, 6 Oct 2020 01:16:18 +0000 (09:16 +0800)] 
l10n: git.pot: v2.29.0 round 1 (124 new, 42 removed)

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

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
3 years agoGit 2.29-rc0 v2.29.0-rc0
Junio C Hamano [Mon, 5 Oct 2020 21:00:04 +0000 (14:00 -0700)] 
Git 2.29-rc0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'nl/credential-crlf'
Junio C Hamano [Mon, 5 Oct 2020 21:01:56 +0000 (14:01 -0700)] 
Merge branch 'nl/credential-crlf'

Loosen the parser in the receiving end of the credential protocol
to allow credential helper to terminate lines with CRLF line
ending, as well as LF line ending.

* nl/credential-crlf:
  credential: treat CR/LF as line endings in the credential protocol

3 years agoMerge branch 'sn/fast-import-doc'
Junio C Hamano [Mon, 5 Oct 2020 21:01:56 +0000 (14:01 -0700)] 
Merge branch 'sn/fast-import-doc'

Doc update.

* sn/fast-import-doc:
  fast-import: fix typo in documentation

3 years agoMerge branch 'pb/submodule-doc-fix'
Junio C Hamano [Mon, 5 Oct 2020 21:01:55 +0000 (14:01 -0700)] 
Merge branch 'pb/submodule-doc-fix'

Doc update.

* pb/submodule-doc-fix:
  gitsubmodules doc: invoke 'ls-files' with '--recurse-submodules'

3 years agoMerge branch 'jk/format-auto-base-when-able'
Junio C Hamano [Mon, 5 Oct 2020 21:01:55 +0000 (14:01 -0700)] 
Merge branch 'jk/format-auto-base-when-able'

"git format-patch" learns to take "whenAble" as a possible value
for the format.useAutoBase configuration variable to become no-op
when the  automatically computed base does not make sense.

* jk/format-auto-base-when-able:
  format-patch: teach format.useAutoBase "whenAble" option

3 years agoMerge branch 'jk/diff-cc-oidfind-fix'
Junio C Hamano [Mon, 5 Oct 2020 21:01:54 +0000 (14:01 -0700)] 
Merge branch 'jk/diff-cc-oidfind-fix'

"log -c --find-object=X" did not work well to find a merge that
involves a change to an object X from only one parent.

* jk/diff-cc-oidfind-fix:
  combine-diff: handle --find-object in multitree code path

3 years agoMerge branch 'jk/refspecs-negative'
Junio C Hamano [Mon, 5 Oct 2020 21:01:54 +0000 (14:01 -0700)] 
Merge branch 'jk/refspecs-negative'

"git fetch" and "git push" support negative refspecs.

* jk/refspecs-negative:
  refspec: add support for negative refspecs

3 years agoMerge branch 'rs/archive-add-file'
Junio C Hamano [Mon, 5 Oct 2020 21:01:53 +0000 (14:01 -0700)] 
Merge branch 'rs/archive-add-file'

"git archive" learns the "--add-file" option to include untracked
files into a snapshot from a tree-ish.

* rs/archive-add-file:
  Makefile: use git-archive --add-file
  archive: add --add-file
  archive: read short blobs in archive.c::write_archive_entry()

3 years agoMerge branch 'jt/keep-partial-clone-filter-upon-lazy-fetch'
Junio C Hamano [Mon, 5 Oct 2020 21:01:53 +0000 (14:01 -0700)] 
Merge branch 'jt/keep-partial-clone-filter-upon-lazy-fetch'

The lazy fetching done internally to make missing objects available
in a partial clone incorrectly made permanent damage to the partial
clone filter in the repository, which has been corrected.

* jt/keep-partial-clone-filter-upon-lazy-fetch:
  fetch: do not override partial clone filter
  promisor-remote: remove unused variable

3 years agoMerge branch 'td/submodule-update-quiet'
Junio C Hamano [Mon, 5 Oct 2020 21:01:53 +0000 (14:01 -0700)] 
Merge branch 'td/submodule-update-quiet'

"git submodule update --quiet" did not squelch underlying "rebase"
and "pull" commands.

* td/submodule-update-quiet:
  submodule update: silence underlying merge/rebase with "--quiet"

3 years agoMerge branch 'jk/unused'
Junio C Hamano [Mon, 5 Oct 2020 21:01:52 +0000 (14:01 -0700)] 
Merge branch 'jk/unused'

Code cleanup.

* jk/unused:
  dir.c: drop unused "untracked" from treat_path_fast()
  sequencer: handle ignore_footer when parsing trailers
  test-advise: check argument count with argc instead of argv
  sparse-checkout: fill in some options boilerplate
  sequencer: drop repository argument from run_git_commit()
  push: drop unused repo argument to do_push()
  assert PARSE_OPT_NONEG in parse-options callbacks
  env--helper: write to opt->value in parseopt helper
  drop unused argc parameters
  convert: drop unused crlf_action from check_global_conv_flags_eol()

3 years agoMerge branch 'js/cmake-vs'
Junio C Hamano [Mon, 5 Oct 2020 21:01:52 +0000 (14:01 -0700)] 
Merge branch 'js/cmake-vs'

Using the CMake support we added some time ago for real with Visual
Studio build revealed there were lot of usability improvements
possible, which have been carried out.

* js/cmake-vs:
  hashmap_for_each_entry(): workaround MSVC's runtime check failure #3
  cmake (Windows): recommend using Visual Studio's built-in CMake support
  cmake (Windows): initialize vcpkg/build dependencies automatically
  cmake (Windows): complain when encountering an unknown compiler
  cmake (Windows): let the `.dll` files be found when running the tests
  cmake: quote the path accurately when editing `test-lib.sh`
  cmake: fall back to using `vcpkg`'s `msgfmt.exe` on Windows
  cmake: ensure that the `vcpkg` packages are found on Windows
  cmake: do find Git for Windows' shell interpreter
  cmake: ignore files generated by CMake as run in Visual Studio

3 years agoMerge branch 'ma/worktree-cleanups'
Junio C Hamano [Mon, 5 Oct 2020 21:01:52 +0000 (14:01 -0700)] 
Merge branch 'ma/worktree-cleanups'

Code clean-up.

* ma/worktree-cleanups:
  worktree: use skip_prefix to parse target
  worktree: rename copy-pasted variable
  worktree: update renamed variable in comment
  worktree: inline `worktree_ref()` into its only caller
  wt-status: introduce wt_status_state_free_buffers()
  wt-status: print to s->fp, not stdout
  wt-status: replace sha1 mentions with oid

3 years agoMerge branch 'so/combine-diff-simplify'
Junio C Hamano [Mon, 5 Oct 2020 21:01:51 +0000 (14:01 -0700)] 
Merge branch 'so/combine-diff-simplify'

Code simplification.

* so/combine-diff-simplify:
  diff: get rid of redundant 'dense' argument

3 years agoMerge branch 'js/default-branch-name-part-2'
Junio C Hamano [Mon, 5 Oct 2020 21:01:50 +0000 (14:01 -0700)] 
Merge branch 'js/default-branch-name-part-2'

Update the tests to drop word 'master' from them.

* js/default-branch-name-part-2:
  t9902: avoid using the branch name `master`
  tests: avoid variations of the `master` branch name
  t3200: avoid variations of the `master` branch name
  fast-export: avoid using unnecessary language in a code comment
  t/test-terminal: avoid non-inclusive language

3 years agoMerge branch 'pm/gitk-update'
Junio C Hamano [Mon, 5 Oct 2020 21:01:50 +0000 (14:01 -0700)] 
Merge branch 'pm/gitk-update'

"gitk" update.

* pm/gitk-update:
  gitk: Resize panes correctly when reducing window size
  gitk: replace tabs with spaces
  gitk: fix the context menu not appearing in the presence of submodule diffs
  gitk: Un-hide selection in areas with non-default background color
  gitk: add diff lines background colors
  gitk: be prepared to be run in a bare repository
  gitk: Preserve window dimensions on exit when not using ttk themes
  gitk: don't highlight files after submodules as submodules
  gitk: fix branch name encoding error
  gitk: rename "commit summary" to "commit reference"

3 years agoMerge branch 'ds/in-merge-bases-many-optim-bug'
Junio C Hamano [Mon, 5 Oct 2020 21:01:50 +0000 (14:01 -0700)] 
Merge branch 'ds/in-merge-bases-many-optim-bug'

in_merge_bases_many(), a way to see if a commit is reachable from
any commit in a set of commits, was totally broken when the
commit-graph feature was in use, which has been corrected.

* ds/in-merge-bases-many-optim-bug:
  commit-reach: fix in_merge_bases_many bug

3 years agofast-import: fix typo in documentation
Samanta Navarro [Sun, 4 Oct 2020 11:41:01 +0000 (11:41 +0000)] 
fast-import: fix typo in documentation

Signed-off-by: Samanta Navarro <ferivoz@riseup.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogitsubmodules doc: invoke 'ls-files' with '--recurse-submodules'
Philippe Blain [Sun, 4 Oct 2020 01:17:37 +0000 (01:17 +0000)] 
gitsubmodules doc: invoke 'ls-files' with '--recurse-submodules'

`git ls-files` was never taught to respect the `submodule.recurse`
configuration variable, and it is too late now to change that [1],
but still the command is mentioned in 'gitsubmodules(7)' as if it
does respect that config.

Adjust the call in 'gitsubmodules(7)' by calling 'ls-files' with the
'--recurse-submodules' option.

While at it, uniformize the capitalization in that file, and use
backticks instead of quotes for Git commands and configuration
variables.

[1] https://lore.kernel.org/git/pull.732.git.1599707259907.gitgitgadget@gmail.com/T/#u

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoNineteenth batch
Junio C Hamano [Sun, 4 Oct 2020 19:48:44 +0000 (12:48 -0700)] 
Nineteenth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'mt/delta-base-cache-races'
Junio C Hamano [Sun, 4 Oct 2020 19:49:15 +0000 (12:49 -0700)] 
Merge branch 'mt/delta-base-cache-races'

A race that leads to an access to a free'd data was corrected in
the codepath that reads pack files.

* mt/delta-base-cache-races:
  packfile: fix memory leak in add_delta_base_cache()
  packfile: fix race condition on unpack_entry()

3 years agoMerge branch 'jk/shortlog-group-by-trailer'
Junio C Hamano [Sun, 4 Oct 2020 19:49:14 +0000 (12:49 -0700)] 
Merge branch 'jk/shortlog-group-by-trailer'

"git shortlog" has been taught to group commits by the contents of
the trailer lines, like "Reviewed-by:", "Coauthored-by:", etc.

* jk/shortlog-group-by-trailer:
  shortlog: allow multiple groups to be specified
  shortlog: parse trailer idents
  shortlog: rename parse_stdin_ident()
  shortlog: de-duplicate trailer values
  shortlog: match commit trailers with --group
  trailer: add interface for iterating over commit trailers
  shortlog: add grouping option
  shortlog: change "author" variables to "ident"

3 years agoMerge branch 'jc/fmt-merge-msg-suppress-destination'
Junio C Hamano [Sun, 4 Oct 2020 19:49:13 +0000 (12:49 -0700)] 
Merge branch 'jc/fmt-merge-msg-suppress-destination'

Docfix.

* jc/fmt-merge-msg-suppress-destination:
  config/fmt-merge-msg.txt: drop space in quote

3 years agoMerge branch 'tb/upload-pack-filters'
Junio C Hamano [Sun, 4 Oct 2020 19:49:12 +0000 (12:49 -0700)] 
Merge branch 'tb/upload-pack-filters'

Hotfix.

* tb/upload-pack-filters:
  config/uploadpack.txt: fix typo in `--filter=tree:<n>`

3 years agoMerge branch 'jc/sequencer-stopped-sha-simplify'
Junio C Hamano [Sun, 4 Oct 2020 19:49:10 +0000 (12:49 -0700)] 
Merge branch 'jc/sequencer-stopped-sha-simplify'

Code simplification.

* jc/sequencer-stopped-sha-simplify:
  sequencer: stop abbreviating stopped-sha file

3 years agoMerge branch 'au/complete-restore-s'
Junio C Hamano [Sun, 4 Oct 2020 19:49:09 +0000 (12:49 -0700)] 
Merge branch 'au/complete-restore-s'

The command line completion (in contrib/) learned that "git restore
-s <TAB>" is often followed by a refname.

* au/complete-restore-s:
  completion: complete refs after 'git restore -s'
  completion: use "prev" variable instead of introducing "prevword"

3 years agoMerge branch 'al/ref-filter-merged-and-no-merged'
Junio C Hamano [Sun, 4 Oct 2020 19:49:09 +0000 (12:49 -0700)] 
Merge branch 'al/ref-filter-merged-and-no-merged'

Hotfix.

* al/ref-filter-merged-and-no-merged:
  ref-filter: plug memory leak in reach_filter()

3 years agoMerge branch 'eg/mailinfo-doc-scissors'
Junio C Hamano [Sun, 4 Oct 2020 19:49:09 +0000 (12:49 -0700)] 
Merge branch 'eg/mailinfo-doc-scissors'

The explanation of the "scissors line" has been clarified.

* eg/mailinfo-doc-scissors:
  Doc: show example scissors line

3 years agoMerge branch 'mr/bisect-in-c-2'
Junio C Hamano [Sun, 4 Oct 2020 19:49:08 +0000 (12:49 -0700)] 
Merge branch 'mr/bisect-in-c-2'

Rewrite of the "git bisect" script in C continues.

* mr/bisect-in-c-2:
  bisect--helper: reimplement `bisect_next` and `bisect_auto_next` shell functions in C
  bisect: call 'clear_commit_marks_all()' in 'bisect_next_all()'
  bisect--helper: reimplement `bisect_autostart` shell function in C
  bisect--helper: introduce new `write_in_file()` function
  bisect--helper: use '-res' in 'cmd_bisect__helper' return
  bisect--helper: BUG() in cmd_*() on invalid subcommand

3 years agoMerge branch 'cc/bisect-start-fix'
Junio C Hamano [Sun, 4 Oct 2020 19:49:08 +0000 (12:49 -0700)] 
Merge branch 'cc/bisect-start-fix'

"git bisect start X Y", when X and Y are not valid committish
object names, should take X and Y as pathspec, but didn't.

* cc/bisect-start-fix:
  bisect: don't use invalid oid as rev when starting

3 years agoMerge branch 'jc/blame-ignore-fix'
Junio C Hamano [Sun, 4 Oct 2020 19:49:07 +0000 (12:49 -0700)] 
Merge branch 'jc/blame-ignore-fix'

"git blame --ignore-rev/--ignore-revs-file" failed to validate
their input are valid revision, and failed to take into account
that the user may want to give an annotated tag instead of a
commit, which has been corrected.

* jc/blame-ignore-fix:
  blame: validate and peel the object names on the ignore list
  t8013: minimum preparatory clean-up

3 years agoMerge branch 'jk/drop-unaligned-loads'
Junio C Hamano [Sun, 4 Oct 2020 19:49:06 +0000 (12:49 -0700)] 
Merge branch 'jk/drop-unaligned-loads'

Compilation fix around type punning.

* jk/drop-unaligned-loads:
  Revert "fast-export: use local array to store anonymized oid"
  bswap.h: drop unaligned loads

3 years agoMerge branch 'js/no-builtins-on-disk-option'
Junio C Hamano [Sun, 4 Oct 2020 19:49:04 +0000 (12:49 -0700)] 
Merge branch 'js/no-builtins-on-disk-option'

The installation procedure learned to optionally omit "git-foo"
executable files for each 'foo' built-in subcommand, which are only
required by old timers that still rely on the age old promise that
prepending "git --exec-path" output to PATH early in their script
will keep the "git-foo" calls they wrote working.

The old attempt to remove these executables from the disk failed in
the 1.6 era; it may be worth attempting again, but I think it is
worth to keep this topic separate from such a policy change to help
it graduate early.

* js/no-builtins-on-disk-option:
  ci: stop linking built-ins to the dashed versions
  Optionally skip linking/copying the built-ins
  msvc: copy the correct `.pdb` files in the Makefile target `install`

3 years agoMerge branch 'ab/mediawiki-fixes'
Junio C Hamano [Sun, 4 Oct 2020 19:49:04 +0000 (12:49 -0700)] 
Merge branch 'ab/mediawiki-fixes'

Modernization and fixes to MediaWiki remote backend.

* ab/mediawiki-fixes:
  remote-mediawiki: use "sh" to eliminate unquoted commands
  remote-mediawiki: annotate unquoted uses of run_git()
  remote-mediawiki: convert to quoted run_git() invocation
  remote-mediawiki: provide a list form of run_git()
  remote-mediawiki tests: annotate failing tests
  remote-mediawiki: fix duplicate revisions being imported
  remote-mediawiki tests: use CLI installer
  remote-mediawiki tests: use inline PerlIO for readability
  remote-mediawiki tests: replace deprecated Perl construct
  remote-mediawiki tests: use a more idiomatic dispatch table
  remote-mediawiki tests: use "$dir/" instead of "$dir."
  remote-mediawiki tests: change `[]` to `test`
  remote-mediawiki tests: use test_cmp in tests
  remote-mediawiki tests: use a 10 character password
  remote-mediawiki tests: use the login/password variables
  remote-mediawiki doc: don't hardcode Debian PHP versions
  remote-mediawiki doc: link to MediaWiki's current version
  remote-mediawiki doc: correct link to GitHub project

3 years agocredential: treat CR/LF as line endings in the credential protocol
Nikita Leonov [Sat, 3 Oct 2020 13:29:12 +0000 (13:29 +0000)] 
credential: treat CR/LF as line endings in the credential protocol

This fix makes using Git credentials more friendly to Windows users: it
allows a credential helper to communicate using CR/LF line endings ("DOS
line endings" commonly found on Windows) instead of LF-only line endings
("Unix line endings").

Note that this changes the behavior a bit: if a credential helper
produces, say, a password with a trailing Carriage Return character,
that will now be culled even when the rest of the lines end only in Line
Feed characters, indicating that the Carriage Return was not meant to be
part of the line ending.

In practice, it seems _very_ unlikely that something like this happens.
Passwords usually need to consist of non-control characters, URLs need
to have special characters URL-encoded, and user names, well, are names.

However, it _does_ help on Windows, where CR/LF line endings are common:
as unrecognized commands are simply ignored by the credential machinery,
even a command like `quit\r` (which is clearly intended to abort) would
simply be ignored (silently) by Git.

So let's change the credential machinery to accept both CR/LF and LF
line endings.

While we do this for the credential helper protocol, we do _not_ adjust
`git credential-cache--daemon` (which won't work on Windows, anyway,
because it requires Unix sockets) nor `git credential-store` (which
writes the file `~/.git-credentials` which we consider an implementation
detail that should be opaque to the user, read: we do expect users _not_
to edit this file manually).

Signed-off-by: Nikita Leonov <nykyta.leonov@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge remote-tracking branch 'paulus/master' into pm/gitk-update
Junio C Hamano [Sat, 3 Oct 2020 17:06:27 +0000 (10:06 -0700)] 
Merge remote-tracking branch 'paulus/master' into pm/gitk-update

* paulus/master:
  gitk: Resize panes correctly when reducing window size
  gitk: replace tabs with spaces
  gitk: fix the context menu not appearing in the presence of submodule diffs
  gitk: Un-hide selection in areas with non-default background color
  gitk: add diff lines background colors
  gitk: be prepared to be run in a bare repository
  gitk: Preserve window dimensions on exit when not using ttk themes
  gitk: don't highlight files after submodules as submodules
  gitk: fix branch name encoding error
  gitk: rename "commit summary" to "commit reference"

3 years agot, doc: update tests, reference for "--force-if-includes"
Srinidhi Kaushik [Sat, 3 Oct 2020 12:10:46 +0000 (17:40 +0530)] 
t, doc: update tests, reference for "--force-if-includes"

Update test cases for the new option, and document its usage
and update related references.

Update test cases for the new option, and document its usage
and update related references.

 - t/t5533-push-cas.sh:
   Update test cases for "compare-and-swap" when used along with
   "--force-if-includes" helps mitigate overwrites when remote
   refs are updated in the background; allows forced updates when
   changes from remote are integrated locally.

 - Documentation:
   Add reference for the new option, configuration setting
   ("push.useForceIfIncludes") and advise messages.

Signed-off-by: Srinidhi Kaushik <shrinidhi.kaushik@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agopush: parse and set flag for "--force-if-includes"
Srinidhi Kaushik [Sat, 3 Oct 2020 12:10:45 +0000 (17:40 +0530)] 
push: parse and set flag for "--force-if-includes"

The previous commit added the necessary machinery to implement the
"--force-if-includes" protection, when "--force-with-lease" is used
without giving exact object the remote still ought to have. Surface
the feature by adding a command line option and a configuration
variable to enable it.

 - Add a flag: "TRANSPORT_PUSH_FORCE_IF_INCLUDES" to indicate that the
   new option was passed from the command line of via configuration
   settings; update command line and configuration parsers to set the
   new flag accordingly.

 - Introduce a new configuration option "push.useForceIfIncludes", which
   is equivalent to setting "--force-if-includes" in the command line.

 - Update "remote-curl" to recognize and pass this option to "send-pack"
   when enabled.

 - Update "advise" to catch the reject reason "REJECT_REF_NEEDS_UPDATE",
   set when the ref status is "REF_STATUS_REJECT_REMOTE_UPDATED" and
   (optionally) print a help message when the push fails.

 - The new option is a "no-op" in the following scenarios:
    * When used without "--force-with-lease".
    * When used with "--force-with-lease", and if the expected commit
      on the remote side is specified as an argument.

Signed-off-by: Srinidhi Kaushik <shrinidhi.kaushik@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agopush: add reflog check for "--force-if-includes"
Srinidhi Kaushik [Sat, 3 Oct 2020 12:10:44 +0000 (17:40 +0530)] 
push: add reflog check for "--force-if-includes"

Add a check to verify if the remote-tracking ref of the local branch
is reachable from one of its "reflog" entries.

The check iterates through the local ref's reflog to see if there
is an entry for the remote-tracking ref and collecting any commits
that are seen, into a list; the iteration stops if an entry in the
reflog matches the remote ref or if the entry timestamp is older
the latest entry of the remote ref's "reflog". If there wasn't an
entry found for the remote ref, "in_merge_bases_many()" is called
to check if it is reachable from the list of collected commits.

When a local branch that is based on a remote ref, has been rewound
and is to be force pushed on the remote, "--force-if-includes" runs
a check that ensures any updates to the remote-tracking ref that may
have happened (by push from another repository) in-between the time
of the last update to the local branch (via "git-pull", for instance)
and right before the time of push, have been integrated locally
before allowing a forced update.

If the new option is passed without specifying "--force-with-lease",
or specified along with "--force-with-lease=<refname>:<expect>" it
is a "no-op".

Signed-off-by: Srinidhi Kaushik <shrinidhi.kaushik@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogitk: Resize panes correctly when reducing window size
Paul Mackerras [Sat, 3 Oct 2020 05:20:33 +0000 (15:20 +1000)] 
gitk: Resize panes correctly when reducing window size

The resizeclistpanes and resizecdetpanes procedures attempt to keep
the horizontal proportions of the panes of the gitk window
approximately constant when the gitk window is resized.  However, if
the size is reduced enough that an existing sash position would go
outside the window, Tk moves the sash to the left to keep it inside
the window (without moving other sash positions to keep the
proportions).  This happens before these resize procedures get
control, and so they work with incorrect proportions.

To fix this, we record the sash positions we set previously and use
those previously-set sash positions rather than the current sash
positions when computing the proportions.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
3 years agogitk: replace tabs with spaces
Denton Liu [Fri, 11 Sep 2020 04:36:33 +0000 (21:36 -0700)] 
gitk: replace tabs with spaces

The source code is a mix of tabs and spaces. The indentation style
currently is four spaces per indent level but uses tabs every other
level (at eight spaces). Fix this inconsistent spacing and tabbing by
just using a space-indent for everything.

This was done mechanically by running:

$ expand -i gitk >gitk.new
$ mv gitk.new gitk

This patch should be empty with `--ignore-all-space`.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
3 years agoMerge branch 'ds/in-merge-bases-many-optim-bug' into sk/force-if-includes
Junio C Hamano [Fri, 2 Oct 2020 17:35:01 +0000 (10:35 -0700)] 
Merge branch 'ds/in-merge-bases-many-optim-bug' into sk/force-if-includes

* ds/in-merge-bases-many-optim-bug:
  commit-reach: fix in_merge_bases_many bug

3 years agocommit-reach: fix in_merge_bases_many bug
Derrick Stolee [Fri, 2 Oct 2020 14:58:56 +0000 (14:58 +0000)] 
commit-reach: fix in_merge_bases_many bug

Way back in f9b8908b (commit.c: use generation numbers for
in_merge_bases(), 2018-05-01), a heuristic was used to short-circuit
the in_merge_bases() walk. This works just fine as long as the
caller is checking only two commits, but when there are multiple,
there is a possibility that this heuristic is _very wrong_.

Some code moves since then has changed this method to
repo_in_merge_bases_many() inside commit-reach.c. The heuristic
computes the minimum generation number of the "reference" list, then
compares this number to the generation number of the "commit".

In a recent topic, a test was added that used in_merge_bases_many()
to test if a commit was reachable from a number of commits pulled
from a reflog. However, this highlighted the problem: if any of the
reference commits have a smaller generation number than the given
commit, then the walk is skipped _even if there exist some with
higher generation number_.

This heuristic is wrong! It must check the MAXIMUM generation number
of the reference commits, not the MINIMUM.

This highlights a testing gap. t6600-test-reach.sh covers many
methods in commit-reach.c, including in_merge_bases() and
get_merge_bases_many(), but since these methods either restrict to
two input commits or actually look for the full list of merge bases,
they don't check this heuristic!

Add a possible input to "test-tool reach" that tests
in_merge_bases_many() and add tests to t6600-test-reach.sh that
cover this heuristic. This includes cases for the reference commits
having generation above and below the generation of the input commit,
but also having maximum generation below the generation of the input
commit.

The fix itself is to swap min_generation with a max_generation in
repo_in_merge_bases_many().

Reported-by: Srinidhi Kaushik <shrinidhi.kaushik@gmail.com>
Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoformat-patch: teach format.useAutoBase "whenAble" option
Jacob Keller [Thu, 1 Oct 2020 21:46:53 +0000 (14:46 -0700)] 
format-patch: teach format.useAutoBase "whenAble" option

The format.useAutoBase configuration option exists to allow users to
enable '--base=auto' for format-patch by default.

This can sometimes lead to poor workflow, due to unexpected failures
when attempting to format an ancient patch:

    $ git format-patch -1 <an old commit>
    fatal: base commit shouldn't be in revision list

This can be very confusing, as it is not necessarily immediately obvious
that the user requested a --base (since this was in the configuration,
not on the command line).

We do want --base=auto to fail when it cannot provide a suitable base,
as it would be equally confusing if a formatted patch did not include
the base information when it was requested.

Teach format.useAutoBase a new mode, "whenAble". This mode will cause
format-patch to attempt to include a base commit when it can. However,
if no valid base commit can be found, then format-patch will continue
formatting the patch without a base commit.

In order to avoid making yet another branch name unusable with --base,
do not teach --base=whenAble or --base=whenable.

Instead, refactor the base_commit option to use a callback, and rely on
the global configuration variable auto_base.

This does mean that a user cannot request this optional base commit
generation from the command line. However, this is likely not too
valuable. If the user requests base information manually, they will be
immediately informed of the failure to acquire a suitable base commit.
This allows the user to make an informed choice about whether to
continue the format.

Add tests to cover the new mode of operation for --base.

Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agosubmodule update: silence underlying merge/rebase with "--quiet"
Theodore Dubois [Wed, 30 Sep 2020 19:50:53 +0000 (12:50 -0700)] 
submodule update: silence underlying merge/rebase with "--quiet"

Commands such as

    $ git pull --rebase --recurse-submodules --quiet

produce non-quiet output from the merge or rebase.  Pass the --quiet
option down when invoking "rebase" and "merge".

Also fix the parsing of git submodule update -v.

When e84c3cf3 (git-submodule.sh: accept verbose flag in cmd_update
to be non-quiet, 2018-08-14) taught "git submodule update" to take
"--quiet", it apparently did not know how ${GIT_QUIET:+--quiet}
works, and reviewers seem to have missed that setting the variable
to "0", rather than unsetting it, still results in "--quiet" being
passed to underlying commands.

Signed-off-by: Theodore Dubois <tbodt@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoclone: allow configurable default for `-o`/`--origin`
Sean Barag [Thu, 1 Oct 2020 03:46:16 +0000 (03:46 +0000)] 
clone: allow configurable default for `-o`/`--origin`

While the default remote name of "origin" can be changed at clone-time
with `git clone`'s `--origin` option, it was previously not possible
to specify a default value for the name of that remote.  Add support for
a new `clone.defaultRemoteName` config, with the newly-created remote
name resolved in priority order:

1. (Highest priority) A remote name passed directly to `git clone -o`
2. A `clone.defaultRemoteName=new_name` in config `git clone -c`
3. A `clone.defaultRemoteName` value set in `/path/to/template/config`,
   where `--template=/path/to/template` is provided
4. A `clone.defaultRemoteName` value set in a non-template config file
5. The default value of `origin`

Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Helped-by: Derrick Stolee <stolee@gmail.com>
Helped-by: Andrei Rybak <rybak.a.v@gmail.com>
Signed-off-by: Sean Barag <sean@barag.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoclone: read new remote name from remote_name instead of option_origin
Sean Barag [Thu, 1 Oct 2020 03:46:15 +0000 (03:46 +0000)] 
clone: read new remote name from remote_name instead of option_origin

In a future patch, the name of the remote created by `git clone` may
come from multiple sources.  To avoid confusion, convert most uses of
option_origin to remote_name, leaving option_origin to exclusively
represent the -o/--origin option.

Helped-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Sean Barag <sean@barag.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>