]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
19 months agotests(scalar): tighten the stale `scalar.repo` test some
Johannes Schindelin [Thu, 10 Nov 2022 07:28:47 +0000 (07:28 +0000)] 
tests(scalar): tighten the stale `scalar.repo` test some

As pointed out by Stolee, the previous incarnation of this test case was
not stringent enough: we want to verify that _only_ the stale entries
are removed (previously, the test case would have succeeded even if all
entries had been removed).

Let's rectify this and verify that the other entries are left intact.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
19 months agoscalar reconfigure -a: remove stale `scalar.repo` entries
Johannes Schindelin [Mon, 7 Nov 2022 18:25:01 +0000 (18:25 +0000)] 
scalar reconfigure -a: remove stale `scalar.repo` entries

Every once in a while, a Git for Windows installation fails because the
attempt to reconfigure a Scalar enlistment failed because it was deleted
manually without removing the corresponding entries in the global Git
config.

In f5f0842d0b5 (scalar: let 'unregister' handle a deleted enlistment
directory gracefully, 2021-12-03), we already taught `scalar delete` to
handle the case of a manually deleted enlistment gracefully. This patch
adds the same graceful handling to `scalar reconfigure --all`.

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

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
19 months agoThe tenth batch
Taylor Blau [Fri, 4 Nov 2022 00:41:55 +0000 (20:41 -0400)] 
The tenth batch

Signed-off-by: Taylor Blau <me@ttaylorr.com>
19 months agoMerge branch 'jk/avoid-localhost'
Taylor Blau [Fri, 4 Nov 2022 00:41:06 +0000 (20:41 -0400)] 
Merge branch 'jk/avoid-localhost'

Various tests exercising the transfer.credentialsInUrl configuration
are taught to avoid making requests which require resolving localhost
to reduce CI-flakiness.

* jk/avoid-localhost:
  t5516/t5601: be less strict about the number of credential warnings
  t5516: move plaintext-password tests from t5601 and t5516

19 months agot5516/t5601: be less strict about the number of credential warnings
Johannes Schindelin [Tue, 1 Nov 2022 02:26:48 +0000 (22:26 -0400)] 
t5516/t5601: be less strict about the number of credential warnings

It is unclear as to _why_, but under certain circumstances the warning
about credentials being passed as part of the URL seems to be swallowed
by the `git remote-https` helper in the Windows jobs of Git's CI builds.

Since it is not actually important how many times Git prints the
warning/error message, as long as it prints it at least once, let's just
make the test a bit more lenient and test for the latter instead of the
former, which works around these CI issues.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
19 months agot5516: move plaintext-password tests from t5601 and t5516
Jeff King [Tue, 1 Nov 2022 02:26:42 +0000 (22:26 -0400)] 
t5516: move plaintext-password tests from t5601 and t5516

Commit 6dcbdc0d66 (remote: create fetch.credentialsInUrl config,
2022-06-06) added tests for our handling of passwords in URLs. Since the
obvious URL to be affected is git-over-http, the tests use http. However
they don't set up a test server; they just try to access
https://localhost, assuming it will fail (because the nothing is
listening there).

This causes some possible problems:

  - There might be a web server running on localhost, and we do not
    actually want to connect to that.

  - The DNS resolver, or the local firewall, might take a substantial
    amount of time (or forever, whichever comes first) to fail to
    connect, slowing down the tests cases unnecessarily.

  - Since there's no server, our tests for "allow" and "warn" still
    expect the clone/fetch/push operations to fail, even though in the
    real world we'd expect these to succeed. We scrape stderr to see
    what happened, but it's not as robust as a more realistic test.

Let's instead move these to t5551, which is all about testing http and
where we have a real server. That eliminates any issues with contacting
a strange URL, and lets the "allow" and "warn" tests confirm that the
operation actually succeeds.

It's not quite a verbatim move for a few reasons:

  - we can drop the LIBCURL dependency; it's already part of
    lib-httpd.sh

  - we'll use HTTPD_URL_USER_PASS, etc, instead of our fake URL. To
    avoid repetition, we'll add a few extra variables.

  - the "https://username:@localhost" test uses a funny URL that
    lib-httpd.sh doesn't provide. We'll similarly construct it in a
    variable. Note that we're hard-coding the lib-httpd username here,
    but t5551 already does that everywhere.

  - for the "domain:port" test, the URL provided by lib-httpd is fine,
    since our test server will always be on an exotic port. But we'll
    confirm in the test that this is so.

  - since our message-matching is done via grep, I simplified it to use
    a regex, rather than trying to massage lib-httpd's variables.
    Arguably this makes it more readable, too, while retaining the bits
    we care about: the fatal/warning distinction, the "uses plaintext"
    message, and the fact that the password was redacted.

  - we'll use the /auth/ path for the repo, which shows that we are
    indeed making use of the auth information when needed.

  - we'll also use /smart/; most of these tests could be done via /dumb/
    in t5550, but setting up pushes there requires extra effort and
    dependencies. The smart protocol is what most everyone is using
    these days anyway.

This patch is my own, but I stole the analysis and a few bits of the
commit message from a patch by Johannes Schindelin.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
19 months agoThe ninth batch
Taylor Blau [Mon, 31 Oct 2022 01:14:28 +0000 (21:14 -0400)] 
The ninth batch

Signed-off-by: Taylor Blau <me@ttaylorr.com>
19 months agoMerge branch 'jt/skipping-negotiator-wo-recursion'
Taylor Blau [Mon, 31 Oct 2022 01:04:44 +0000 (21:04 -0400)] 
Merge branch 'jt/skipping-negotiator-wo-recursion'

Rewrite a deep recursion in the skipping negotiator to use a loop
with on-heap prio queue to avoid stack wastage.

* jt/skipping-negotiator-wo-recursion:
  negotiator/skipping: avoid stack overflow

19 months agoMerge branch 'jc/doc-fsck-msgids'
Taylor Blau [Mon, 31 Oct 2022 01:04:44 +0000 (21:04 -0400)] 
Merge branch 'jc/doc-fsck-msgids'

Add documentation for message IDs in fsck error messages.

* jc/doc-fsck-msgids:
  Documentation: add lint-fsck-msgids
  fsck: document msg-id
  fsck: remove the unused MISSING_TREE_OBJECT
  fsck: remove the unused BAD_TAG_OBJECT

19 months agoMerge branch 'en/merge-tree-sequence'
Taylor Blau [Mon, 31 Oct 2022 01:04:44 +0000 (21:04 -0400)] 
Merge branch 'en/merge-tree-sequence'

"git merge-tree --stdin" is a new way to request a series of merges
and report the merge results.

* en/merge-tree-sequence:
  merge-tree: support multiple batched merges with --stdin
  merge-tree: update documentation for differences in -z output

19 months agoMerge branch 'ds/bundle-uri-3'
Taylor Blau [Mon, 31 Oct 2022 01:04:43 +0000 (21:04 -0400)] 
Merge branch 'ds/bundle-uri-3'

Define the logical elements of a "bundle list", data structure to
store them in-core, format to transfer them, and code to parse
them.

