]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
3 years agoi18n.txt: camel case and monospace "i18n.commitEncoding"
Denton Liu [Wed, 24 Feb 2021 20:26:39 +0000 (12:26 -0800)] 
i18n.txt: camel case and monospace "i18n.commitEncoding"

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

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

Signed-off-by: Denton Liu <liu.denton@gmail.com>
[jc: fixed 3 other mistakes that are exactly the same]
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'tb/ci-run-cocci-with-18.04' into maint
Junio C Hamano [Thu, 11 Feb 2021 21:57:36 +0000 (13:57 -0800)] 
Merge branch 'tb/ci-run-cocci-with-18.04' into maint

* tb/ci-run-cocci-with-18.04:
  .github/workflows/main.yml: run static-analysis on bionic

3 years ago.github/workflows/main.yml: run static-analysis on bionic
Taylor Blau [Mon, 8 Feb 2021 21:22:34 +0000 (16:22 -0500)] 
.github/workflows/main.yml: run static-analysis on bionic

GitHub Actions is transitioning workflow steps that run on
'ubuntu-latest' from 18.04 to 20.04 [1].

This works fine in all steps except the static-analysis one, since
Coccinelle isn't available on Ubuntu focal (it is only available in the
universe suite).

Until Coccinelle can be installed from 20.04's main suite, pin the
static-analysis build to run on 18.04, where it can be installed by
default.

[1]: https://github.com/actions/virtual-environments/issues/1816

Reported-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoGit 2.30.1 v2.30.1
Junio C Hamano [Mon, 8 Feb 2021 22:05:35 +0000 (14:05 -0800)] 
Git 2.30.1

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

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

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

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

Test fix.

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

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

A perf script was made more portable.

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

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

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

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

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

Code clean-up.

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

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

Text encoding fix for "git p4".

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

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

Test update.

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

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

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

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

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

Doc update.

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

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

Code clean-up.

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

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

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

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

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

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

Build fix.

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

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

Doc fix for packfile URI feature.

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

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

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

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

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

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

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

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

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

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

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

Fix for procedure to building CI test environment for mac.

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

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

Doc update.

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

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

Doc update.

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

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

Comments update.

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

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

Doc update.

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

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

Test fix.

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

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

Test fix.

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

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

Doc update.

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

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

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

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

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

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

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

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

Doc update.

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

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

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

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

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

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

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

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

Test fix.

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

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

Diagnose command line error of "git rebase" early.

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

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

Doc fix.

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

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

Doc fix.

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

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

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

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

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

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

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

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

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

We can use:

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

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

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

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

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

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

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

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoSKIP_DASHED_BUILT_INS: respect `config.mak`
Johannes Schindelin [Thu, 21 Jan 2021 13:09:45 +0000 (13:09 +0000)] 
SKIP_DASHED_BUILT_INS: respect `config.mak`

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

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

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

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

Notes on individual diagnostics:

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

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

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

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

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoci/install-depends: attempt to fix "brew cask" stuff
Junio C Hamano [Fri, 15 Jan 2021 02:51:02 +0000 (18:51 -0800)] 
ci/install-depends: attempt to fix "brew cask" stuff

We run "git pull" against "$cask_repo"; clarify that we are
expecting not to have any of our own modifications and running "git
pull" to merely update, by passing "--ff-only" on the command line.

Also, the "brew cask install" command line triggers an error message
that says:

    Error: Calling brew cask install is disabled! Use brew install
    [--cask] instead.

In addition, "brew install caskroom/cask/perforce" step triggers an
error that says:

    Error: caskroom/cask was moved. Tap homebrew/cask instead.

Attempt to see if blindly following the suggestion in these error
messages gets us into a better shape.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agopatch-ids: handle duplicate hashmap entries
Jeff King [Tue, 12 Jan 2021 15:52:32 +0000 (10:52 -0500)] 
patch-ids: handle duplicate hashmap entries

This fixes a bug introduced in dfb7a1b4d0 (patch-ids: stop using a
hand-rolled hashmap implementation, 2016-07-29) in which

  git rev-list --cherry-pick A...B

will fail to suppress commits reachable from A even if a commit with
matching patch-id appears in B.

Around the time of that commit, the algorithm for "--cherry-pick" looked
something like this:

  0. Traverse all of the commits, marking them as being on the left or
     right side of the symmetric difference.

  1. Iterate over the left-hand commits, inserting a patch-id struct for
     each into a hashmap, and pointing commit->util to the patch-id
     struct.

  2. Iterate over the right-hand commits, checking which are present in
     the hashmap. If so, we exclude the commit from the output _and_ we
     mark the patch-id as "seen".

  3. Iterate again over the left-hand commits, checking whether
     commit->util->seen is set; if so, exclude them from the output.

