]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
3 years agoMerge branch 'so/format-patch-doc-on-default-diff-format'
Junio C Hamano [Wed, 11 Nov 2020 21:18:37 +0000 (13:18 -0800)] 
Merge branch 'so/format-patch-doc-on-default-diff-format'

Docfix.

* so/format-patch-doc-on-default-diff-format:
  doc/diff-options: fix out of place mentions of '--patch/-p'

3 years agoFourth batch
Junio C Hamano [Mon, 9 Nov 2020 21:31:58 +0000 (13:31 -0800)] 
Fourth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'js/default-branch-name-adjust-t5411'
Junio C Hamano [Mon, 9 Nov 2020 22:06:29 +0000 (14:06 -0800)] 
Merge branch 'js/default-branch-name-adjust-t5411'

Prepare a test script to transition of the default branch name to
'main'.

* js/default-branch-name-adjust-t5411:
  t5411: finish preparing for `main` being the default branch name
  t5411: adjust the remaining support files for init.defaultBranch=main
  t5411: start adjusting the support files for init.defaultBranch=main
  t5411: start using the default branch name "main"

3 years agoMerge branch 'fc/zsh-completion'
Junio C Hamano [Mon, 9 Nov 2020 22:06:29 +0000 (14:06 -0800)] 
Merge branch 'fc/zsh-completion'

Zsh autocompletion (in contrib/) update.

* fc/zsh-completion: (29 commits)
  zsh: update copyright notices
  completion: bash: remove old compat wrappers
  completion: bash: cleanup cygwin check
  completion: bash: trivial cleanup
  completion: zsh: add simple version check
  completion: zsh: trivial simplification
  completion: zsh: add alias descriptions
  completion: zsh: improve command tags
  completion: zsh: refactor command completion
  completion: zsh: shuffle functions around
  completion: zsh: simplify file_direct
  completion: zsh: simplify nl_append
  completion: zsh: trivial cleanup
  completion: zsh: simplify direct compadd
  completion: zsh: simplify compadd functions
  completion: zsh: fix splitting of words
  completion: zsh: add missing direct_append
  completion: fix conflict with bashcomp
  completion: zsh: fix completion for --no-.. options
  completion: bash: remove zsh wrapper
  ...

3 years agoMerge branch 'jk/sideband-more-error-checking'
Junio C Hamano [Mon, 9 Nov 2020 22:06:29 +0000 (14:06 -0800)] 
Merge branch 'jk/sideband-more-error-checking'

The code to detect premature EOF in the sideband demultiplexer has
been cleaned up.

* jk/sideband-more-error-checking:
  sideband: diagnose more sideband anomalies

3 years agoMerge branch 'jk/committer-date-is-author-date-fix-simplify'
Junio C Hamano [Mon, 9 Nov 2020 22:06:27 +0000 (14:06 -0800)] 
Merge branch 'jk/committer-date-is-author-date-fix-simplify'

Code simplification.

* jk/committer-date-is-author-date-fix-simplify:
  am, sequencer: stop parsing our own committer ident

3 years agoMerge branch 'ab/git-remote-exit-code'
Junio C Hamano [Mon, 9 Nov 2020 22:06:26 +0000 (14:06 -0800)] 
Merge branch 'ab/git-remote-exit-code'

Exit codes from "git remote add" etc. were not usable by scripted
callers.

* ab/git-remote-exit-code:
  remote: add meaningful exit code on missing/existing

3 years agoMerge branch 'pb/ref-filter-with-crlf'
Junio C Hamano [Mon, 9 Nov 2020 22:06:26 +0000 (14:06 -0800)] 
Merge branch 'pb/ref-filter-with-crlf'

A commit and tag object may have CR at the end of each and
every line (you can create such an object with hash-object or
using --cleanup=verbatim to decline the default clean-up
action), but it would make it impossible to have a blank line
to separate the title from the body of the message.  Be lenient
and accept a line with lone CR on it as a blank line, too.

* pb/ref-filter-with-crlf:
  log, show: add tests for messages containing CRLF
  ref-filter: handle CRLF at end-of-line more gracefully

3 years agoMerge branch 'jk/checkout-index-errors'
Junio C Hamano [Mon, 9 Nov 2020 22:06:26 +0000 (14:06 -0800)] 
Merge branch 'jk/checkout-index-errors'

"git checkout-index" did not consistently signal an error with its
exit status.

* jk/checkout-index-errors:
  checkout-index: propagate errors to exit code
  checkout-index: drop error message from empty --stage=all

3 years agoMerge branch 'jk/perl-warning'
Junio C Hamano [Mon, 9 Nov 2020 22:06:25 +0000 (14:06 -0800)] 
Merge branch 'jk/perl-warning'

Dev support.

* jk/perl-warning:
  perl: check for perl warnings while running tests

3 years agoMerge branch 'nk/diff-files-vs-fsmonitor'
Junio C Hamano [Mon, 9 Nov 2020 22:06:25 +0000 (14:06 -0800)] 
Merge branch 'nk/diff-files-vs-fsmonitor'

"git diff" and other commands that share the same machinery to
compare with working tree files have been taught to take advantage
of the fsmonitor data when available.

* nk/diff-files-vs-fsmonitor:
  p7519-fsmonitor: add a git add benchmark
  p7519-fsmonitor: refactor to avoid code duplication
  perf lint: add make test-lint to perf tests
  t/perf: add fsmonitor perf test for git diff
  t/perf/p7519-fsmonitor.sh: warm cache on first git status
  t/perf/README: elaborate on output format
  fsmonitor: use fsmonitor data in `git diff`

3 years agoMerge branch 'as/tests-cleanup'
Junio C Hamano [Mon, 9 Nov 2020 22:06:25 +0000 (14:06 -0800)] 
Merge branch 'as/tests-cleanup'

Micro clean-up of a couple of test scripts.

* as/tests-cleanup:
  t2200,t9832: avoid using 'git' upstream in a pipe