* ds/bundle-uri-3:
  bundle-uri: suppress stderr from remote-https
  bundle-uri: quiet failed unbundlings
  bundle: add flags to verify_bundle()
  bundle-uri: fetch a list of bundles
  bundle: properly clear all revision flags
  bundle-uri: limit recursion depth for bundle lists
  bundle-uri: parse bundle list in config format
  bundle-uri: unit test "key=value" parsing
  bundle-uri: create "key=value" line parsing
  bundle-uri: create base key-value pair parsing
  bundle-uri: create bundle_list struct and helpers
  bundle-uri: use plain string in find_temp_filename()

19 months agoMerge branch 'rj/branch-do-not-exit-with-minus-one-status'
Taylor Blau [Mon, 31 Oct 2022 01:04:43 +0000 (21:04 -0400)] 
Merge branch 'rj/branch-do-not-exit-with-minus-one-status'

"git branch --edit-description" can exit with status -1 which is
not a good practice; it learned to use 1 as everybody else instead.

* rj/branch-do-not-exit-with-minus-one-status:
  branch: error code with --edit-description

19 months agoMerge branch 'rj/branch-copy-rename-error-codepath-cleanup'
Taylor Blau [Mon, 31 Oct 2022 01:04:43 +0000 (21:04 -0400)] 
Merge branch 'rj/branch-copy-rename-error-codepath-cleanup'

Code simplification.

* rj/branch-copy-rename-error-codepath-cleanup:
  branch: error copying or renaming a detached HEAD

19 months agoMerge branch 'tb/cap-patch-at-1gb'
Taylor Blau [Mon, 31 Oct 2022 01:04:43 +0000 (21:04 -0400)] 
Merge branch 'tb/cap-patch-at-1gb'

"git apply" limits its input to a bit less than 1 GiB.

* tb/cap-patch-at-1gb:
  apply: reject patches larger than ~1 GiB

19 months agoMerge branch 'jr/embargoed-releases-doc'
Taylor Blau [Mon, 31 Oct 2022 01:04:43 +0000 (21:04 -0400)] 
Merge branch 'jr/embargoed-releases-doc'

The role the security mailing list plays in an embargoed release
has been documented.

* jr/embargoed-releases-doc:
  embargoed releases: also describe the git-security list and the process

19 months agoMerge branch 'en/ort-dir-rename-and-symlink-fix'
Taylor Blau [Mon, 31 Oct 2022 01:04:43 +0000 (21:04 -0400)] 
Merge branch 'en/ort-dir-rename-and-symlink-fix'

Merging a branch with directory renames into a branch that changes
the directory to a symlink was mishandled by the ort merge
strategy, which has been corrected.

* en/ort-dir-rename-and-symlink-fix:
  merge-ort: fix bug with dir rename vs change dir to symlink

19 months agoMerge branch 'pb/subtree-split-and-merge-after-squashing-tag-fix'
Taylor Blau [Mon, 31 Oct 2022 01:04:43 +0000 (21:04 -0400)] 
Merge branch 'pb/subtree-split-and-merge-after-squashing-tag-fix'

A bugfix to "git subtree" in its split and merge features.

* pb/subtree-split-and-merge-after-squashing-tag-fix:
  subtree: fix split after annotated tag was squashed merged
  subtree: fix squash merging after annotated tag was squashed merged
  subtree: process 'git-subtree-split' trailer in separate function
  subtree: use named variables instead of "$@" in cmd_pull
  subtree: define a variable before its first use in 'find_latest_squash'
  subtree: prefix die messages with 'fatal'
  subtree: add 'die_incompatible_opt' function to reduce duplication
  subtree: use 'git rev-parse --verify [--quiet]' for better error messages
  test-lib-functions: mark 'test_commit' variables as 'local'

19 months agoMerge branch 'pw/rebase-reflog-fixes'
Taylor Blau [Mon, 31 Oct 2022 01:04:42 +0000 (21:04 -0400)] 
Merge branch 'pw/rebase-reflog-fixes'

Fix some bugs in the reflog messages when rebasing and changes the
reflog messages of "rebase --apply" to match "rebase --merge" with
the aim of making the reflog easier to parse.

* pw/rebase-reflog-fixes:
  rebase: cleanup action handling
  rebase --abort: improve reflog message
  rebase --apply: make reflog messages match rebase --merge
  rebase --apply: respect GIT_REFLOG_ACTION
  rebase --merge: fix reflog message after skipping
  rebase --merge: fix reflog when continuing
  t3406: rework rebase reflog tests
  rebase --apply: remove duplicated code

19 months agoMerge branch 'pw/rebase-keep-base-fixes'
Taylor Blau [Mon, 31 Oct 2022 01:04:42 +0000 (21:04 -0400)] 
Merge branch 'pw/rebase-keep-base-fixes'

"git rebase --keep-base" used to discard the commits that are
already cherry-picked to the upstream, even when "keep-base" meant
that the base, on top of which the history is being rebuilt, does
not yet include these cherry-picked commits.  The --keep-base
option now implies --reapply-cherry-picks and --no-fork-point
options.

* pw/rebase-keep-base-fixes:
  rebase --keep-base: imply --no-fork-point
  rebase --keep-base: imply --reapply-cherry-picks
  rebase: factor out branch_base calculation
  rebase: rename merge_base to branch_base
  rebase: store orig_head as a commit
  rebase: be stricter when reading state files containing oids
  t3416: set $EDITOR in subshell
  t3416: tighten two tests

19 months agoMerge branch 'jh/trace2-timers-and-counters'
Taylor Blau [Mon, 31 Oct 2022 01:04:42 +0000 (21:04 -0400)] 
Merge branch 'jh/trace2-timers-and-counters'

Two new facilities, "timer" and "counter", are introduced to the
trace2 API.

* jh/trace2-timers-and-counters:
  trace2: add global counter mechanism
  trace2: add stopwatch timers
  trace2: convert ctx.thread_name from strbuf to pointer
  trace2: improve thread-name documentation in the thread-context
  trace2: rename the thread_name argument to trace2_thread_start
  api-trace2.txt: elminate section describing the public trace2 API
  tr2tls: clarify TLS terminology
  trace2: use size_t alloc,nr_open_regions in tr2tls_thread_ctx

19 months agoMerge branch 'tb/shortlog-group'
Taylor Blau [Mon, 31 Oct 2022 01:04:42 +0000 (21:04 -0400)] 
Merge branch 'tb/shortlog-group'

"git shortlog" learned to group by the "format" string.

* tb/shortlog-group:
  shortlog: implement `--group=committer` in terms of `--group=<format>`
  shortlog: implement `--group=author` in terms of `--group=<format>`
  shortlog: extract `shortlog_finish_setup()`
  shortlog: support arbitrary commit format `--group`s
  shortlog: extract `--group` fragment for translation
  shortlog: make trailer insertion a noop when appropriate
  shortlog: accept `--date`-related options