At the end, we'll have eliminated commits from both sides that have a
matching patch-id on the other side. But there's a subtle assumption
here: for any given patch-id, we must have exactly one struct
representing it. If two commits from A both have the same patch-id and
we allow duplicates in the hashmap, then we run into a problem:

  a. In step 1, we insert two patch-id structs into the hashmap.

  b. In step 2, our lookups will find only one of these structs, so only
     one "seen" flag is marked.

  c. In step 3, one of the commits in A will have its commit->util->seen
     set, but the other will not. We'll erroneously output the latter.

Prior to dfb7a1b4d0, our hashmap did not allow duplicates. Afterwards,
it used hashmap_add(), which explicitly does allow duplicates.

At that point, the solution would have been easy: when we are about to
add a duplicate, skip doing so and return the existing entry which
matches. But it gets more complicated.

In 683f17ec44 (patch-ids: replace the seen indicator with a commit
pointer, 2016-07-29), our step 3 goes away entirely. Instead, in step 2,
when the right-hand side finds a matching patch_id from the left-hand
side, we can directly mark the left-hand patch_id->commit to be omitted.
Solving that would be easy, too; there's a one-to-many relationship of
patch-ids to commits, so we just need to keep a list.

But there's more. Commit b3dfeebb92 (rebase: avoid computing unnecessary
patch IDs, 2016-07-29) built on that by lazily computing the full
patch-ids. So we don't even know when adding to the hashmap whether two
commits truly have the same id. We'd have to tentatively assign them a
list, and then possibly split them apart (possibly into N new structs)
at the moment we compute the real patch-ids. This could work, but it's
complicated and error-prone.

Instead, let's accept that we may store duplicates, and teach the lookup
side to be more clever. Rather than asking for a single matching
patch-id, it will need to iterate over all matching patch-ids. This does
mean examining every entry in a single hash bucket, but the worst-case
for a hash lookup was already doing that.

We'll keep the hashmap details out of the caller by providing a simple
iteration interface. We can retain the simple has_commit_patch_id()
interface for the other callers, but we'll simplify its return value
into an integer, rather than returning the patch_id struct. That way
they won't be tempted to look at the "commit" field of the return value
without iterating.

Reported-by: Arnaud Morin <arnaud.morin@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoDocumentation/git-clone.txt: document race with --local
Taylor Blau [Mon, 11 Jan 2021 19:25:10 +0000 (14:25 -0500)] 
Documentation/git-clone.txt: document race with --local

When running 'git clone --local', the operation may fail if another
process is modifying the source repository. Document that this race
condition is known to hopefully help anyone who may run into it.

Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogettext.c: remove/reword a mostly-useless comment
Ævar Arnfjörð Bjarmason [Mon, 11 Jan 2021 13:14:51 +0000 (14:14 +0100)] 
gettext.c: remove/reword a mostly-useless comment

Mostly remove the comment I added 5e9637c6297 (i18n: add
infrastructure for translating Git with gettext, 2011-11-18). Since
then we had a fix in 9c0495d23e6 (gettext.c: detect the vsnprintf bug
at runtime, 2013-12-01) so we're not running with the "set back to C
locale" hack on any modern system.

So having more than 1/4 of the file taken up by a digression about a
glibc bug that mostly doesn't happen to anyone anymore is just a
needless distraction. Shorten the comment to make a brief mention of
the bug, and where to find more info by looking at the git history for
this now-removed comment.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMakefile: remove a warning about old GETTEXT_POISON flag
Ævar Arnfjörð Bjarmason [Mon, 11 Jan 2021 13:14:50 +0000 (14:14 +0100)] 
Makefile: remove a warning about old GETTEXT_POISON flag

Remove a migratory warning I added in 6cdccfce1e0 (i18n: make
GETTEXT_POISON a runtime option, 2018-11-08) to give anyone using that
option in their builds a heads-up about the change from compile-time
to runtime introduced in that commit.

It's been more than 2 years since then, anyone who ran into this is
likely to have made a change as a result, so removing this is long
overdue.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agodocs: rephrase and clarify the git status --short format
brian m. carlson [Sun, 10 Jan 2021 19:04:48 +0000 (19:04 +0000)] 
docs: rephrase and clarify the git status --short format

The table describing the porcelain format in git-status(1) is helpful,
but it's not completely clear what the three sections mean, even to
some contributors.  As a result, users are unable to find how to detect
common cases like merge conflicts programmatically.