3 years agoMerge branch 'en/dir-rename-tests'
Junio C Hamano [Mon, 9 Nov 2020 22:06:25 +0000 (14:06 -0800)] 
Merge branch 'en/dir-rename-tests'

More preliminary tests have been added to document desired outcome
of various "directory rename" situations.

* en/dir-rename-tests:
  t6423: more involved rules for renaming directories into each other
  t6423: update directory rename detection tests with new rule
  t6423: more involved directory rename test
  directory-rename-detection.txt: update references to regression tests

3 years agoMerge branch 'mr/bisect-in-c-3'
Junio C Hamano [Mon, 9 Nov 2020 22:06:25 +0000 (14:06 -0800)] 
Merge branch 'mr/bisect-in-c-3'

Rewriting "git bisect" in C continues.

* mr/bisect-in-c-3:
  bisect--helper: retire `--bisect-autostart` subcommand
  bisect--helper: retire `--write-terms` subcommand
  bisect--helper: retire `--check-expected-revs` subcommand
  bisect--helper: reimplement `bisect_state` & `bisect_head` shell functions in C
  bisect--helper: retire `--next-all` subcommand
  bisect--helper: retire `--bisect-clean-state` subcommand
  bisect--helper: finish porting `bisect_start()` to C

3 years agoThird batch
Junio C Hamano [Mon, 2 Nov 2020 21:17:20 +0000 (13:17 -0800)] 
Third batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'jc/doc-final-resend'
Junio C Hamano [Mon, 2 Nov 2020 21:17:47 +0000 (13:17 -0800)] 
Merge branch 'jc/doc-final-resend'

Update developer doc.

* jc/doc-final-resend:
  SubmittingPatches: clarify the purpose of the final resend

3 years agoMerge branch 'es/tutorial-mention-asciidoc-early'
Junio C Hamano [Mon, 2 Nov 2020 21:17:46 +0000 (13:17 -0800)] 
Merge branch 'es/tutorial-mention-asciidoc-early'

Doc update.

* es/tutorial-mention-asciidoc-early:
  MyFirstContribution: clarify asciidoc dependency

3 years agoMerge branch 'js/default-branch-name-part-4-minus-1'
Junio C Hamano [Mon, 2 Nov 2020 21:17:46 +0000 (13:17 -0800)] 
Merge branch 'js/default-branch-name-part-4-minus-1'

Adjust tests so that they won't scream when the default initial
branch name is changed to 'main'.

* js/default-branch-name-part-4-minus-1:
  t1400: prepare for `main` being default branch name
  tests: prepare aligned mentions of the default branch name
  t9902: prepare a test for the upcoming default branch name
  t3200: prepare for `main` being shorter than `master`
  t5703: adjust a test case for the upcoming default branch name
  t6200: adjust suppression pattern to also match "main"
  tests: start moving to a different default main branch name
  t9801: use `--` in preparation for default branch rename
  fmt-merge-msg: also suppress "into main" by default

3 years agoMerge branch 've/userdiff-bash'
Junio C Hamano [Mon, 2 Nov 2020 21:17:46 +0000 (13:17 -0800)] 
Merge branch 've/userdiff-bash'

The userdiff pattern learned to identify the function definition in
POSIX shells and bash.

* ve/userdiff-bash:
  userdiff: support Bash

3 years agoMerge branch 'bc/svn-hash-oid-fix'
Junio C Hamano [Mon, 2 Nov 2020 21:17:45 +0000 (13:17 -0800)] 
Merge branch 'bc/svn-hash-oid-fix'

A recent oid->hash conversion missed one spot, breaking "git svn".

* bc/svn-hash-oid-fix:
  svn: use correct variable name for short OID

3 years agoMerge branch 'js/t7006-cleanup'
Junio C Hamano [Mon, 2 Nov 2020 21:17:45 +0000 (13:17 -0800)] 
Merge branch 'js/t7006-cleanup'

Code clean-up.

* js/t7006-cleanup:
  t7006: Use test_path_is_* functions in test script

3 years agoMerge branch 'en/sequencer-rollback-lock-cleanup'
Junio C Hamano [Mon, 2 Nov 2020 21:17:44 +0000 (13:17 -0800)] 
Merge branch 'en/sequencer-rollback-lock-cleanup'

Code clean-up.

* en/sequencer-rollback-lock-cleanup:
  sequencer: remove duplicate rollback_lock_file() call

3 years agoMerge branch 'mk/diff-ignore-regex'
Junio C Hamano [Mon, 2 Nov 2020 21:17:43 +0000 (13:17 -0800)] 
Merge branch 'mk/diff-ignore-regex'

"git diff" family of commands learned the "-I<regex>" option to
ignore hunks whose changed lines all match the given pattern.

* mk/diff-ignore-regex:
  diff: add -I<regex> that ignores matching changes
  merge-base, xdiff: zero out xpparam_t structures

3 years agoMerge branch 'jt/apply-reverse-twice'
Junio C Hamano [Mon, 2 Nov 2020 21:17:43 +0000 (13:17 -0800)] 
Merge branch 'jt/apply-reverse-twice'

"git apply -R" did not handle patches that touch the same path
twice correctly, which has been corrected.  This is most relevant
in a patch that changes a path from a regular file to a symbolic
link (and vice versa).

* jt/apply-reverse-twice:
  apply: when -R, also reverse list of sections

3 years agoMerge branch 'sc/sequencer-gpg-octopus'
Junio C Hamano [Mon, 2 Nov 2020 21:17:43 +0000 (13:17 -0800)] 
Merge branch 'sc/sequencer-gpg-octopus'

"git rebase --rebase-merges" did not correctly pass --gpg-sign
command line option to underlying "git merge" when replaying a merge
using non-default merge strategy or when replaying an octopus merge
(because replaying a two-head merge with the default strategy was
done in a separate codepath, the problem did not trigger for most
users), which has been corrected.