19 months agoMerge branch 'rs/absorb-git-dir-simplify'
Taylor Blau [Mon, 31 Oct 2022 01:04:42 +0000 (21:04 -0400)] 
Merge branch 'rs/absorb-git-dir-simplify'

Code simplification by using strvec_pushf() instead of building an
argument in a separate strbuf.

* rs/absorb-git-dir-simplify:
  submodule: use strvec_pushf() for --super-prefix

19 months agoMerge branch 'jk/repack-tempfile-cleanup'
Taylor Blau [Mon, 31 Oct 2022 01:04:42 +0000 (21:04 -0400)] 
Merge branch 'jk/repack-tempfile-cleanup'

The way "git repack" creared temporary files when it received a
signal was prone to deadlocking, which has been corrected.

* jk/repack-tempfile-cleanup:
  t7700: annotate cruft-pack failure with ok=sigpipe
  repack: drop remove_temporary_files()
  repack: use tempfiles for signal cleanup
  repack: expand error message for missing pack files
  repack: populate extension bits incrementally
  repack: convert "names" util bitfield to array

19 months agoMerge branch 'sg/stable-docdep'
Taylor Blau [Mon, 31 Oct 2022 01:04:42 +0000 (21:04 -0400)] 
Merge branch 'sg/stable-docdep'

Make sure generated dependency file is stably sorted to help
developers debugging their build issues.

* sg/stable-docdep:
  Documentation/build-docdep.perl: generate sorted output

19 months agoMerge branch 'sd/doc-smtp-encryption'
Taylor Blau [Mon, 31 Oct 2022 01:04:42 +0000 (21:04 -0400)] 
Merge branch 'sd/doc-smtp-encryption'

* sd/doc-smtp-encryption:
  docs: git-send-email: difference between ssl and tls smtp-encryption

19 months agoMerge branch 'jz/patch-id'
Taylor Blau [Mon, 31 Oct 2022 01:04:41 +0000 (21:04 -0400)] 
Merge branch 'jz/patch-id'

A new "--include-whitespace" option is added to "git patch-id", and
existing bugs in the internal patch-id logic that did not match
what "git patch-id" produces have been corrected.

* jz/patch-id:
  builtin: patch-id: remove unused diff-tree prefix
  builtin: patch-id: add --verbatim as a command mode
  patch-id: fix patch-id for mode changes
  builtin: patch-id: fix patch-id with binary diffs
  patch-id: use stable patch-id for rebases
  patch-id: fix stable patch id for binary / header-only

19 months agoThe eighth batch
Junio C Hamano [Fri, 28 Oct 2022 18:27:01 +0000 (11:27 -0700)] 
The eighth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
19 months agoMerge branch 'tb/diffstat-with-utf8-strwidth'
Junio C Hamano [Fri, 28 Oct 2022 18:26:55 +0000 (11:26 -0700)] 
Merge branch 'tb/diffstat-with-utf8-strwidth'

"git diff --stat" etc. were invented back when everything was ASCII
and strlen() was a way to measure the display width of a string;
adjust them to compute the display width assuming UTF-8 pathnames.

* tb/diffstat-with-utf8-strwidth:
  diff: leave NEEDWORK notes in show_stats() function
  diff.c: use utf8_strwidth() to count display width

19 months agoMerge branch 'mm/git-pm-try-catch-syntax-fix'
Junio C Hamano [Fri, 28 Oct 2022 18:26:54 +0000 (11:26 -0700)] 
Merge branch 'mm/git-pm-try-catch-syntax-fix'

Fix a longstanding syntax error in Git.pm error codepath.

* mm/git-pm-try-catch-syntax-fix:
  Git.pm: trust rev-parse to find bare repositories
  Git.pm: add semicolon after catch statement

19 months agoMerge branch 'tb/remove-unused-pack-bitmap'
Junio C Hamano [Fri, 28 Oct 2022 18:26:54 +0000 (11:26 -0700)] 
Merge branch 'tb/remove-unused-pack-bitmap'

When creating a multi-pack bitmap, remove per-pack bitmap files
unconditionally as they will never be consulted.

* tb/remove-unused-pack-bitmap:
  builtin/repack.c: remove redundant pack-based bitmaps

19 months agoMerge branch 'ab/doc-synopsis-and-cmd-usage'
Junio C Hamano [Fri, 28 Oct 2022 18:26:54 +0000 (11:26 -0700)] 
Merge branch 'ab/doc-synopsis-and-cmd-usage'

The short-help text shown by "git cmd -h" and the synopsis text
shown at the beginning of "git help cmd" have been made more
consistent.

* ab/doc-synopsis-and-cmd-usage: (34 commits)
  tests: assert consistent whitespace in -h output
  tests: start asserting that *.txt SYNOPSIS matches -h output
  doc txt & -h consistency: make "worktree" consistent
  worktree: define subcommand -h in terms of command -h
  reflog doc: list real subcommands up-front
  doc txt & -h consistency: make "commit" consistent
  doc txt & -h consistency: make "diff-tree" consistent
  doc txt & -h consistency: use "[<label>...]" for "zero or more"
  doc txt & -h consistency: make "annotate" consistent
  doc txt & -h consistency: make "stash" consistent
  doc txt & -h consistency: add missing options
  doc txt & -h consistency: use "git foo" form, not "git-foo"
  doc txt & -h consistency: make "bundle" consistent
  doc txt & -h consistency: make "read-tree" consistent
  doc txt & -h consistency: make "rerere" consistent
  doc txt & -h consistency: add missing options and labels
  doc txt & -h consistency: make output order consistent
  doc txt & -h consistency: add or fix optional "--" syntax
  doc txt & -h consistency: fix mismatching labels
  doc SYNOPSIS & -h: use "-" to separate words in labels, not "_"
  ...

19 months agoThe seventh batch
Junio C Hamano [Thu, 27 Oct 2022 22:25:55 +0000 (15:25 -0700)] 
The seventh batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
19 months agoSync with 'maint'
Junio C Hamano [Thu, 27 Oct 2022 22:25:24 +0000 (15:25 -0700)] 
Sync with 'maint'

19 months agoDownmerge a bit more for 2.38.2
Junio C Hamano [Thu, 27 Oct 2022 22:24:23 +0000 (15:24 -0700)] 
Downmerge a bit more for 2.38.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
19 months agoMerge branch 'rs/archive-dedup-printf' into maint-2.38
Junio C Hamano [Thu, 27 Oct 2022 22:24:14 +0000 (15:24 -0700)] 
Merge branch 'rs/archive-dedup-printf' into maint-2.38

Code simplification.

* rs/archive-dedup-printf:
  archive: deduplicate verbose printing

19 months agoMerge branch 'jh/struct-zero-init-with-older-clang' into maint-2.38
Junio C Hamano [Thu, 27 Oct 2022 22:24:13 +0000 (15:24 -0700)] 
Merge branch 'jh/struct-zero-init-with-older-clang' into maint-2.38

Work around older clang that warns against C99 zero initialization
syntax for struct.

* jh/struct-zero-init-with-older-clang:
  config.mak.dev: disable suggest braces error on old clang versions