Let's improve this situation by rephrasing to be more explicit about
what each of the sections in the table means, to tell users in plain
language which cases are occurring, and to describe what "unmerged"
means.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agodoc: remove "directory cache" from man pages
Utku Gultopu [Fri, 8 Jan 2021 16:54:56 +0000 (16:54 +0000)] 
doc: remove "directory cache" from man pages

"directory cache" (or "directory cache index", "cache") are obsolete
terms which have been superseded by "index". Keeping them in the
documentation may be a source of confusion. This commit replaces
them with the current term, "index", on man pages.

Signed-off-by: Utku Gultopu <ugultopu@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot5516: loosen "not our ref" error check
Jeff King [Sun, 10 Jan 2021 03:23:09 +0000 (22:23 -0500)] 
t5516: loosen "not our ref" error check

Commit 014ade7484 (upload-pack: send ERR packet for non-tip objects,
2019-04-13) added a test that greps the output of a failed fetch to make
sure that upload-pack sent us the ERR packet we expected. But checking
this is racy; despite the argument in that commit, the client may still
be sending a "done" line after the server exits, causing it to die() on
a failed write() and never see the ERR packet at all.

This fails quite rarely on Linux, but more often on macOS. However, it
can be triggered reliably with:

diff --git a/fetch-pack.c b/fetch-pack.c
index 876f90c759..cf40de9092 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -489,6 +489,7 @@ static int find_common(struct fetch_negotiator *negotiator,
 done:
  trace2_region_leave("fetch-pack", "negotiation_v0_v1", the_repository);
  if (!got_ready || !no_done) {
+ sleep(1);
  packet_buf_write(&req_buf, "done\n");
  send_request(args, fd[1], &req_buf);
  }

This is a real user-visible race that it would be nice to fix, but it's
tricky to do so: the client would have to speculatively try to read an
ERR packet after hitting a write() error. And at least for this error,
it's specific to v0 (since v2 does not enforce reachability at all).

So let's loosen the test to avoid annoying racy failures. If we
eventually do the read-after-failed-write thing, we can tighten it. And
if not, v0 will grow increasingly obsolete as servers support v2, so the
utility of this test will decrease over time anyway.

Note that we can still check stderr to make sure upload-pack bailed for
the reason we expected. It writes a similar message to stderr, and
because the server side is just another process connected by pipes,
we'll reliably see it. This would not be the case for git://, or for
ssh servers that do not relay stderr (e.g., GitHub's custom endpoint
does not).

Helped-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot4129: fix setfacl-related permissions failure
Adam Dinwoodie [Wed, 23 Dec 2020 11:44:31 +0000 (11:44 +0000)] 
t4129: fix setfacl-related permissions failure

When running this test in Cygwin, it's necessary to remove the inherited
access control lists from the Git working directory in order for later
permissions tests to work as expected.

As such, fix an error in the test script so that the ACLs are set for
the working directory, not a nonexistent subdirectory.

Signed-off-by: Adam Dinwoodie <adam@dinwoodie.org>
Reviewed-by: Matheus Tavares <matheus.bernardino@usp.br>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogit-send-email.txt: mention less secure app access with Gmail
Vasyl Vavrychuk [Fri, 8 Jan 2021 04:17:17 +0000 (20:17 -0800)] 
git-send-email.txt: mention less secure app access with Gmail

Google may have changed Gmail security and now less secure app access
needs to be explicitly enabled if two-factor authentication is not in
place, otherwise send-email fails with:

5.7.8 Username and Password not accepted. Learn more at
5.7.8  https://support.google.com/mail/?p=BadCredentials

Document steps required to make this work.

Signed-off-by: Vasyl Vavrychuk <vvavrychuk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
[dl: Clean up commit message and incorporate suggestions into patch.]
Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agofor-each-repo: do nothing on empty config
Derrick Stolee [Fri, 8 Jan 2021 02:30:46 +0000 (02:30 +0000)] 
for-each-repo: do nothing on empty config

'git for-each-repo --config=X' should return success without calling any
subcommands when the config key 'X' has no value. The current
implementation instead segfaults.

A user could run into this issue if they used 'git maintenance start' to
initialize their cron schedule using 'git for-each-repo
--config=maintenance.repo ...' but then using 'git maintenance
unregister' to remove the config option. (Note: 'git maintenance stop'
would remove the config _and_ remove the cron schedule.)

Add a simple test to ensure this works. Use 'git help --no-such-option'
as the potential subcommand to ensure that we will hit a failure if the
subcommand is ever run.