* sc/sequencer-gpg-octopus:
  t3435: add tests for rebase -r GPG signing
  sequencer: pass explicit --no-gpg-sign to merge
  sequencer: fix gpg option passed to merge subcommand

3 years agoMerge branch 'en/test-selector'
Junio C Hamano [Mon, 2 Nov 2020 21:17:42 +0000 (13:17 -0800)] 
Merge branch 'en/test-selector'

Our test scripts can be told to run only individual pieces while
skipping others with the "--run=..." option; they were taught to
take a substring of test title, in addition to numbers, to name the
test pieces to run.

* en/test-selector:
  test-lib: reduce verbosity of skipped tests
  t6006, t6012: adjust tests to use 'setup' instead of synonyms
  test-lib: allow selecting tests by substring/glob with --run

3 years agoMerge branch 'jk/report-fn-typedef'
Junio C Hamano [Mon, 2 Nov 2020 21:17:42 +0000 (13:17 -0800)] 
Merge branch 'jk/report-fn-typedef'

Code clean-up.

* jk/report-fn-typedef:
  usage: define a type for a reporting function

3 years agoMerge branch 'nk/dir-c-comment-update'
Junio C Hamano [Mon, 2 Nov 2020 21:17:41 +0000 (13:17 -0800)] 
Merge branch 'nk/dir-c-comment-update'

Update stale in-code comment.

* nk/dir-c-comment-update:
  dir.c: fix comments to agree with argument name

3 years agoMerge branch 'jk/no-common'
Junio C Hamano [Mon, 2 Nov 2020 21:17:41 +0000 (13:17 -0800)] 
Merge branch 'jk/no-common'

Dev support to catch a tentative definition of a variable in our C
code as an error.

* jk/no-common:
  config.mak.dev: build with -fno-common

3 years agoMerge branch 'as/sample-push-to-checkout-hook'
Junio C Hamano [Mon, 2 Nov 2020 21:17:40 +0000 (13:17 -0800)] 
Merge branch 'as/sample-push-to-checkout-hook'

Add a sample 'push-to-checkout' hook, that performs the same as
what the built-in default action does.

* as/sample-push-to-checkout-hook:
  hook: add sample template for push-to-checkout

3 years agoMerge branch 'jk/fast-import-marks-cleanup'
Junio C Hamano [Mon, 2 Nov 2020 21:17:40 +0000 (13:17 -0800)] 
Merge branch 'jk/fast-import-marks-cleanup'

Code clean-up.

* jk/fast-import-marks-cleanup:
  fast-import: remove duplicated option-parsing line

3 years agoMerge branch 'lo/zsh-completion'
Junio C Hamano [Mon, 2 Nov 2020 21:17:40 +0000 (13:17 -0800)] 
Merge branch 'lo/zsh-completion'

Update instructions for command line completion (in contrib/) for zsh.

* lo/zsh-completion:
  completion: fix zsh installation instructions

3 years agoMerge branch 'tk/credential-config'
Junio C Hamano [Mon, 2 Nov 2020 21:17:39 +0000 (13:17 -0800)] 
Merge branch 'tk/credential-config'

"git credential' didn't honor the core.askPass configuration
variable (among other things), which has been corrected.

* tk/credential-config:
  credential: load default config

3 years agoMerge branch 'dl/diff-merge-base'
Junio C Hamano [Mon, 2 Nov 2020 21:17:39 +0000 (13:17 -0800)] 
Merge branch 'dl/diff-merge-base'

"git diff A...B" learned "git diff --merge-base A B", which is a
longer short-hand to say the same thing.

* dl/diff-merge-base:
  contrib/completion: complete `git diff --merge-base`
  builtin/diff-tree: learn --merge-base
  builtin/diff-index: learn --merge-base
  t4068: add --merge-base tests
  diff-lib: define diff_get_merge_base()
  diff-lib: accept option flags in run_diff_index()
  contrib/completion: extract common diff/difftool options
  git-diff.txt: backtick quote command text
  git-diff-index.txt: make --cached description a proper sentence
  t4068: remove unnecessary >tmp

3 years agoMerge branch 'bk/sob-dco'
Junio C Hamano [Mon, 2 Nov 2020 21:17:39 +0000 (13:17 -0800)] 
Merge branch 'bk/sob-dco'

Document that the meaning of a Signed-off-by trailer can vary from
project to project in the end-user documentation, and clarify what
it means to this project.

* bk/sob-dco:
  Documentation: stylistically normalize references to Signed-off-by:
  SubmittingPatches: clarify DCO is our --signoff rule
  Documentation: clarify and expand description of --signoff
  doc: preparatory clean-up of description on the sign-off option

3 years agoMerge branch 'ds/maintenance-commit-graph-auto-fix'
Junio C Hamano [Mon, 2 Nov 2020 21:17:39 +0000 (13:17 -0800)] 
Merge branch 'ds/maintenance-commit-graph-auto-fix'

Test-coverage enhancement of running commit-graph task "git
maintenance" as needed led to discovery and fix of a bug.

* ds/maintenance-commit-graph-auto-fix:
  maintenance: core.commitGraph=false prevents writes
  maintenance: test commit-graph auto condition

3 years agoMerge branch 'ds/commit-graph-merging-fix'
Junio C Hamano [Mon, 2 Nov 2020 21:17:39 +0000 (13:17 -0800)] 
Merge branch 'ds/commit-graph-merging-fix'

When "git commit-graph" detects the same commit recorded more than
once while it is merging the layers, it used to die.  The code now
ignores all but one of them and continues.

* ds/commit-graph-merging-fix:
  commit-graph: don't write commit-graph when disabled
  commit-graph: ignore duplicates when merging layers

3 years agoMerge branch 'es/test-cmp-typocatcher'
Junio C Hamano [Mon, 2 Nov 2020 21:17:38 +0000 (13:17 -0800)] 
Merge branch 'es/test-cmp-typocatcher'