19 months agoMerge branch 'rs/use-fspathncmp' into maint-2.38
Junio C Hamano [Thu, 27 Oct 2022 22:24:13 +0000 (15:24 -0700)] 
Merge branch 'rs/use-fspathncmp' into maint-2.38

Code clean-up.

* rs/use-fspathncmp:
  dir: use fspathncmp() in pl_hashmap_cmp()

19 months agoMerge branch 'rj/branch-edit-desc-unborn' into maint-2.38
Junio C Hamano [Thu, 27 Oct 2022 22:24:13 +0000 (15:24 -0700)] 
Merge branch 'rj/branch-edit-desc-unborn' into maint-2.38

"git branch --edit-description" on an unborh branch misleadingly
said that no such branch exists, which has been corrected.

* rj/branch-edit-desc-unborn:
  branch: description for non-existent branch errors

19 months agoMerge branch 'pw/remove-rebase-p-test' into maint-2.38
Junio C Hamano [Thu, 27 Oct 2022 22:24:13 +0000 (15:24 -0700)] 
Merge branch 'pw/remove-rebase-p-test' into maint-2.38

Remove outdated test.

* pw/remove-rebase-p-test:
  t3435: remove redundant test case

19 months agoMerge branch 'jc/use-of-uc-in-log-messages' into maint-2.38
Junio C Hamano [Thu, 27 Oct 2022 22:24:13 +0000 (15:24 -0700)] 
Merge branch 'jc/use-of-uc-in-log-messages' into maint-2.38

Clarify that "the sentence after <area>: prefix does not begin with
a capital letter" rule applies only to the commit title.

* jc/use-of-uc-in-log-messages:
  SubmittingPatches: use usual capitalization in the log message body

19 months agoMerge branch 'jc/tmp-objdir' into maint-2.38
Junio C Hamano [Thu, 27 Oct 2022 22:24:12 +0000 (15:24 -0700)] 
Merge branch 'jc/tmp-objdir' into maint-2.38

The code to clean temporary object directories (used for
quarantine) tried to remove them inside its signal handler, which
was a no-no.

* jc/tmp-objdir:
  tmp-objdir: skip clean up when handling a signal

19 months agoMerge branch 'dd/document-runtime-prefix-better' into maint-2.38
Junio C Hamano [Thu, 27 Oct 2022 22:24:12 +0000 (15:24 -0700)] 
Merge branch 'dd/document-runtime-prefix-better' into maint-2.38

Update comment in the Makefile about the RUNTIME_PREFIX config knob.

* dd/document-runtime-prefix-better:
  Makefile: clarify runtime relative gitexecdir

19 months agoMerge branch 'ab/unused-annotation' into maint-2.38
Junio C Hamano [Thu, 27 Oct 2022 22:24:12 +0000 (15:24 -0700)] 
Merge branch 'ab/unused-annotation' into maint-2.38

Compilation fix for ancient compilers.

* ab/unused-annotation:
  git-compat-util.h: GCC deprecated message arg only in GCC 4.5+

19 months agoMerge branch 'tb/midx-repack-ignore-cruft-packs' into maint-2.38
Junio C Hamano [Thu, 27 Oct 2022 22:24:11 +0000 (15:24 -0700)] 
Merge branch 'tb/midx-repack-ignore-cruft-packs' into maint-2.38

"git multi-pack-index repack/expire" used to repack unreachable
cruft into a new pack, which have been corrected.
cf. <63a1c3d4-eff3-af10-4263-058c88e74594@github.com>

* tb/midx-repack-ignore-cruft-packs:
  midx.c: avoid cruft packs with non-zero `repack --batch-size`
  midx.c: remove unnecessary loop condition
  midx.c: replace `xcalloc()` with `CALLOC_ARRAY()`
  midx.c: avoid cruft packs with `repack --batch-size=0`
  midx.c: prevent `expire` from removing the cruft pack
  Documentation/git-multi-pack-index.txt: clarify expire behavior
  Documentation/git-multi-pack-index.txt: fix typo

19 months agoMerge branch 'so/diff-merges-cleanup' into maint-2.38
Junio C Hamano [Thu, 27 Oct 2022 22:24:11 +0000 (15:24 -0700)] 
Merge branch 'so/diff-merges-cleanup' into maint-2.38

Code clean-up.

* so/diff-merges-cleanup:
  diff-merges: clarify log.diffMerges documentation
  diff-merges: cleanup set_diff_merges()
  diff-merges: cleanup func_by_opt()

19 months agoMerge branch 'rj/ref-filter-get-head-description-leakfix' into maint-2.38
Junio C Hamano [Thu, 27 Oct 2022 22:24:11 +0000 (15:24 -0700)] 
Merge branch 'rj/ref-filter-get-head-description-leakfix' into maint-2.38

Leakfix.

* rj/ref-filter-get-head-description-leakfix:
  ref-filter.c: fix a leak in get_head_description

19 months agoMerge branch 'jc/environ-docs' into maint-2.38
Junio C Hamano [Thu, 27 Oct 2022 22:24:09 +0000 (15:24 -0700)] 
Merge branch 'jc/environ-docs' into maint-2.38

Documentation on various Boolean GIT_* environment variables have
been clarified.

* jc/environ-docs:
  environ: GIT_INDEX_VERSION affects not just a new repository
  environ: simplify description of GIT_INDEX_FILE
  environ: GIT_FLUSH should be made a usual Boolean
  environ: explain Boolean environment variables
  environ: document GIT_SSL_NO_VERIFY

19 months agoMakefile: force -O0 when compiling with SANITIZE=leak
Jeff King [Tue, 18 Oct 2022 20:15:33 +0000 (16:15 -0400)] 
Makefile: force -O0 when compiling with SANITIZE=leak

Cherry pick commit d3775de0 (Makefile: force -O0 when compiling with
SANITIZE=leak, 2022-10-18), as otherwise the leak checker at GitHub
Actions CI seems to fail with a false positive.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
19 months agoMerge branch 'js/cmake-updates'
Junio C Hamano [Thu, 27 Oct 2022 21:51:53 +0000 (14:51 -0700)] 
Merge branch 'js/cmake-updates'

Update to build procedure with VS using CMake/CTest.

* js/cmake-updates:
  cmake: increase time-out for a long-running test
  cmake: avoid editing t/test-lib.sh
  add -p: avoid ambiguous signed/unsigned comparison
  cmake: copy the merge tools for testing
  cmake: make it easier to diagnose regressions in CTest runs

19 months agoMerge branch 'nw/t1002-cleanup'
Junio C Hamano [Thu, 27 Oct 2022 21:51:53 +0000 (14:51 -0700)] 
Merge branch 'nw/t1002-cleanup'

Code clean-up in test.

* nw/t1002-cleanup:
  t1002: modernize outdated conditional

19 months agoMerge branch 'ab/run-hook-api-cleanup'
Junio C Hamano [Thu, 27 Oct 2022 21:51:53 +0000 (14:51 -0700)] 
Merge branch 'ab/run-hook-api-cleanup'