Reported-by: Andreas Bühmann <dev@uuml.de>
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoSubmittingPatches: tighten wording on "sign-off" procedure
Junio C Hamano [Thu, 7 Jan 2021 23:38:09 +0000 (15:38 -0800)] 
SubmittingPatches: tighten wording on "sign-off" procedure

The text says "if you can certify DCO then you add a Signed-off-by
trailer".  But it does not say anything about people who cannot or
do not want to certify.  A natural reading may be that if you do not
certify, you must not add the trailer, but it shouldn't hurt to be
overly explicit.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agobranch: show "HEAD detached" first under reverse sort
Ævar Arnfjörð Bjarmason [Thu, 7 Jan 2021 09:51:53 +0000 (10:51 +0100)] 
branch: show "HEAD detached" first under reverse sort

Change the output of the likes of "git branch -l --sort=-objectsize"
to show the "(HEAD detached at <hash>)" message at the start of the
output. Before the compare_detached_head() function added in a
preceding commit we'd emit this output as an emergent effect.

It doesn't make any sense to consider the objectsize, type or other
non-attribute of the "(HEAD detached at <hash>)" message for the
purposes of sorting. Let's always emit it at the top instead. The only
reason it was sorted in the first place is because we're injecting it
into the ref-filter machinery so builtin/branch.c doesn't need to do
its own "am I detached?" detection.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agobranch: sort detached HEAD based on a flag
Ævar Arnfjörð Bjarmason [Thu, 7 Jan 2021 09:51:52 +0000 (10:51 +0100)] 
branch: sort detached HEAD based on a flag

Change the ref-filter sorting of detached HEAD to check the
FILTER_REFS_DETACHED_HEAD flag, instead of relying on the ref
description filled-in by get_head_description() to start with "(",
which in turn we expect to ASCII-sort before any other reference.

For context, we'd like the detached line to appear first at the start
of "git branch -l", e.g.:

    $ git branch -l
    * (HEAD detached at <hash>)
      master

This doesn't change that, but improves on a fix made in
28438e84e04 (ref-filter: sort detached HEAD lines firstly, 2019-06-18)
and gives the Chinese translation the ability to use its preferred
punctuation marks again.

In Chinese the fullwidth versions of punctuation like "()" are
typically written as (U+FF08 fullwidth left parenthesis), (U+FF09
fullwidth right parenthesis) instead[1]. This form is used in both
po/zh_{CN,TW}.po in most cases where "()" is translated in a string.

Aside from that improvement to the Chinese translation, it also just
makes for cleaner code that we mark any special cases in the ref_array
we're sorting with flags and make the sort function aware of them,
instead of piggy-backing on the general-case of strcmp() doing the
right thing.

As seen in the amended tests this made reverse sorting a bit more
consistent. Before this we'd sometimes sort this message in the
middle, now it's consistently at the beginning or end, depending on
whether we're doing a normal or reverse sort. Having it at the end
doesn't make much sense either, but at least it behaves consistently
now. A follow-up commit will make this behavior under reverse sorting
even better.

I'm removing the "TRANSLATORS" comments that were in the old code
while I'm at it. Those were added in d4919bb288e (ref-filter: move
get_head_description() from branch.c, 2017-01-10). I think it's
obvious from context, string and translation memory in typical
translation tools that these are the same or similar string.

1. https://en.wikipedia.org/wiki/Chinese_punctuation#Marks_similar_to_European_punctuation

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoref-filter: move ref_sorting flags to a bitfield
Ævar Arnfjörð Bjarmason [Thu, 7 Jan 2021 09:51:51 +0000 (10:51 +0100)] 
ref-filter: move ref_sorting flags to a bitfield

Change the reverse/ignore_case/version sort flags in the ref_sorting
struct into a bitfield. Having three of them was already a bit
unwieldy, but it would be even more so if another flag needed a
function like ref_sorting_icase_all() introduced in
76f9e569adb (ref-filter: apply --ignore-case to all sorting keys,
2020-05-03).

A follow-up change will introduce such a flag, so let's move this over
to a bitfield. Instead of using the usual '#define' pattern I'm using
the "enum" pattern from builtin/rebase.c's b4c8eb024af (builtin
rebase: support --quiet, 2018-09-04).

Perhaps there's a more idiomatic way of doing the "for each in list
amend mask" pattern than this "mask/on" variable combo. This function
doesn't allow us to e.g. do any arbitrary changes to the bitfield for
multiple flags, but I think in this case that's fine. The common case
is that we're calling this with a list of one.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoref-filter: move "cmp_fn" assignment into "else if" arm
Ævar Arnfjörð Bjarmason [Thu, 7 Jan 2021 09:51:50 +0000 (10:51 +0100)] 
ref-filter: move "cmp_fn" assignment into "else if" arm