A test helper "test_cmp A B" was taught to diagnose missing files A
or B as a bug in test, but some tests legitimately wanted to notice
a failure to even create file B as an error, in addition to leaving
the expected result in it, and were misdiagnosed as a bug.  This
has been corrected.

* es/test-cmp-typocatcher:
  Revert "test_cmp: diagnose incorrect arguments"

3 years agoMerge branch 'jk/fast-import-marks-alloc-fix'
Junio C Hamano [Mon, 2 Nov 2020 21:17:37 +0000 (13:17 -0800)] 
Merge branch 'jk/fast-import-marks-alloc-fix'

"git fast-import" wasted a lot of memory when many marks were in use.

* jk/fast-import-marks-alloc-fix:
  fast-import: fix over-allocation of marks storage

3 years agoMerge branch 'js/avoid-split-sideband-message'
Junio C Hamano [Mon, 2 Nov 2020 21:17:37 +0000 (13:17 -0800)] 
Merge branch 'js/avoid-split-sideband-message'

The side-band status report can be sent at the same time as the
primary payload multiplexed, but the demultiplexer on the receiving
end incorrectly split a single status report into two, which has
been corrected.

* js/avoid-split-sideband-message:
  test-pkt-line: drop colon from sideband identity
  sideband: report unhandled incomplete sideband messages as bugs
  sideband: avoid reporting incomplete sideband messages

3 years agot5411: finish preparing for `main` being the default branch name
Johannes Schindelin [Sat, 31 Oct 2020 19:46:03 +0000 (19:46 +0000)] 
t5411: finish preparing for `main` being the default branch name

In addition to the trivial search-and-replace performed over the course
of the previous three commits, there is one test in t5411 that depends
on the length of the default branch name.

Adjust it and use `main` as the default branch name in this test.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot5411: adjust the remaining support files for init.defaultBranch=main
Johannes Schindelin [Sat, 31 Oct 2020 19:46:02 +0000 (19:46 +0000)] 
t5411: adjust the remaining support files for init.defaultBranch=main

This trick was performed via