Move a global variable added as a hack during regression fixes to
its proper place in the API.

* ab/run-hook-api-cleanup:
  run-command.c: remove "max_processes", add "const" to signal() handler
  run-command.c: pass "opts" further down, and use "opts->processes"
  run-command.c: use "opts->processes", not "pp->max_processes"
  run-command.c: don't copy "data" to "struct parallel_processes"
  run-command.c: don't copy "ungroup" to "struct parallel_processes"
  run-command.c: don't copy *_fn to "struct parallel_processes"
  run-command.c: make "struct parallel_processes" const if possible
  run-command API: move *_tr2() users to "run_processes_parallel()"
  run-command API: have run_process_parallel() take an "opts" struct
  run-command.c: use designated init for pp_init(), add "const"
  run-command API: don't fall back on online_cpus()
  run-command API: make "n" parameter a "size_t"
  run-command tests: use "return", not "exit"
  run-command API: have "run_processes_parallel{,_tr2}()" return void
  run-command test helper: use "else if" pattern

19 months agoMerge branch 'tb/save-keep-pack-during-geometric-repack'
Junio C Hamano [Thu, 27 Oct 2022 21:51:53 +0000 (14:51 -0700)] 
Merge branch 'tb/save-keep-pack-during-geometric-repack'

When geometric repacking feature is in use together with the
--pack-kept-objects option, we lost packs marked with .keep files.

* tb/save-keep-pack-during-geometric-repack:
  repack: don't remove .keep packs with `--pack-kept-objects`

19 months agoMerge branch 'jk/unused-anno-more'
Junio C Hamano [Thu, 27 Oct 2022 21:51:52 +0000 (14:51 -0700)] 
Merge branch 'jk/unused-anno-more'

More UNUSED annotation to help using -Wunused option with the
compiler.

* jk/unused-anno-more:
  ll-merge: mark unused parameters in callbacks
  diffcore-pickaxe: mark unused parameters in pickaxe functions
  convert: mark unused parameter in null stream filter
  apply: mark unused parameters in noop error/warning routine
  apply: mark unused parameters in handlers
  date: mark unused parameters in handler functions
  string-list: mark unused callback parameters
  object-file: mark unused parameters in hash_unknown functions
  mark unused parameters in trivial compat functions
  update-index: drop unused argc from do_reupdate()
  submodule--helper: drop unused argc from module_list_compute()
  diffstat_consume(): assert non-zero length

19 months agoMerge branch 'tb/midx-bitmap-selection-fix'
Junio C Hamano [Thu, 27 Oct 2022 21:51:52 +0000 (14:51 -0700)] 
Merge branch 'tb/midx-bitmap-selection-fix'

A bugfix with tracing support in midx codepath

* tb/midx-bitmap-selection-fix:
  pack-bitmap-write.c: instrument number of reused bitmaps
  midx.c: instrument MIDX and bitmap generation with trace2 regions
  midx.c: consider annotated tags during bitmap selection
  midx.c: fix whitespace typo

19 months agobranch: error code with --edit-description
Rubén Justo [Tue, 25 Oct 2022 22:57:18 +0000 (00:57 +0200)] 
branch: error code with --edit-description

Since c2d17ba3db0d (branch --edit-description: protect against mistyped
branch name, 2012-02-05) we return -1 on error editing the branch
description.

Let's change to 1, which follows the established convention and it is
better for portability reasons.

Signed-off-by: Rubén Justo <rjusto@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
19 months agobranch: error copying or renaming a detached HEAD
Rubén Justo [Tue, 25 Oct 2022 23:01:29 +0000 (01:01 +0200)] 
branch: error copying or renaming a detached HEAD

In c847f53712 (Detached HEAD (experimental), 2007-01-01) an error
condition was introduced in rename_branch() to prevent renaming, later
also copying, a detached HEAD.

The condition used was checking for NULL in oldname, the source branch
to rename/copy.  That condition cannot be satisfied because if no source
branch is specified, HEAD is going to be used in the call.

The error issued instead is:

fatal: Invalid branch name: 'HEAD'

Let's remove the condition in copy_or_rename_branch() (the current
function name) and check for HEAD before calling it, dying with the
original intended error if we're in a detached HEAD.

Signed-off-by: Rubén Justo <rjusto@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
19 months agoSync with 'maint'
Junio C Hamano [Wed, 26 Oct 2022 00:12:09 +0000 (17:12 -0700)] 
Sync with 'maint'

19 months agonegotiator/skipping: avoid stack overflow
Jonathan Tan [Tue, 25 Oct 2022 23:29:34 +0000 (16:29 -0700)] 
negotiator/skipping: avoid stack overflow

mark_common() in negotiator/skipping.c may overflow the stack due to
recursive function calls. Avoid this by instead recursing using a
heap-allocated data structure.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
19 months agoThe sixth batch
Junio C Hamano [Tue, 25 Oct 2022 23:22:28 +0000 (16:22 -0700)] 
The sixth batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
19 months agoMerge branch 'jc/more-sanitizer-at-ci'
Junio C Hamano [Wed, 26 Oct 2022 00:11:44 +0000 (17:11 -0700)] 
Merge branch 'jc/more-sanitizer-at-ci'

Enable address and undefined sanitizer tasks at GitHub Actions CI.

* jc/more-sanitizer-at-ci:
  ci: add address and undefined sanitizer tasks

19 months agoMerge branch 'jc/ci-osx-with-sha1dc'
Junio C Hamano [Wed, 26 Oct 2022 00:11:44 +0000 (17:11 -0700)] 
Merge branch 'jc/ci-osx-with-sha1dc'

Give a bit more diversity to macOS CI by using sha1dc in one of the
jobs (the other one tests Apple Common Crypto).

* jc/ci-osx-with-sha1dc:
  ci: use DC_SHA1=YesPlease on osx-clang job for CI

19 months agoMerge branch 'gc/bare-repo-discovery'
Junio C Hamano [Wed, 26 Oct 2022 00:11:44 +0000 (17:11 -0700)] 
Merge branch 'gc/bare-repo-discovery'

Allow configuration files in "protected" scopes to include other
configuration files.

* gc/bare-repo-discovery:
  config: respect includes in protected config

19 months agoMerge branch 'rs/diff-caret-bang-with-parents'
Junio C Hamano [Wed, 26 Oct 2022 00:11:43 +0000 (17:11 -0700)] 
Merge branch 'rs/diff-caret-bang-with-parents'

"git diff rev^!" did not show combined diff to go to the rev from
its parents.

* rs/diff-caret-bang-with-parents:
  diff: support ^! for merges
  revisions.txt: unspecify order of resolved parts of ^!
  revision: use strtol_i() for exclude_parent

19 months agoDownmerge a handful of topics for 2.38.2
Junio C Hamano [Wed, 26 Oct 2022 00:11:13 +0000 (17:11 -0700)] 
Downmerge a handful of topics for 2.38.2

19 months agoMerge branch 'jk/cleanup-callback-parameters' into maint-2.38
Junio C Hamano [Wed, 26 Oct 2022 00:11:39 +0000 (17:11 -0700)] 
Merge branch 'jk/cleanup-callback-parameters' into maint-2.38