Further amend code changed in 7c5045fc180 (ref-filter: apply fallback
refname sort only after all user sorts, 2020-05-03) to move an
assignment only used in the "else if" arm to happen there. Before that
commit the cmp_fn would be used outside of it.

We could also just skip the "cmp_fn" assignment and use
strcasecmp/strcmp directly in a ternary statement here, but this is
probably more readable.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoref-filter: add braces to if/else if/else chain
Ævar Arnfjörð Bjarmason [Thu, 7 Jan 2021 09:51:49 +0000 (10:51 +0100)] 
ref-filter: add braces to if/else if/else chain

Per the CodingGuidelines add braces to an if/else if/else chain where
only the "else" had braces. This is in preparation for a subsequent
change where the "else if" will have lines added to it.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agofsck: reject .gitmodules git:// urls with newlines
Jeff King [Thu, 7 Jan 2021 09:44:17 +0000 (04:44 -0500)] 
fsck: reject .gitmodules git:// urls with newlines

The previous commit taught the clone/fetch client side to reject a
git:// URL with a newline in it. Let's also catch these when fscking a
.gitmodules file, which will give an earlier warning.

Note that it would be simpler to just complain about newline in _any_
URL, but an earlier tightening for http/ftp made sure we kept allowing
newlines for unknown protocols (and this is covered in the tests). So
we'll stick to that precedent.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogit_connect_git(): forbid newlines in host and path
Jeff King [Thu, 7 Jan 2021 09:43:58 +0000 (04:43 -0500)] 
git_connect_git(): forbid newlines in host and path

When we connect to a git:// server, we send an initial request that
looks something like:

  002dgit-upload-pack repo.git\0host=example.com

If the repo path contains a newline, then it's included literally, and
we get:

  002egit-upload-pack repo
  .git\0host=example.com

This works fine if you really do have a newline in your repository name;
the server side uses the pktline framing to parse the string, not
newlines. However, there are many _other_ protocols in the wild that do
parse on newlines, such as HTTP. So a carefully constructed git:// URL
can actually turn into a valid HTTP request. For example:

  git://localhost:1234/%0d%0a%0d%0aGET%20/%20HTTP/1.1 %0d%0aHost:localhost%0d%0a%0d%0a

becomes:

  0050git-upload-pack /
  GET / HTTP/1.1
  Host:localhost

  host=localhost:1234

on the wire. Again, this isn't a problem for a real Git server, but it
does mean that feeding a malicious URL to Git (e.g., through a
submodule) can cause it to make unexpected cross-protocol requests.
Since repository names with newlines are presumably quite rare (and
indeed, we already disallow them in git-over-http), let's just disallow
them over this protocol.

Hostnames could likewise inject a newline, but this is unlikely a
problem in practice; we'd try resolving the hostname with a newline in
it, which wouldn't work. Still, it doesn't hurt to err on the side of
caution there, since we would not expect them to work in the first
place.

The ssh and local code paths are unaffected by this patch. In both cases
we're trying to run upload-pack via a shell, and will quote the newline
so that it makes it intact. An attacker can point an ssh url at an
arbitrary port, of course, but unless there's an actual ssh server
there, we'd never get as far as sending our shell command anyway.  We
_could_ similarly restrict newlines in those protocols out of caution,
but there seems little benefit to doing so.