$ sed -i -e 's/master/main/g' -e 's/MASTER/MAIN/g' \
-e 's/Master/Main/g' -- t/t5411/*

In the previous commit, we adjusted roughly half of the support files,
to stay under the 100kB limit (mails larger than that are rejected by
the Git mailing list).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot5411: start adjusting the support files for init.defaultBranch=main
Johannes Schindelin [Sat, 31 Oct 2020 19:46:01 +0000 (19:46 +0000)] 
t5411: start adjusting the support files for init.defaultBranch=main

This trick was performed via

$ sed -i -e 's/master/main/g' -e 's/MASTER/MAIN/g' \
-e 's/Master/Main/g' -- t/t5411/test-00[3-5]*

We do not convert the files in `t/t5411/` in one go because the patch
would be too big (mails larger than 100kB are rejected by the Git
mailing list). Instead, we start with roughly half of the support files.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot5411: start using the default branch name "main"
Johannes Schindelin [Sat, 31 Oct 2020 19:46:00 +0000 (19:46 +0000)] 
t5411: start using the default branch name "main"

This is a straight-forward search-and-replace in the test script;
However, this is not yet complete because it requires many more
replacements in `t/t5411/`, too many for a single patch (the Git mailing
list rejects mails larger than 100kB). For that reason, we disable this
test script temporarily via the `PREPARE_FOR_MAIN_BRANCH` prereq.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agodoc/diff-options: fix out of place mentions of '--patch/-p'
Sergey Organov [Sat, 31 Oct 2020 19:37:34 +0000 (22:37 +0300)] 
doc/diff-options: fix out of place mentions of '--patch/-p'

First, references to --patch and -p appeared in the description of
git-format-patch, where the options themselves are not included.

Next, the description of --unified option elsewhere had duplicate implied
statements: "Implies --patch. Implies -p."

Signed-off-by: Sergey Organov <sorganov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoSecond batch
Junio C Hamano [Fri, 30 Oct 2020 20:04:01 +0000 (13:04 -0700)] 
Second batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'js/ci-ghwf-dedup-tests'
Junio C Hamano [Fri, 30 Oct 2020 20:04:24 +0000 (13:04 -0700)] 
Merge branch 'js/ci-ghwf-dedup-tests'

GitHub Actions automated test improvement to skip tests on a tree
identical to what has already been tested.

* js/ci-ghwf-dedup-tests:
  ci: make the "skip-if-redundant" check more defensive
  ci: work around old records of GitHub runs

3 years agoMerge branch 'dl/resurrect-update-for-sha256'
Junio C Hamano [Fri, 30 Oct 2020 20:04:24 +0000 (13:04 -0700)] 
Merge branch 'dl/resurrect-update-for-sha256'

"git resurrect" script (in contrib/) learned that the object names
may be longer than 40-hex depending on the hash function in use.

* dl/resurrect-update-for-sha256:
  contrib/git-resurrect.sh: use hash-agnostic OID pattern
  contrib/git-resurrect.sh: indent with tabs

3 years agoMerge branch 'cm/t7xxx-cleanup'
Junio C Hamano [Fri, 30 Oct 2020 20:04:24 +0000 (13:04 -0700)] 
Merge branch 'cm/t7xxx-cleanup'

Micro clean-up.

* cm/t7xxx-cleanup:
  t7102: prepare expected output inside test_expect_* block
  t7201: put each command on a separate line
  t7201: use 'git -C' to avoid subshell
  t7102,t7201: remove whitespace after redirect operator
  t7102,t7201: remove unnecessary blank spaces in test body
  t7101,t7102,t7201: modernize test formatting

3 years agoMerge branch 'ct/t0000-use-test-path-is-file'
Junio C Hamano [Fri, 30 Oct 2020 20:04:24 +0000 (13:04 -0700)] 
Merge branch 'ct/t0000-use-test-path-is-file'

Micro clean-up of a test script.

* ct/t0000-use-test-path-is-file:
  t0000: use test_path_is_file instead of "test -f"

3 years agoMerge branch 'en/t7518-unflake'
Junio C Hamano [Fri, 30 Oct 2020 20:04:23 +0000 (13:04 -0700)] 
Merge branch 'en/t7518-unflake'

Work around flakiness in a test.

* en/t7518-unflake:
  t7518: fix flaky grep invocation

3 years agoSync with Git 2.29.2
Junio C Hamano [Thu, 29 Oct 2020 21:25:15 +0000 (14:25 -0700)] 
Sync with Git 2.29.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoGit 2.29.2 v2.29.2
Junio C Hamano [Thu, 29 Oct 2020 21:24:09 +0000 (14:24 -0700)] 
Git 2.29.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'cc/doc-filter-branch-typofix' into maint
Junio C Hamano [Thu, 29 Oct 2020 21:18:48 +0000 (14:18 -0700)] 
Merge branch 'cc/doc-filter-branch-typofix' into maint

Docfix.

* cc/doc-filter-branch-typofix:
  filter-branch doc: fix filter-repo typo

3 years agoMerge branch 'jk/committer-date-is-author-date-fix' into maint
Junio C Hamano [Thu, 29 Oct 2020 21:18:47 +0000 (14:18 -0700)] 
Merge branch 'jk/committer-date-is-author-date-fix' into maint

In 2.29, "--committer-date-is-author-date" option of "rebase" and
"am" subcommands lost the e-mail address by mistake, which has been
corrected.

* jk/committer-date-is-author-date-fix:
  rebase: fix broken email with --committer-date-is-author-date
  am: fix broken email with --committer-date-is-author-date
  t3436: check --committer-date-is-author-date result more carefully

3 years agolog, show: add tests for messages containing CRLF
Philippe Blain [Thu, 29 Oct 2020 12:48:29 +0000 (12:48 +0000)] 
log, show: add tests for messages containing CRLF

A previous commit adjusted the code in ref-filter.c so that messages
containing CRLF are now correctly parsed and displayed.

Add tests to also check that `git log` and `git show` correctly handle
such messages, to prevent futur regressions if these commands are
refactored to use the ref-filter API.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoref-filter: handle CRLF at end-of-line more gracefully
Philippe Blain [Thu, 29 Oct 2020 12:48:28 +0000 (12:48 +0000)] 
ref-filter: handle CRLF at end-of-line more gracefully

The ref-filter code does not correctly handle commit or tag messages
that use CRLF as the line terminator. Such messages can be created with
the `--cleanup=verbatim` option of `git commit` and `git tag`, or by
using `git commit-tree` directly.

The function `find_subpos` in ref-filter.c looks for two consecutive
LFs to find the end of the subject line, a sequence which is absent in
messages using CRLF. This results in the whole message being parsed as
the subject line (`%(contents:subject)`), and the body of the message
(`%(contents:body)`) being empty.

Moreover, in `copy_subject`, which wants to return the subject as a
single line, '\n' is replaced by space, but '\r' is
untouched.

This impacts the output of `git branch`, `git tag` and `git
for-each-ref`.

This behaviour is a regression for `git branch --verbose`, which
bisects down to 949af0684c (branch: use ref-filter printing APIs,
2017-01-10).

Adjust the ref-filter code to be more lenient by hardening the logic in
`copy_subject` and `find_subpos` to correctly parse messages containing
CRLF.

Add a new test script, 't3920-crlf-messages.sh', to test the behaviour
of commands using either the ref-filter or the pretty APIs with messages
using CRLF line endings. The function `test_crlf_subject_body_and_contents`
can be used to test that the `--format` option of `branch`, `tag`,
`for-each-ref`, `log` and `show` correctly displays the subject, body
and raw content of commit and tag messages using CRLF. Test the
output of `branch`, `tag` and `for-each-ref` with such commits.

Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agosideband: diagnose more sideband anomalies
Jeff King [Wed, 28 Oct 2020 09:33:24 +0000 (05:33 -0400)] 
sideband: diagnose more sideband anomalies

In demultiplex_sideband(), there are two oddities when we check an
incoming packet:

  - if it has zero length, then we assume it's a flush packet. This
    means we fail to notice the difference between a real flush and a
    true zero-length packet that's missing its sideband designator. It's
    not a huge problem in practice because we'd never send a zero-length
    data packet (even our keepalives are otherwise-empty sideband-1
    packets).

    But it would be nice to detect and report the error, since it's
    likely to cause other confusion (we think the other side flushed,
    but they do not).

  - we try to detect packets missing their designator by checking for
    "if (len < 1)". But this will never trigger for "len == 0"; we've
    already detected that and left the function before then.

    It _could_ detect a negative "len" parameter. But in that case, the
    error message is wrong. The issue is not "no sideband" but rather
    "eof while reading the packet". However, this can't actually be
    triggered in practice, because neither of the two callers uses
    pkt_read's GENTLE_ON_EOF flag. Which means they'd die with "the
    remote end hung up unexpectedly" before we even get here.

    So this truly is dead code.

We can improve these cases by passing in a pkt-line status to the
demultiplexer, and by having recv_sideband() use GENTLE_ON_EOF. This
gives us two improvements:

  - we can now reliably detect flush packets, and will report a normal
    packet missing its sideband designator as an error

  - we'll report an eof with a more detailed "protocol error: eof while
    reading sideband packet", rather than the generic "the remote end
    hung up unexpectedly"

  - when we see an eof, we'll flush the sideband scratch buffer, which
    may provide some hints from the remote about why they hung up
    (though note we already flush on newlines, so it's likely that most
    such messages already made it through)

In some sense this patch goes against fbd76cd450 (sideband: reverse its
dependency on pkt-line, 2019-01-16), which caused the sideband code not
to depend on the pkt-line code. But that commit was really just trying
to deal with the circular header dependency. The two modules are
conceptually interlinked, and it was just trying to keep things
compiling. And indeed, there's a sticking point in this patch: because
pkt-line.h includes sideband.h, we can't add the reverse include we need
for the sideband code to have an "enum packet_read_status" parameter.
Nor can we forward declare it, because you can't forward declare an enum
in C. However, C does guarantee that enums fit in an int, so we can just
use that type.

One alternative would be for the callers to check themselves that they
got something sane from the pkt-line code. But besides duplicating
logic, this gets quite tricky. Any error condition requires flushing the
sideband #2 scratch buffer, which only demultiplex_sideband() knows how
to do.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agozsh: update copyright notices
Felipe Contreras [Wed, 28 Oct 2020 02:07:12 +0000 (20:07 -0600)] 
zsh: update copyright notices

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocompletion: bash: remove old compat wrappers
Felipe Contreras [Wed, 28 Oct 2020 02:07:11 +0000 (20:07 -0600)] 
completion: bash: remove old compat wrappers

It's been eight years, more than enough time to move on.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocompletion: bash: cleanup cygwin check
Felipe Contreras [Wed, 28 Oct 2020 02:07:10 +0000 (20:07 -0600)] 
completion: bash: cleanup cygwin check

Avoid Yoda conditions, and use $OSTYPE.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocompletion: bash: trivial cleanup
Felipe Contreras [Wed, 28 Oct 2020 02:07:09 +0000 (20:07 -0600)] 
completion: bash: trivial cleanup

There's no need to set a variable we are not going to use.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocompletion: zsh: add simple version check
Felipe Contreras [Wed, 28 Oct 2020 02:07:08 +0000 (20:07 -0600)] 
completion: zsh: add simple version check

A lot of people are confused about which completion script they are
using; Zsh's Git script, or Git's Zsh script.

Add a simple helper so they can type 'git zsh<tab>' and find out if they
are running the correct one: this.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocompletion: zsh: trivial simplification
Felipe Contreras [Wed, 28 Oct 2020 02:07:07 +0000 (20:07 -0600)] 
completion: zsh: trivial simplification

>From upstream bash simplification:

  d9ee1e0617 (completion: simplify inner 'case' pattern in __gitcomp())

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocompletion: zsh: add alias descriptions
Felipe Contreras [Wed, 28 Oct 2020 02:07:06 +0000 (20:07 -0600)] 
completion: zsh: add alias descriptions

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocompletion: zsh: improve command tags
Felipe Contreras [Wed, 28 Oct 2020 02:07:05 +0000 (20:07 -0600)] 
completion: zsh: improve command tags

There's no need to use _alternative and repeat a lot of the code.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocompletion: zsh: refactor command completion
Felipe Contreras [Wed, 28 Oct 2020 02:07:04 +0000 (20:07 -0600)] 
completion: zsh: refactor command completion

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocompletion: zsh: shuffle functions around
Felipe Contreras [Wed, 28 Oct 2020 02:07:03 +0000 (20:07 -0600)] 
completion: zsh: shuffle functions around

Just to have a nice order.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocompletion: zsh: simplify file_direct
Felipe Contreras [Wed, 28 Oct 2020 02:07:02 +0000 (20:07 -0600)] 
completion: zsh: simplify file_direct

It's exactly the same as __gitcomp_file() with no prefix.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocompletion: zsh: simplify nl_append
Felipe Contreras [Wed, 28 Oct 2020 02:07:01 +0000 (20:07 -0600)] 
completion: zsh: simplify nl_append

It's exactly the same as __gitcomp_nl(), no need to duplicate code.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocompletion: zsh: trivial cleanup
Felipe Contreras [Wed, 28 Oct 2020 02:07:00 +0000 (20:07 -0600)] 
completion: zsh: trivial cleanup

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocompletion: zsh: simplify direct compadd
Felipe Contreras [Wed, 28 Oct 2020 02:06:59 +0000 (20:06 -0600)] 
completion: zsh: simplify direct compadd

Instead of manually removing the suffix so zsh can add its own, we can
tell zsh to add no suffix, so we don't have to remove it.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocompletion: zsh: simplify compadd functions
Felipe Contreras [Wed, 28 Oct 2020 02:06:58 +0000 (20:06 -0600)] 
completion: zsh: simplify compadd functions

We don't need to override IFS, zsh has a native way of splitting by new
lines: the expansion flag (f).

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocompletion: zsh: fix splitting of words
Felipe Contreras [Wed, 28 Oct 2020 02:06:57 +0000 (20:06 -0600)] 
completion: zsh: fix splitting of words

Files don't need to be split by '=:', words do.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocompletion: zsh: add missing direct_append
Felipe Contreras [Wed, 28 Oct 2020 02:06:56 +0000 (20:06 -0600)] 
completion: zsh: add missing direct_append

Commit 688077910b forgot to add the corresponding zsh function.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocompletion: fix conflict with bashcomp
Felipe Contreras [Wed, 28 Oct 2020 02:06:55 +0000 (20:06 -0600)] 
completion: fix conflict with bashcomp

We don't want to override the 'complete()' function in zsh, which can be
used by bashcomp.

Reported-by: Mark Lodato <lodato@google.com>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocompletion: zsh: fix completion for --no-.. options
Felipe Contreras [Wed, 28 Oct 2020 02:06:54 +0000 (20:06 -0600)] 
completion: zsh: fix completion for --no-.. options

This was introduced in upstream's bash script, but never in zsh's:

  b221b5ab9b (completion: collapse extra --no-.. options)

It has been failing since v2.19.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocompletion: bash: remove zsh wrapper
Felipe Contreras [Wed, 28 Oct 2020 02:06:53 +0000 (20:06 -0600)] 
completion: bash: remove zsh wrapper

It has been deprecated for more than eight years now, it's never up to
date, and it's a hassle to maintain.

It's time to move on.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocompletion: bash: synchronize zsh wrapper
Felipe Contreras [Wed, 28 Oct 2020 02:06:52 +0000 (20:06 -0600)] 
completion: bash: synchronize zsh wrapper

A function was missing.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocompletion: zsh: fix for command aliasing
Felipe Contreras [Wed, 28 Oct 2020 02:06:51 +0000 (20:06 -0600)] 
completion: zsh: fix for command aliasing

A lot of people want to define aliases like gc='git commit', and zsh
allows that (when not using 'complete_aliases'), but we need to handle
services that call a function other than the main one.

With this patch we can do:

  compdef _git gc=git_commit

Additionally, add compatibility for Zsh Git functions which have the
form git-commit (with dash, not underscore).

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocompletion: prompt: fix color for Zsh
Felipe Contreras [Wed, 28 Oct 2020 02:06:50 +0000 (20:06 -0600)] 
completion: prompt: fix color for Zsh

We don't need PROMPT_COMMAND in Zsh; we are already using %F{color} %f,
which in turn use %{ and %}, which are the equivalent of Bash's
\[ and \].

We can use as many colors as we want and output directly into PS1
(or RPS1) without the risk of buffer wrapping issues.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocompletion: zsh: update slave script locations
Felipe Contreras [Wed, 28 Oct 2020 02:06:49 +0000 (20:06 -0600)] 
completion: zsh: update slave script locations

Update the default locations of typical system bash-completion,
including the default bash-completion location for user scripts, and the
recommended way to find the system location (with pkg-config).

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoFirst batch
Junio C Hamano [Tue, 27 Oct 2020 05:52:28 +0000 (22:52 -0700)] 
First batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'dl/checkout-guess'
Junio C Hamano [Tue, 27 Oct 2020 22:09:51 +0000 (15:09 -0700)] 
Merge branch 'dl/checkout-guess'

"git checkout" learned to use checkout.guess configuration variable
and enable/disable its "--[no-]guess" option accordingly.

* dl/checkout-guess:
  checkout: learn to respect checkout.guess
  Documentation/config/checkout: replace sq with backticks

3 years agoMerge branch 'dl/checkout-p-merge-base'
Junio C Hamano [Tue, 27 Oct 2020 22:09:50 +0000 (15:09 -0700)] 
Merge branch 'dl/checkout-p-merge-base'

"git checkout -p A...B [-- <path>]" did not work, even though the
same command without "-p" correctly used the merge-base between
commits A and B.

* dl/checkout-p-merge-base:
  t2016: add a NEEDSWORK about the PERL prerequisite
  add-patch: add NEEDSWORK about comparing commits
  Doc: document "A...B" form for <tree-ish> in checkout and switch
  builtin/checkout: fix `git checkout -p HEAD...` bug

3 years agoMerge branch 'sb/clone-origin'
Junio C Hamano [Tue, 27 Oct 2020 22:09:49 +0000 (15:09 -0700)] 
Merge branch 'sb/clone-origin'

"git clone" learned clone.defaultremotename configuration variable
to customize what nickname to use to call the remote the repository
was cloned from.

* sb/clone-origin:
  clone: allow configurable default for `-o`/`--origin`
  clone: read new remote name from remote_name instead of option_origin
  clone: validate --origin option before use
  refs: consolidate remote name validation
  remote: add tests for add and rename with invalid names
  clone: use more conventional config/option layering
  clone: add tests for --template and some disallowed option pairs

3 years agoMerge branch 'sk/force-if-includes'
Junio C Hamano [Tue, 27 Oct 2020 22:09:49 +0000 (15:09 -0700)] 
Merge branch 'sk/force-if-includes'

"git push --force-with-lease[=<ref>]" can easily be misused to lose
commits unless the user takes good care of their own "git fetch".
A new option "--force-if-includes" attempts to ensure that what is
being force-pushed was created after examining the commit at the
tip of the remote ref that is about to be force-replaced.

* sk/force-if-includes:
  t, doc: update tests, reference for "--force-if-includes"
  push: parse and set flag for "--force-if-includes"
  push: add reflog check for "--force-if-includes"

3 years agoMerge branch 'ds/maintenance-part-2'
Junio C Hamano [Tue, 27 Oct 2020 22:09:47 +0000 (15:09 -0700)] 
Merge branch 'ds/maintenance-part-2'

"git maintenance", an extended big brother of "git gc", continues
to evolve.

* ds/maintenance-part-2:
  maintenance: add incremental-repack auto condition
  maintenance: auto-size incremental-repack batch
  maintenance: add incremental-repack task
  midx: use start_delayed_progress()
  midx: enable core.multiPackIndex by default
  maintenance: create auto condition for loose-objects
  maintenance: add loose-objects task
  maintenance: add prefetch task

3 years agoMerge branch 'rs/worktree-list-show-locked'
Junio C Hamano [Tue, 27 Oct 2020 22:09:47 +0000 (15:09 -0700)] 
Merge branch 'rs/worktree-list-show-locked'

"git worktree list" now shows if each worktree is locked.  This
possibly may open us to show other kinds of states in the future.

* rs/worktree-list-show-locked:
  worktree: teach `list` to annotate locked worktree

3 years agoMerge branch 'rs/tighten-callers-of-deref-tag'
Junio C Hamano [Tue, 27 Oct 2020 22:09:46 +0000 (15:09 -0700)] 
Merge branch 'rs/tighten-callers-of-deref-tag'

Code clean-up.

* rs/tighten-callers-of-deref-tag:
  line-log: handle deref_tag() returning NULL
  blame: handle deref_tag() returning NULL
  grep: handle deref_tag() returning NULL

3 years agoMerge branch 'rs/dist-doc-with-git-archive'
Junio C Hamano [Tue, 27 Oct 2020 22:09:46 +0000 (15:09 -0700)] 
Merge branch 'rs/dist-doc-with-git-archive'

Use "git archive" more to produce the release tarball.

* rs/dist-doc-with-git-archive:
  Makefile: remove the unused variable TAR_DIST_EXTRA_OPTS
  Makefile: use git init/add/commit/archive for dist-doc

3 years agoMerge branch 'cw/ci-ghwf-check-ws-errors'
Junio C Hamano [Tue, 27 Oct 2020 22:09:46 +0000 (15:09 -0700)] 
Merge branch 'cw/ci-ghwf-check-ws-errors'

Dev support.

* cw/ci-ghwf-check-ws-errors:
  ci: github action - add check for whitespace errors

3 years agoMerge branch 'sd/userdiff-css-update'
Junio C Hamano [Tue, 27 Oct 2020 22:09:46 +0000 (15:09 -0700)] 
Merge branch 'sd/userdiff-css-update'

Userdiff for CSS update.

* sd/userdiff-css-update:
  userdiff: expand detected chunk headers for css

3 years agoMerge branch 'rk/completion-stash'
Junio C Hamano [Tue, 27 Oct 2020 22:09:46 +0000 (15:09 -0700)] 
Merge branch 'rk/completion-stash'

The command line completion script (in contrib/) learned that "git
stash show" takes the options "git diff" takes.

* rk/completion-stash:
  git-completion.bash: stash-show: complete $__git_diff_common_options
  git-completion.bash: __git_diff_common_options: add --[no-]patch

3 years agoMerge branch 'kb/userdiff-rust-macro-rules'
Junio C Hamano [Tue, 27 Oct 2020 22:09:46 +0000 (15:09 -0700)] 
Merge branch 'kb/userdiff-rust-macro-rules'

Userdiff for Rust update.

* kb/userdiff-rust-macro-rules:
  userdiff: recognize 'macro_rules!' as starting a Rust function block

3 years agoMerge branch 'js/userdiff-php'
Junio C Hamano [Tue, 27 Oct 2020 22:09:46 +0000 (15:09 -0700)] 
Merge branch 'js/userdiff-php'

Userdiff for PHP update.

* js/userdiff-php:
  userdiff: PHP: catch "abstract" and "final" functions

3 years agocheckout-index: propagate errors to exit code
Jeff King [Tue, 27 Oct 2020 07:37:14 +0000 (03:37 -0400)] 
checkout-index: propagate errors to exit code

If we encounter an error while checking out an explicit path, we print a
message to stderr but do not actually exit with a non-zero code. While
this is a plumbing command and the behavior goes all the way back to
33db5f4d90 (Add a "checkout-cache" command which does what the name
suggests., 2005-04-09), this is almost certainly an oversight:

  - we _do_ return an exit code from checkout_file(); the caller just
    never reads it

  - errors while checking out all paths (with "-a") do result in a
    non-zero exit code.

  - it would be quite unusual not to use the exit code for an error,
    as otherwise the caller has no idea the command failed except by
    scraping stderr

To keep our tests simple and portable, we can use the most obvious
error: asking to checkout a path which is not in the index at all.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agocheckout-index: drop error message from empty --stage=all
Jeff King [Tue, 27 Oct 2020 07:36:02 +0000 (03:36 -0400)] 
checkout-index: drop error message from empty --stage=all

If checkout-index is given --stage=all for a specific path, it will try
to write stages 1-3 (if present) for that path to temporary files.
However, if the file is present only at stage 0, it writes nothing but
gives a confusing message:

  $ git checkout-index --stage=all -- Makefile
  git checkout-index: Makefile does not exist at stage 4

This is nonsense. There is no stage 4 (it's just an internal enum value
we use for "all"), and the documentation clearly states:

  Paths which only have a stage 0 entry will always be omitted from the
  output.

Here it's talking about the list of tempfiles written to stdout, but it
seems clear that this case was not meant to be an error. We even have a
test which covers it, but it only checks that the command reports an
exit code of 0, not its stderr. And it reports 0 only because of another
bug which fails to propagate errors (which will be fixed in a subsequent
patch).

So let's make the test more thorough. We'll also cover the case that we
found _no_ entry, not even a stage zero, which should still be an error.
However, because of the other bug, we'll have to mark this as expecting
failure for the moment.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agotest-pkt-line: drop colon from sideband identity
Jeff King [Tue, 27 Oct 2020 07:13:09 +0000 (03:13 -0400)] 
test-pkt-line: drop colon from sideband identity

We pass "sideband: " as our identity for errors to recv_sideband(). But
it already adds the trailing colon and space. This doesn't invalidate
any tests, but it looks funny when you examine the test output.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoremote: add meaningful exit code on missing/existing
Ævar Arnfjörð Bjarmason [Tue, 27 Oct 2020 09:41:36 +0000 (10:41 +0100)] 
remote: add meaningful exit code on missing/existing

Change the exit code for the likes of "git remote add/rename" to exit
with 2 if the remote in question doesn't exist, and 3 if it
does. Before we'd just die() and exit with the general 128 exit code.

This changes the output message from e.g.:

    fatal: remote origin already exists.

To:

    error: remote origin already exists.

Which I believe is a feature, since we generally use "fatal" for the
generic errors, and "error" for the more specific ones with a custom
exit code, but this part of the change may break code that already
relies on stderr parsing (not that we ever supported that...).

The motivation for this is a discussion around some code in GitLab's
gitaly which wanted to check this, and had to parse stderr to do so:
https://gitlab.com/gitlab-org/gitaly/-/merge_requests/2695

It's worth noting as an aside that a method of checking this that
doesn't rely on that is to check with "git config" whether the value
in question does or doesn't exist. That introduces a TOCTOU race
condition, but on the other hand this code (e.g. "git remote add")
already has a TOCTOU race.

We go through the config.lock for the actual setting of the config,
but the pseudocode logic is:

    read_config();
    check_config_and_arg_sanity();
    save_config();

So e.g. if a sleep() is added right after the remote_is_configured()
check in add() we'll clobber remote.NAME.url, and add another (usually
duplicate) remote.NAME.fetch entry (and other values, depending on
invocation).

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