Code clean-up.

* jk/cleanup-callback-parameters:
  attr: drop DEBUG_ATTR code
  commit: avoid writing to global in option callback
  multi-pack-index: avoid writing to global in option callback
  test-submodule: inline resolve_relative_url() function

19 months agoMerge branch 'rs/gc-pack-refs-simplify' into maint-2.38
Junio C Hamano [Wed, 26 Oct 2022 00:11:39 +0000 (17:11 -0700)] 
Merge branch 'rs/gc-pack-refs-simplify' into maint-2.38

Code clean-up.

* rs/gc-pack-refs-simplify:
  gc: simplify maintenance_task_pack_refs()

19 months agoMerge branch 'nb/doc-mergetool-typofix' into maint-2.38
Junio C Hamano [Wed, 26 Oct 2022 00:11:38 +0000 (17:11 -0700)] 
Merge branch 'nb/doc-mergetool-typofix' into maint-2.38

Typofix.

* nb/doc-mergetool-typofix:
  mergetool.txt: typofix 'overwriten' -> 'overwritten'

19 months agoMerge branch 'jk/sequencer-missing-author-name-check' into maint-2.38
Junio C Hamano [Wed, 26 Oct 2022 00:11:38 +0000 (17:11 -0700)] 
Merge branch 'jk/sequencer-missing-author-name-check' into maint-2.38

Typofix in code.

* jk/sequencer-missing-author-name-check:
  sequencer: detect author name errors in read_author_script()

19 months agoMerge branch 'ds/bundle-uri-docfix' into maint-2.38
Junio C Hamano [Wed, 26 Oct 2022 00:11:37 +0000 (17:11 -0700)] 
Merge branch 'ds/bundle-uri-docfix' into maint-2.38

Doc formatting fix.

* ds/bundle-uri-docfix:
  bundle-uri: fix technical doc issues

19 months agoMerge branch 'ab/test-malloc-with-sanitize-leak' into maint-2.38
Junio C Hamano [Wed, 26 Oct 2022 00:11:37 +0000 (17:11 -0700)] 
Merge branch 'ab/test-malloc-with-sanitize-leak' into maint-2.38

Test fix.

* ab/test-malloc-with-sanitize-leak:
  test-lib: have SANITIZE=leak imply TEST_NO_MALLOC_CHECK

19 months agoMerge branch 'rs/bisect-start-leakfix' into maint-2.38
Junio C Hamano [Wed, 26 Oct 2022 00:11:37 +0000 (17:11 -0700)] 
Merge branch 'rs/bisect-start-leakfix' into maint-2.38

Code clean-up that results in plugging a leak.

* rs/bisect-start-leakfix:
  bisect--helper: plug strvec leak

19 months agoMerge branch 'jc/branch-description-unset' into maint-2.38
Junio C Hamano [Wed, 26 Oct 2022 00:11:37 +0000 (17:11 -0700)] 
Merge branch 'jc/branch-description-unset' into maint-2.38

"GIT_EDITOR=: git branch --edit-description" resulted in failure,
which has been corrected.

* jc/branch-description-unset:
  branch: do not fail a no-op --edit-desc

19 months agoMerge branch 'pw/ssh-sign-report-errors' into maint-2.38
Junio C Hamano [Wed, 26 Oct 2022 00:11:35 +0000 (17:11 -0700)] 
Merge branch 'pw/ssh-sign-report-errors' into maint-2.38

The codepath to sign learned to report errors when it fails to read
from "ssh-keygen".

* pw/ssh-sign-report-errors:
  ssh signing: return an error when signature cannot be read

19 months agoMerge branch 'pw/mailinfo-b-fix' into maint-2.38
Junio C Hamano [Wed, 26 Oct 2022 00:11:35 +0000 (17:11 -0700)] 
Merge branch 'pw/mailinfo-b-fix' into maint-2.38

Fix a logic in "mailinfo -b" that miscomputed the length of a
substring, which lead to an out-of-bounds access.

* pw/mailinfo-b-fix:
  mailinfo -b: fix an out of bounds access

19 months agoMerge branch 'rs/test-httpd-in-C-locale' into maint-2.38
Junio C Hamano [Wed, 26 Oct 2022 00:11:35 +0000 (17:11 -0700)] 
Merge branch 'rs/test-httpd-in-C-locale' into maint-2.38

Force C locale while running tests around httpd to make sure we can
find expected error messages in the log.

* rs/test-httpd-in-C-locale:
  t/lib-httpd: pass LANG and LC_ALL to Apache

19 months agoMerge branch 'js/merge-ort-in-read-only-repo' into maint-2.38
Junio C Hamano [Wed, 26 Oct 2022 00:11:34 +0000 (17:11 -0700)] 
Merge branch 'js/merge-ort-in-read-only-repo' into maint-2.38

In read-only repositories, "git merge-tree" tried to come up with a
merge result tree object, which it failed (which is not wrong) and
led to a segfault (which is bad), which has been corrected.

* js/merge-ort-in-read-only-repo:
  merge-ort: return early when failing to write a blob
  merge-ort: fix segmentation fault in read-only repositories

19 months agoMerge branch 'ja/rebase-i-avoid-amending-self' into maint-2.38
Junio C Hamano [Wed, 26 Oct 2022 00:11:34 +0000 (17:11 -0700)] 
Merge branch 'ja/rebase-i-avoid-amending-self' into maint-2.38

"git rebase -i" can mistakenly attempt to apply a fixup to a commit
itself, which has been corrected.

* ja/rebase-i-avoid-amending-self:
  sequencer: avoid dropping fixup commit that targets self via commit-ish

19 months agoMerge branch 'jk/fsck-on-diet' into maint-2.38
Junio C Hamano [Wed, 26 Oct 2022 00:11:33 +0000 (17:11 -0700)] 
Merge branch 'jk/fsck-on-diet' into maint-2.38

"git fsck" failed to release contents of tree objects already used
from the memory, which has been fixed.

* jk/fsck-on-diet:
  parse_object_buffer(): respect save_commit_buffer
  fsck: turn off save_commit_buffer
  fsck: free tree buffers after walking unreachable objects

19 months agoMerge branch 'ah/fsmonitor-daemon-usage-non-l10n' into maint-2.38
Junio C Hamano [Wed, 26 Oct 2022 00:11:33 +0000 (17:11 -0700)] 
Merge branch 'ah/fsmonitor-daemon-usage-non-l10n' into maint-2.38

Fix messages incorrectly marked for translation.

* ah/fsmonitor-daemon-usage-non-l10n:
  fsmonitor--daemon: don't translate literal commands

19 months agoMerge branch 'jk/clone-allow-bare-and-o-together' into maint-2.38
Junio C Hamano [Wed, 26 Oct 2022 00:11:33 +0000 (17:11 -0700)] 
Merge branch 'jk/clone-allow-bare-and-o-together' into maint-2.38

"git clone" did not like to see the "--bare" and the "--origin"
options used together without a good reason.