The new test here is run alongside the git-daemon tests, which cover the
same protocol, but it shouldn't actually contact the daemon at all.  In
theory we could make the test more robust by setting up an actual
repository with a newline in it (so that our clone would succeed if our
new check didn't kick in). But a repo directory with newline in it is
likely not portable across all filesystems. Likewise, we could check
git-daemon's log that it was not contacted at all, but we do not
currently record the log (and anyway, it would make the test racy with
the daemon's log write). We'll just check the client-side stderr to make
sure we hit the expected code path.

Reported-by: Harold Kim <h.kim@flatt.tech>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agomergetool--lib: fix '--tool-help' to correctly show available tools
Philippe Blain [Thu, 7 Jan 2021 01:09:05 +0000 (01:09 +0000)] 
mergetool--lib: fix '--tool-help' to correctly show available tools

Commit 83bbf9b92e (mergetool--lib: improve support for vimdiff-style tool
variants, 2020-07-29) introduced a regression in the output of `git mergetool
--tool-help` and `git difftool --tool-help` [1].

In function 'show_tool_names' in git-mergetool--lib.sh, we loop over the
supported mergetools and their variants and accumulate them in the variable
'variants', separating them with a literal '\n'.

The code then uses 'echo $variants' to turn these '\n' into newlines, but this
behaviour is not portable, it just happens to work in some shells, like
dash(1)'s 'echo' builtin.

For shells in which 'echo' does not turn '\n' into newlines, the end
result is that the only tools that are shown are the existing variants
(except the last variant alphabetically), since the variants are
separated by actual newlines in '$variants' because of the several
'echo' calls in mergetools/{bc,vimdiff}::list_tool_variants.

Fix this bug by embedding an actual line feed into `variants` in
show_tool_names(). While at it, replace `sort | uniq` by `sort -u`.

To prevent future regressions, add a simple test that checks that a few
known tools are correctly shown (let's avoid counting the total number
of tools to lessen the maintenance burden when new tools are added or if
'--tool-help' learns additional logic, like hiding tools depending on
the current platform).

[1] https://lore.kernel.org/git/CADtb9DyozjgAsdFYL8fFBEWmq7iz4=prZYVUdH9W-J5CKVS4OA@mail.gmail.com/

Reported-by: Philippe Blain <levraiphilippeblain@gmail.com>
Based-on-patch-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot4129: don't fail if setgid is set in the test directory
Matheus Tavares [Tue, 5 Jan 2021 15:47:39 +0000 (12:47 -0300)] 
t4129: don't fail if setgid is set in the test directory

The last test of t4129 creates a directory and expects its setgid bit
(g+s) to be off. But this makes the test fail when the parent directory
has the bit set, as setgid's state is inherited by newly created
subdirectories.

One way to solve this problem is to allow the presence of this bit when
comparing the return of `test_modebits` with the expected value. But
then we may have the same problem in the future when other tests start
using `test_modebits` on directories (currently t4129 is the only one)
and forget about setgid. Instead, let's make the helper function more
robust with respect to the state of the setgid bit in the test directory
by removing this bit from the returning value. There should be no
problem with existing callers as no one currently expects this bit to be
on.

Note that the sticky bit (+t) and the setuid bit (u+s) are not
inherited, so we don't have to worry about those.

Reported-by: Kevin Daudt <me@ikke.info>
Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agobranch tests: add to --sort tests
Ævar Arnfjörð Bjarmason [Wed, 6 Jan 2021 10:01:36 +0000 (11:01 +0100)] 
branch tests: add to --sort tests

Further stress the --sort callback in ref-filter.c. The implementation
uses certain short-circuiting logic, let's make sure it behaves the
same way on e.g. name & version sort. Improves a test added in
aedcb7dc75e (branch.c: use 'ref-filter' APIs, 2015-09-23).

I don't think all of this output makes sense, but let's test for the
behavior as-is, we can fix bugs in it in a later commit.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agobranch: change "--local" to "--list" in comment
Ævar Arnfjörð Bjarmason [Wed, 6 Jan 2021 10:01:35 +0000 (11:01 +0100)] 
branch: change "--local" to "--list" in comment

There has never been a "git branch --local", this is just a typo for
"--list". Fixes a comment added in 23e714df91c (branch: roll
show_detached HEAD into regular ref_list, 2015-09-23).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agobuiltin/*: update usage format
ZheNing Hu [Wed, 6 Jan 2021 14:44:03 +0000 (14:44 +0000)] 
builtin/*: update usage format

According to the guidelines in parse-options.h,
we should not end in a full stop or start with
a capital letter. Fix old error and usage
messages to match this expectation.

Signed-off-by: ZheNing Hu <adlternative@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoparse-options: format argh like error messages
Junio C Hamano [Wed, 6 Jan 2021 14:44:02 +0000 (14:44 +0000)] 
parse-options: format argh like error messages

"Keep it homogeneous across the repository" is in general a
guideline that can be used to converge to a good practice, but
we can be a bit more prescriptive in this case.  Just like the
messages we give die(_("...")) are formatted without the final
full stop and without the initial capitalization, most of the
argument help text are already formatted that way, and we want
to encourage that as the house style.

Noticed-by: ZheNing Hu <adlternative@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: ZheNing Hu <adlternative@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoread-cache: try not to peek into `struct {lock_,temp}file`
Martin Ågren [Tue, 5 Jan 2021 19:23:50 +0000 (20:23 +0100)] 
read-cache: try not to peek into `struct {lock_,temp}file`

Similar to the previous commits, try to avoid peeking into the `struct
lock_file`. We also have some `struct tempfile`s -- let's avoid looking
into those as well.

Note that `do_write_index()` takes a tempfile and that when we call it,
we either have a tempfile which we can easily hand down, or we have a
lock file, from which we need to somehow obtain the internal tempfile.
So we need to leave that one instance of peeking-into. Nevertheless,
this commit leaves us not relying on exactly how the path of the
tempfile / lock file is stored internally.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agorefs/files-backend: don't peek into `struct lock_file`
Martin Ågren [Tue, 5 Jan 2021 19:23:49 +0000 (20:23 +0100)] 
refs/files-backend: don't peek into `struct lock_file`

Similar to the previous commits, avoid peeking into the `struct
lock_file`. Use the lock file API instead. Note how we obtain the path
to the lock file if `fdopen_lock_file()` failed and that this is not a
problem: as documented in lockfile.h, failure to "fdopen" does not roll
back the lock file and we're free to, e.g., query it for its path.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agomidx: don't peek into `struct lock_file`
Martin Ågren [Tue, 5 Jan 2021 19:23:48 +0000 (20:23 +0100)] 
midx: don't peek into `struct lock_file`

Similar to the previous commits, avoid peeking into the `struct
lock_file`. Use the lock file API instead.

The two functions we're calling here double-check that the tempfile is
indeed "active", which is arguably overkill considering how we took the
lock on the line immediately above. More importantly, this future-proofs
us against, e.g., other code appearing between these two lines or the
lock file and/or tempfile internals changing.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocommit-graph: don't peek into `struct lock_file`
Martin Ågren [Tue, 5 Jan 2021 19:23:47 +0000 (20:23 +0100)] 
commit-graph: don't peek into `struct lock_file`

Similar to the previous commit, avoid peeking into the `struct
lock_file`. Use the lock file API instead.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agobuiltin/gc: don't peek into `struct lock_file`
Martin Ågren [Tue, 5 Jan 2021 19:23:46 +0000 (20:23 +0100)] 
builtin/gc: don't peek into `struct lock_file`

A `struct lock_file` is pretty much just a wrapper around a tempfile.
But it's easy enough to avoid relying on this. Use the wrappers that the
lock file API provides rather than peeking at the temp file or even into
*its* internals.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agop7519: allow running without watchman prereq
Taylor Blau [Mon, 4 Jan 2021 21:35:37 +0000 (16:35 -0500)] 
p7519: allow running without watchman prereq

p7519 measures the performance of the fsmonitor code. To do this, it
uses the installed copy of Watchman. If Watchman isn't installed, a noop
integration script is installed in its place.

When in the latter mode, it is expected that the script should not write
a "last update token": in fact, it doesn't write anything at all since
the script is blank.

Commit 33226af42b (t/perf/fsmonitor: improve error message if typoing
hook name, 2020-10-26) made sure that running 'git update-index
--fsmonitor' did not write anything to stderr, but this is not the case
when using the empty Watchman script, since Git will complain that:

    $ which watchman
    watchman not found
    $ cat .git/hooks/fsmonitor-empty
    $ git -c core.fsmonitor=.git/hooks/fsmonitor-empty update-index --fsmonitor
    warning: Empty last update token.

Prior to 33226af42b, the output wasn't checked at all, which allowed
this noop mode to work. But, 33226af42b breaks p7519 when running it
without a 'watchman(1)' on your system.

Handle this by only checking that the stderr is empty only when running
with a real watchman executable. Otherwise, assert that the error
message is the expected one when running in the noop mode.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Acked-by: Nipunn Koorapati <nipunn@dropbox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agorebase: verify commit parameter
René Scharfe [Thu, 31 Dec 2020 23:55:12 +0000 (00:55 +0100)] 
rebase: verify commit parameter

If the user specifies a base commit to switch to, check if it actually
references a commit right away to avoid getting confused later on when
it turns out to be an invalid object.

Reported-by: LeSeulArtichaut <leseulartichaut@gmail.com>
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agopack-format.txt: document sizes at start of delta data
Martin Ågren [Tue, 29 Dec 2020 22:43:35 +0000 (23:43 +0100)] 
pack-format.txt: document sizes at start of delta data

We document the delta data as a set of instructions, but forget to
document the two sizes that precede those instructions: the size of the
base object and the size of the object to be reconstructed. Fix this
omission.

Rather than cramming all the details about the encoding into the running
text, introduce a separate section detailing our "size encoding" and
refer to it.

Reported-by: Ross Light <ross@zombiezen.com>
Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot6016: move to lib-log-graph.sh framework
Antonio Russo [Mon, 4 Jan 2021 02:30:35 +0000 (19:30 -0700)] 
t6016: move to lib-log-graph.sh framework

t6016 manually reconstructs git log --graph output by using the reported
commit hashes from `git rev-parse`.  Each tag is converted into an
environment variable manually, and then `echo`-ed to an expected output
file, which is in turn compared to the actual output.

The expected output is difficult to read and write, because, e.g.,
each line of output must be prefaced with echo, quoted, and properly
escaped.  Additionally, the test is sensitive to trailing whitespace,
which may potentially be removed from graph log output in the future.

In order to reduce duplication, ease troubleshooting of failed tests by
improving readability, and ease the addition of more tests to this file,
port the operations to `lib-log-graph.sh`, which is already used in
several other tests, e.g., t4215.  Give all merges a simple commit
message, and use a common `check_graph` macro taking a heredoc of the
expected output which does not required extensive escaping.

Signed-off-by: Antonio Russo <aerusso@aerusso.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot1300: don't needlessly work with `core.foo` configs
Martin Ågren [Sun, 3 Jan 2021 09:36:48 +0000 (10:36 +0100)] 
t1300: don't needlessly work with `core.foo` configs

We use various made-up config keys in the "core" section for no real
reason. Change them to work in the "section" section instead and be
careful to also change "cores" to "sections". Make sure to also catch
"Core", "CoReS" and similar.

There are a few instances that actually want to work with a real "core"
config such as `core.bare` or `core.editor`. After this, it's clearer
that they work with "core" for a reason.

Reported-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot1300: remove duplicate test for `--file no-such-file`
Martin Ågren [Sun, 3 Jan 2021 09:36:47 +0000 (10:36 +0100)] 
t1300: remove duplicate test for `--file no-such-file`

We test that we can handle `git config --file symlink` and the error
case of `git config --file symlink-to-missing-file`. For good measure,
we also throw in a test to check that we correctly handle referencing a
missing regular file. But we have such a test earlier in this script.
They both check that we fail to use `--file no-such-file --list`.

Drop the latter of these and keep the one that is in the general area
where we test `--file` and `GIT_CONFIG`. The one we're dropping also
checks that we can't even get a specific key from the missing file --
let's make sure we check that in the test we keep.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot1300: remove duplicate test for `--file ../foo`
Martin Ågren [Sun, 3 Jan 2021 09:36:46 +0000 (10:36 +0100)] 
t1300: remove duplicate test for `--file ../foo`

We have two tests for checking that we can handle `git config --file
../other-config ...`. One, using `--file`, was introduced in 65807ee697
("builtin-config: Fix crash when using "-f <relative path>" from
non-root dir", 2010-01-26), then another, using `GIT_CONFIG`, came about
in 270a34438b ("config: stop using config_exclusive_filename",
2012-02-16).

The latter of these was then converted to use `--file` in f7e8714101
("t: prefer "git config --file" to GIT_CONFIG", 2014-03-20). Both where
then simplified in a5db0b77b9 ("t1300: extract and use
test_cmp_config()", 2018-10-21).

These two tests differ slightly in the order of the options used, but
other than that, they are identical. Let's drop one. As noted in
f7e8714101, we do still have a test for `GIT_CONFIG` and it shares the
implementation with `--file`.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agogitmodules.txt: fix 'GIT_WORK_TREE' variable name
Philippe Blain [Sun, 3 Jan 2021 17:42:15 +0000 (17:42 +0000)] 
gitmodules.txt: fix 'GIT_WORK_TREE' variable name

'gitmodules.txt' is a guide about the '.gitmodules' file that describes
submodule properties, and that file must exist at the root of the
repository. This was clarified in e5b5c1d2cf (Document clarification:
gitmodules, gitattributes, 2008-08-31).

However, that commit mistakenly uses the non-existing environment
variable 'GIT_WORK_DIR' to refer to the root of the repository.

Fix that by using the correct variable, 'GIT_WORK_TREE'. Take the
opportunity to modernize and improve the formatting of that guide,
and fix a grammar mistake.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
Acked-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agodoc: fix some typos
Thomas Ackermann [Sun, 3 Jan 2021 14:25:50 +0000 (14:25 +0000)] 
doc: fix some typos

Signed-off-by: Thomas Ackermann <th.acker@arcor.de>
Acked-by: Martin Ågren <martin.agren@gmail.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 agogit-p4: fix syncing file types with pattern
Daniel Levin [Wed, 23 Dec 2020 14:37:27 +0000 (14:37 +0000)] 
git-p4: fix syncing file types with pattern

Example of pattern file type: text+k

Text filtered through the p4 pattern regexp must be converted from
string back to bytes, otherwise 'data' command for the fast-import
will receive extra invalid characters, followed by the fast-import
process error.

CC: Yang Zhao <yang.zhao@skyboxlabs.com>
Signed-off-by: Daniel Levin <dendy.ua@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
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>