* jk/clone-allow-bare-and-o-together:
  clone: allow "--bare" with "-o"

19 months agoMerge branch 'jk/remote-rename-without-fetch-refspec' into maint-2.38
Junio C Hamano [Wed, 26 Oct 2022 00:11:32 +0000 (17:11 -0700)] 
Merge branch 'jk/remote-rename-without-fetch-refspec' into maint-2.38

"git remote rename" failed to rename a remote without fetch
refspec, which has been corrected.

* jk/remote-rename-without-fetch-refspec:
  remote: handle rename of remote without fetch refspec

19 months agoMerge branch 'vd/fix-unaligned-read-index-v4' into maint-2.38
Junio C Hamano [Wed, 26 Oct 2022 00:11:32 +0000 (17:11 -0700)] 
Merge branch 'vd/fix-unaligned-read-index-v4' into maint-2.38

The codepath that reads from the index v4 had unaligned memory
accesses, which has been corrected.

* vd/fix-unaligned-read-index-v4:
  read-cache: avoid misaligned reads in index v4

19 months agoMerge branch 'ab/coding-guidelines-c99' into maint-2.38
Junio C Hamano [Wed, 26 Oct 2022 00:11:32 +0000 (17:11 -0700)] 
Merge branch 'ab/coding-guidelines-c99' into maint-2.38

Update CodingGuidelines to clarify what features to use and avoid
in C99.

* ab/coding-guidelines-c99:
  CodingGuidelines: recommend against unportable C99 struct syntax
  CodingGuidelines: mention C99 features we can't use
  CodingGuidelines: allow declaring variables in for loops
  CodingGuidelines: mention dynamic C99 initializer elements
  CodingGuidelines: update for C99

19 months agoDocumentation: add lint-fsck-msgids
Junio C Hamano [Tue, 25 Oct 2022 22:42:24 +0000 (15:42 -0700)] 
Documentation: add lint-fsck-msgids

During the initial development of the fsck-msgids.txt feature, it
has become apparent that it is very much error prone to make sure
the description in the documentation file are sorted and correctly
match what is in the fsck.h header file.

Add a quick-and-dirty Perl script and doc-lint target to sanity
check that the fsck-msgids.txt is consistent with the error type
list in the fsck.h header file.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
19 months agofsck: document msg-id
John Cai [Tue, 25 Oct 2022 22:42:23 +0000 (15:42 -0700)] 
fsck: document msg-id

The documentation lacks mention of specific <msg-id> that are supported.
While git-help --config will display a list of these options, often
developers' first instinct is to consult the git docs to find valid
config values.

Add a list of fsck error messages, and link to it from the git-fsck
documentation.

Signed-off-by: John Cai <johncai86@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
19 months agofsck: remove the unused MISSING_TREE_OBJECT
Junio C Hamano [Tue, 25 Oct 2022 22:42:22 +0000 (15:42 -0700)] 
fsck: remove the unused MISSING_TREE_OBJECT

This error type has never been used since it was introduced at
159e7b08 (fsck: detect gitmodules files, 2018-05-02).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
19 months agofsck: remove the unused BAD_TAG_OBJECT
John Cai [Tue, 25 Oct 2022 22:42:21 +0000 (15:42 -0700)] 
fsck: remove the unused BAD_TAG_OBJECT

2175a0c6 (fsck: stop checking tag->tagged, 2019-10-18) stopped
checking the tagged object referred to by a tag object, which is what the
error message BAD_TAG_OBJECT was for. Since then the BAD_TAG_OBJECT
message is no longer used anywhere.

Remove the BAD_TAG_OBJECT msg-id.

Signed-off-by: John Cai <johncai86@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
19 months agoapply: reject patches larger than ~1 GiB
Taylor Blau [Tue, 25 Oct 2022 18:24:31 +0000 (14:24 -0400)] 
apply: reject patches larger than ~1 GiB

The apply code is not prepared to handle extremely large files. It uses
"int" in some places, and "unsigned long" in others.

This combination leads to unfortunate problems when switching between
the two types. Using "int" prevents us from handling large files, since
large offsets will wrap around and spill into small negative values,
which can result in wrong behavior (like accessing the patch buffer with
a negative offset).

Converting from "unsigned long" to "int" also has truncation problems
even on LLP64 platforms where "long" is the same size as "int", since
the former is unsigned but the latter is not.

To avoid potential overflow and truncation issues in `git apply`, apply
similar treatment as in dcd1742e56 (xdiff: reject files larger than
~1GB, 2015-09-24), where the xdiff code was taught to reject large
files for similar reasons.

The maximum size was chosen somewhat arbitrarily, but picking a value
just shy of a gigabyte allows us to double it without overflowing 2^31-1
(after which point our value would wrap around to a negative number).
To give ourselves a bit of extra margin, the maximum patch size is a MiB
smaller than a full GiB, which gives us some slop in case we allocate
"(records + 1) * sizeof(int)" or similar.

Luckily, the security implications of these conversion issues are
relatively uninteresting, because a victim needs to be convinced to
apply a malicious patch.

Reported-by: 정재우 <thebound7@gmail.com>
Suggested-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
19 months agoembargoed releases: also describe the git-security list and the process
Julia Ramer [Mon, 24 Oct 2022 22:07:19 +0000 (22:07 +0000)] 
embargoed releases: also describe the git-security list and the process

With the recent turnover on the git-security list, questions came up how
things are usually run. Rather than answering questions individually,
extend Git's existing documentation about security vulnerabilities to
describe the git-security mailing list, how things are run on that list,
and what to expect throughout the process from the time a security bug
is reported all the way to the time when a fix is released.

Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Julia Ramer <gitprplr@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
19 months agobuiltin: patch-id: remove unused diff-tree prefix
Jerry Zhang [Mon, 24 Oct 2022 20:07:44 +0000 (20:07 +0000)] 
builtin: patch-id: remove unused diff-tree prefix

The last git version that had "diff-tree" in the header text
of "git diff-tree" output was v1.3.0 from 2006. The header text
was changed from "diff-tree" to "commit" in 91539833
("Log message printout cleanups").

Given how long ago this change was made, it is highly unlikely that
anyone is still feeding in outputs from that git version.

Remove the handling of the "diff-tree" prefix and document the
source of the other prefixes so that the overall functionality
is more clear.

Signed-off-by: Jerry Zhang <Jerry@skydio.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
19 months agobuiltin: patch-id: add --verbatim as a command mode
Jerry Zhang [Mon, 24 Oct 2022 20:07:43 +0000 (20:07 +0000)] 
builtin: patch-id: add --verbatim as a command mode

There are situations where the user might not want the default
setting where patch-id strips all whitespace. They might be working
in a language where white space is syntactically important, or they
might have CI testing that enforces strict whitespace linting. In
these cases, a whitespace change would result in the patch
fundamentally changing, and thus deserving of a different id.

Add a new mode that is exclusive of --stable and --unstable called
--verbatim. It also corresponds to the config
patchid.verbatim = true. In this mode, the stable algorithm is
used and whitespace is not stripped from the patch text.

Users of --unstable mainly care about compatibility with old git
versions, which unstripping the whitespace would break. Thus there
isn't a usecase for the combination of --verbatim and --unstable,
and we don't expose this so as to not add maintainence burden.

Signed-off-by: Jerry Zhang <jerry@skydio.com>
fixes https://github.com/Skydio/revup/issues/2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
19 months agopatch-id: fix patch-id for mode changes
Jerry Zhang [Mon, 24 Oct 2022 20:07:42 +0000 (20:07 +0000)] 
patch-id: fix patch-id for mode changes

Currently patch-id as used in rebase and cherry-pick does not account
for file modes if the file is modified. One consequence of this is
that if you have a local patch that changes modes, but upstream
has applied an outdated version of the patch that doesn't include
that mode change, "git rebase" will drop your local version of the
patch along with your mode changes. It also means that internal
patch-id doesn't produce the same output as the builtin, which does
account for mode changes due to them being part of diff output.

Fix by adding mode to the patch-id if it has changed, in the same
format that would be produced by diff, so that it is compatible
with builtin patch-id.

Signed-off-by: Jerry Zhang <Jerry@skydio.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
19 months agobuiltin: patch-id: fix patch-id with binary diffs
Jerry Zhang [Mon, 24 Oct 2022 20:07:41 +0000 (20:07 +0000)] 
builtin: patch-id: fix patch-id with binary diffs

"git patch-id" currently doesn't produce correct output if the
incoming diff has any binary files. Add logic to get_one_patchid
to handle the different possible styles of binary diff. This
attempts to keep resulting patch-ids identical to what would be
produced by the counterpart logic in diff.c, that is it produces
the id by hashing the a and b oids in succession.

In general we handle binary diffs by first caching the object ids from
the "index" line and using those if we then find an indication
that the diff is binary.

The input could contain patches generated with "git diff --binary". This
currently breaks the parse logic and results in multiple patch-ids
output for a single commit. Here we have to skip the contents of the
patch itself since those do not go into the patch id. --binary
implies --full-index so the object ids are always available.

When the diff is generated with --full-index there is no patch content
to skip over.

When a diff is generated without --full-index or --binary, it will
contain abbreviated object ids. This will still result in a sufficiently
unique patch-id when hashed, but does not match internal patch id
output. We'll call this ok for now as we already need specialized
arguments to diff in order to match internal patch id (namely -U3).

Signed-off-by: Jerry Zhang <Jerry@skydio.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
19 months agopatch-id: use stable patch-id for rebases
Jerry Zhang [Mon, 24 Oct 2022 20:07:40 +0000 (20:07 +0000)] 
patch-id: use stable patch-id for rebases

Git doesn't persist patch-ids during the rebase process, so there is
no need to specifically invoke the unstable variant. Use the stable
logic for all internal patch-id calculations to minimize the number of
code paths and improve test coverage.

Signed-off-by: Jerry Zhang <jerry@skydio.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
19 months agopatch-id: fix stable patch id for binary / header-only
Jerry Zhang [Mon, 24 Oct 2022 20:07:39 +0000 (20:07 +0000)] 
patch-id: fix stable patch id for binary / header-only

Patch-ids for binary patches are found by hashing the object
ids of the before and after objects in succession. However in
the --stable case, there is a bug where hunks are not flushed
for binary and header-only patch ids, which would always result
in a patch-id of 0000. The --unstable case is currently correct.

Reorder the logic to branch into 3 cases for populating the
patch body: header-only which populates nothing, binary which
populates the object ids, and normal which populates the text
diff. All branches will end up flushing the hunk.

Don't populate the ---a/ and +++b/ lines for binary diffs, to correspond
to those lines not being present in the "git diff" text output.
This is necessary because we advertise that the patch-id calculated
internally and used in format-patch is the same that what the
builtin "git patch-id" would produce when piped from a diff.

Update the test to run on both binary and normal files.

Signed-off-by: Jerry Zhang <jerry@skydio.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
19 months agoshortlog: implement `--group=committer` in terms of `--group=<format>`
Taylor Blau [Mon, 24 Oct 2022 18:55:47 +0000 (14:55 -0400)] 
shortlog: implement `--group=committer` in terms of `--group=<format>`

In the same spirit as the previous commit, reimplement
`--group=committer` as a special case of `--group=<format>`, too.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
19 months agoshortlog: implement `--group=author` in terms of `--group=<format>`
Taylor Blau [Mon, 24 Oct 2022 18:55:44 +0000 (14:55 -0400)] 
shortlog: implement `--group=author` in terms of `--group=<format>`

Instead of handling SHORTLOG_GROUP_AUTHOR separately, reimplement it as
a special case of the new `--group=<format>` mode, where the author mode
is a shorthand for `--group='%aN <%aE>'.

Note that we still need to keep the SHORTLOG_GROUP_AUTHOR enum since it
has a different meaning in `read_from_stdin()`, where it is still used
for a different purpose.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
19 months agoshortlog: extract `shortlog_finish_setup()`
Taylor Blau [Mon, 24 Oct 2022 18:55:41 +0000 (14:55 -0400)] 
shortlog: extract `shortlog_finish_setup()`

Extract a function which finishes setting up the shortlog struct for
use. The caller in `make_cover_letter()` does not care about trailer
sorting, so it isn't strictly necessary to add a call there in this
patch.

But the next patch will add additional functionality to the new
`shortlog_finish_setup()` function, which the caller in
`make_cover_letter()` will care about.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
19 months agoshortlog: support arbitrary commit format `--group`s
Taylor Blau [Mon, 24 Oct 2022 18:55:39 +0000 (14:55 -0400)] 
shortlog: support arbitrary commit format `--group`s

In addition to generating a shortlog based on committer, author, or the
identity in one or more specified trailers, it can be useful to generate
a shortlog based on an arbitrary commit format.

This can be used, for example, to generate a distribution of commit
activity over time, like so:

    $ git shortlog --group='%cd' --date='format:%Y-%m' -s v2.37.0..
       117  2022-06
       274  2022-07
       324  2022-08
       263  2022-09
         7  2022-10

Arbitrary commit formats can be used. In fact, `git shortlog`'s default
behavior (to count by commit authors) can be emulated as follows:

    $ git shortlog --group='%aN <%aE>' ...

and future patches will make the default behavior (as well as
`--committer`, and `--group=trailer:<trailer>`) special cases of the
more flexible `--group` option.

Note also that the SHORTLOG_GROUP_FORMAT enum value is used only to
designate that `--group:<format>` is in use when in stdin mode to
declare that the combination is invalid.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
19 months agoshortlog: extract `--group` fragment for translation
Taylor Blau [Mon, 24 Oct 2022 18:55:36 +0000 (14:55 -0400)] 
shortlog: extract `--group` fragment for translation

The subsequent commit will add another unhandled case in
`read_from_stdin()` which will want to use the same message as with
`--group=trailer`.

Extract the "--group=trailer" part from this message so the same
translation key can be used for both cases.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>