summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2023-11-20Git 2.43v2.43.0Junio C Hamano2-56/+70
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-20Merge tag 'l10n-2.43.0-rnd2' of https://github.com/git-l10n/git-poJunio C Hamano10-4753/+5712
l10n-2.43.0-rnd2 * tag 'l10n-2.43.0-rnd2' of https://github.com/git-l10n/git-po: l10n: zh-TW: Git 2.43.0-rc1 l10n: Update German translation l10n: bg.po: Updated Bulgarian translation (5579t) l10n: zh_CN: for git 2.43.0-rc1 l10n: Update Catalan translation l10n: po-id for 2.43 (round 1) l10n: fr: v2.43.0 rnd 2 l10n: update uk localization for v2.43 l10n: sv.po: Update Swedish translation (5579t) l10n: tr: v2.43.0
2023-11-20Merge branch 'vd/glossary-dereference-peel'Junio C Hamano1-14/+35
"To dereference" and "to peel" were sometimes used in in-code comments and documentation but without description in the glossary. * vd/glossary-dereference-peel: glossary: add definitions for dereference & peel
2023-11-20Merge branch 'tz/send-email-helpfix'Junio C Hamano1-2/+2
Typoes in "git send-email -h" have been corrected. * tz/send-email-helpfix: send-email: remove stray characters from usage
2023-11-20Merge branch 'l10n/zh-TW/2023-11-19' of github.com:l10n-tw/git-poJiang Xin1-742/+374
* 'l10n/zh-TW/2023-11-19' of github.com:l10n-tw/git-po: l10n: zh-TW: Git 2.43.0-rc1
2023-11-19l10n: zh-TW: Git 2.43.0-rc1Yi-Jyun Pan1-742/+374
Signed-off-by: Yi-Jyun Pan <pan93412@gmail.com>
2023-11-19Merge branch 'master' of github.com:alshopov/git-poJiang Xin1-576/+872
* 'master' of github.com:alshopov/git-po: l10n: bg.po: Updated Bulgarian translation (5579t)
2023-11-18l10n: Update German translationRalf Thielow1-224/+347
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
2023-11-18l10n: bg.po: Updated Bulgarian translation (5579t)Alexander Shopov1-576/+872
Signed-off-by: Alexander Shopov <ash@kambanaria.org>
2023-11-18l10n: zh_CN: for git 2.43.0-rc1Teng Long1-229/+373
Signed-off-by: Teng Long <dyroneteng@gmail.com> Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2023-11-18Merge branch '2.43-uk-update' of github.com:arkid15rJiang Xin1-267/+358
* '2.43-uk-update' of github.com:arkid15r/git-ukrainian-l10n: l10n: update uk localization for v2.43
2023-11-18Merge branch 'catalan' of github.com:Softcatala/git-poJiang Xin1-264/+427
* 'catalan' of github.com:Softcatala/git-po: l10n: Update Catalan translation
2023-11-18Merge branch 'tr-l10n' of github.com:bitigchi/git-poJiang Xin1-207/+322
* 'tr-l10n' of github.com:bitigchi/git-po: l10n: tr: v2.43.0
2023-11-18Merge branch 'fr_v2.43.0' of github.com:jnavila/gitJiang Xin1-220/+420
* 'fr_v2.43.0' of github.com:jnavila/git: l10n: fr: v2.43.0 rnd 2
2023-11-18Merge branch 'po-id' of github.com:bagasme/git-poJiang Xin1-274/+400
* 'po-id' of github.com:bagasme/git-po: l10n: po-id for 2.43 (round 1)
2023-11-18Merge branch 'master' of github.com:nafmo/git-l10n-svJiang Xin1-1750/+1819
* 'master' of github.com:nafmo/git-l10n-sv: l10n: sv.po: Update Swedish translation (5579t)
2023-11-16send-email: remove stray characters from usageTodd Zullinger1-2/+2
A few stray single quotes crept into the usage string in a2ce608244 (send-email docs: add format-patch options, 2021-10-25). Remove them. Signed-off-by: Todd Zullinger <tmz@pobox.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-14Git 2.43-rc2v2.43.0-rc2Junio C Hamano1-1/+1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-14glossary: add definitions for dereference & peelVictoria Dye1-14/+35
Add 'gitglossary' definitions for "dereference" (as it used for both symrefs and objects) and "peel". These terms are used in options and documentation throughout Git, but they are not clearly defined anywhere and the behavior they refer to depends heavily on context. Provide explicit definitions to clarify existing documentation to users and help contributors to use the most appropriate terminology possible in their additions to Git. Update other definitions in the glossary that use the term "dereference" to link to 'def_dereference'. Signed-off-by: Victoria Dye <vdye@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-13l10n: Update Catalan translationJordi Mas1-264/+427
Signed-off-by: Jordi Mas <jmas@softcatala.org>
2023-11-12l10n: po-id for 2.43 (round 1)Bagas Sanjaya1-274/+400
Update following components: * builtin/gc.c * builtin/interpret-trailers.c * builtin/merge-file.c * builtin/show-ref.c * builtin/update-index.c * chunk-format.c * parse-options.c * scalar.c While at it, drop unused strings. Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
2023-11-12RelNotes: minor wording fixes in 2.43.0 release notesElijah Newren1-18/+18
Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-11l10n: fr: v2.43.0 rnd 2Jean-Noël Avila1-220/+420
Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
2023-11-10l10n: update uk localization for v2.43Arkadii Yakovets1-267/+358
Co-authored-by: Kate Golovanova <kate@kgthreads.com> Signed-off-by: Arkadii Yakovets <ark@cho.red> Signed-off-by: Kate Golovanova <kate@kgthreads.com>
2023-11-09l10n: sv.po: Update Swedish translation (5579t)Peter Krefting1-1750/+1819
Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
2023-11-09l10n: tr: v2.43.0Emir SARI1-207/+322
Signed-off-by: Emir SARI <emir_sari@icloud.com>
2023-11-08Git 2.43-rc1v2.43.0-rc1Junio C Hamano2-1/+6
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-08Merge branch 'tb/rev-list-unpacked-fix'Junio C Hamano5-0/+63
"git rev-list --unpacked --objects" failed to exclude packed non-commit objects, which has been corrected. * tb/rev-list-unpacked-fix: pack-bitmap: drop --unpacked non-commit objects from results list-objects: drop --unpacked non-commit objects from results
2023-11-08Merge branch 'ps/leakfixes'Junio C Hamano5-13/+28
Leakfix. * ps/leakfixes: setup: fix leaking repository format setup: refactor `upgrade_repository_format()` to have common exit shallow: fix memory leak when registering shallow roots test-bloom: stop setting up Git directory twice
2023-11-08Prepare for -rc1Junio C Hamano1-1/+19
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-08Merge branch 'jc/test-i18ngrep'Junio C Hamano226-1210/+1212
Another step to deprecate test_i18ngrep. * jc/test-i18ngrep: tests: teach callers of test_i18ngrep to use test_grep test framework: further deprecate test_i18ngrep
2023-11-08Merge branch 'la/strvec-header-fix'Junio C Hamano1-1/+0
Code clean-up. * la/strvec-header-fix: strvec: drop unnecessary include of hex.h
2023-11-08Merge branch 'bc/merge-file-object-input'Junio C Hamano3-27/+133
"git merge-file" learns a mode to read three contents to be merged from blob objects. * bc/merge-file-object-input: merge-file: add an option to process object IDs git-merge-file doc: drop "-file" from argument placeholders
2023-11-08Merge branch 'kn/rev-list-missing-fix'Junio C Hamano6-56/+155
"git rev-list --missing" did not work for missing commit objects, which has been corrected. * kn/rev-list-missing-fix: rev-list: add commit object support in `--missing` option rev-list: move `show_commit()` to the bottom revision: rename bit to `do_not_die_on_missing_objects`
2023-11-08Merge branch 'an/clang-format-typofix'Junio C Hamano1-3/+3
Typofix. * an/clang-format-typofix: clang-format: fix typo in comment
2023-11-08Merge branch 'tb/format-pack-doc-update'Junio C Hamano1-4/+5
Doc update. * tb/format-pack-doc-update: Documentation/gitformat-pack.txt: fix incorrect MIDX documentation Documentation/gitformat-pack.txt: fix typo
2023-11-08Merge branch 'ps/show-ref'Junio C Hamano8-122/+373
Teach "git show-ref" a mode to check the existence of a ref. * ps/show-ref: t: use git-show-ref(1) to check for ref existence builtin/show-ref: add new mode to check for reference existence builtin/show-ref: explicitly spell out different modes in synopsis builtin/show-ref: ensure mutual exclusiveness of subcommands builtin/show-ref: refactor options for patterns subcommand builtin/show-ref: stop using global vars for `show_one()` builtin/show-ref: stop using global variable to count matches builtin/show-ref: refactor `--exclude-existing` options builtin/show-ref: fix dead code when passing patterns builtin/show-ref: fix leaking string buffer builtin/show-ref: split up different subcommands builtin/show-ref: convert pattern to a local variable
2023-11-08Merge branch 'ps/do-not-trust-commit-graph-blindly-for-existence'Junio C Hamano5-2/+84
The codepath to traverse the commit-graph learned to notice that a commit is missing (e.g., corrupt repository lost an object), even though it knows something about the commit (like its parents) from what is in commit-graph. * ps/do-not-trust-commit-graph-blindly-for-existence: commit: detect commits that exist in commit-graph but not in the ODB commit-graph: introduce envvar to disable commit existence checks
2023-11-08Merge branch 'js/ci-use-macos-13'Junio C Hamano2-7/+5
Replace macos-12 used at GitHub CI with macos-13. * js/ci-use-macos-13: ci: upgrade to using macos-13
2023-11-08Merge branch 'jk/chunk-bounds'Junio C Hamano1-3/+27
Test portability fix. * jk/chunk-bounds: t: avoid perl's pack/unpack "Q" specifier
2023-11-08Merge branch 'jk/tree-name-and-depth-limit'Junio C Hamano1-1/+14
Further limit tree depth max to avoid Windows build running out of the stack space. * jk/tree-name-and-depth-limit: max_tree_depth: lower it for MSVC to avoid stack overflows
2023-11-07pack-bitmap: drop --unpacked non-commit objects from resultsTaylor Blau3-0/+47
When performing revision queries with `--objects` and `--use-bitmap-index`, the output may incorrectly contain objects which are packed, even when the `--unpacked` option is given. This affects traversals, but also other querying operations, like `--count`, `--disk-usage`, etc. Like in the previous commit, the fix is to exclude those objects from the result set before they are shown to the user (or, in this case, before the bitmap containing the result of the traversal is enumerated and its objects listed). This is performed by a new function in pack-bitmap.c, called `filter_packed_objects_from_bitmap()`. Note that we do not have to inspect individual bits in the result bitmap, since we know that the first N (where N is the number of objects in the bitmap's pack/MIDX) bits correspond to objects which packed by definition. In other words, for an object to have a bitmap position (not in the extended index), it must appear in either the bitmap's pack or one of the packs in its MIDX. This presents an appealing optimization to us, which is that we can simply memset() the corresponding number of `eword_t`'s to zero, provided that we handle any objects which spill into the next word (but don't occupy all 64 bits of the word itself). We only have to handle objects in the bitmap's extended index. These objects may (or may not) appear in one or more pack(s). Since these objects are known to not appear in either the bitmap's MIDX or pack, they may be stored as loose, appear in other pack(s), or both. Before returning a bitmap containing the result of the traversal back to the caller, drop any bits from the extended index which appear in one or more packs. This implements the correct behavior for rev-list operations which use the bitmap index to compute their result. Co-authored-by: Jeff King <peff@peff.net> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-07list-objects: drop --unpacked non-commit objects from resultsTaylor Blau2-0/+16
In git-rev-list(1), we describe the `--unpacked` option as: Only useful with `--objects`; print the object IDs that are not in packs. This is true of commits, which we discard via get_commit_action(), but not of the objects they reach. So if we ask for an --objects traversal with --unpacked, we may get arbitrarily many objects which are indeed packed. I am nearly certain this behavior dates back to the introduction of `--unpacked` via 12d2a18780 ("git rev-list --unpacked" shows only unpacked commits, 2005-07-03), but I couldn't get that revision of Git to compile for me. At least as early as v2.0.0 this has been subtly broken: $ git.compile --version git version 2.0.0 $ git.compile rev-list --objects --all --unpacked 72791fe96c93f9ec5c311b8bc966ab349b3b5bbe 05713d991c18bbeef7e154f99660005311b5004d v1.0 153ed8b7719c6f5a68ce7ffc43133e95a6ac0fdb 8e4020bb5a8d8c873b25de15933e75cc0fc275df one 9200b628cf9dc883a85a7abc8d6e6730baee589c two 3e6b46e1b7e3b91acce99f6a823104c28aae0b58 unpacked.t There, only the first, third, and sixth entries are loose, with the remaining set of objects belonging to at least one pack. The implications for this are relatively benign: bare 'git repack' invocations which invoke pack-objects with --unpacked are impacted, and at worst we'll store a few extra objects that should have been excluded. Arguably changing this behavior is a backwards-incompatible change, since it alters the set of objects emitted from rev-list queries with `--objects` and `--unpacked`. But I argue that this change is still sensible, since the existing implementation deviates from clearly-written documentation. The fix here is straightforward: avoid showing any non-commit objects which are contained in packs by discarding them within list-objects.c, before they are shown to the user. Note that similar treatment for `list-objects.c::show_commit()` is not needed, since that case is already handled by `revision.c::get_commit_action()`. Co-authored-by: Jeff King <peff@peff.net> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-07RelNotes: improve wording of credential helper notesTodd Zullinger1-2/+3
Offer a slightly more verbose description of the issue fixed by 7144dee3ec (credential/libsecret: erase matching creds only, 2023-07-26) and cb626f8e5c (credential/wincred: erase matching creds only, 2023-07-26). Signed-off-by: Todd Zullinger <tmz@pobox.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-07RelNotes: minor typo fixes in 2.43.0 draftTodd Zullinger1-2/+2
Signed-off-by: Todd Zullinger <tmz@pobox.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-07A bit more before -rc1Junio C Hamano1-54/+15
2023-11-07Merge branch 'rc/trace-upload-pack'Junio C Hamano2-11/+55
Trace2 update. * rc/trace-upload-pack: upload-pack: add tracing for fetches
2023-11-07Merge branch 'es/bugreport-no-extra-arg'Junio C Hamano2-1/+13
"git bugreport" learned to complain when it received a command line argument that it will not use. * es/bugreport-no-extra-arg: bugreport: reject positional arguments t0091-bugreport: stop using i18ngrep
2023-11-07Merge branch 'js/my-first-contribution-update'Junio C Hamano1-3/+4
Documentation update. * js/my-first-contribution-update: Include gettext.h in MyFirstContribution tutorial
2023-11-07Merge branch 'ms/send-email-validate-fix'Junio C Hamano2-28/+51
"git send-email" did not have certain pieces of data computed yet when it tried to validate the outging messages and its recipient addresses, which has been sorted out. * ms/send-email-validate-fix: send-email: move validation code below process_address_list
2023-11-07Merge branch 'rs/reflog-expire-single-worktree-fix'Junio C Hamano2-3/+26
"git reflog expire --single-worktree" has been broken for the past 20 months or so, which has been corrected. * rs/reflog-expire-single-worktree-fix: reflog: fix expire --single-worktree
2023-11-07Merge branch 'rs/fix-arghelp'Junio C Hamano3-4/+4
Doc and help update. * rs/fix-arghelp: am, rebase: fix arghelp syntax of --empty
2023-11-07Merge branch 'rs/parse-options-cmdmode'Junio C Hamano5-125/+183
parse-options improvements for OPT_CMDMODE options. * rs/parse-options-cmdmode: am: simplify --show-current-patch handling parse-options: make CMDMODE errors more precise
2023-11-07Merge branch 'jc/grep-f-relative-to-cwd'Junio C Hamano2-2/+24
"cd sub && git grep -f patterns" tried to read "patterns" file at the top level of the working tree; it has been corrected to read "sub/patterns" instead. * jc/grep-f-relative-to-cwd: grep: -f <path> is relative to $cwd
2023-11-07Merge branch 'ar/submitting-patches-doc-update'Junio C Hamano1-1/+1
Doc update. * ar/submitting-patches-doc-update: SubmittingPatches: call gitk's command "Copy commit reference"
2023-11-07setup: fix leaking repository formatPatrick Steinhardt1-0/+2
While populating the `repository_format` structure may cause us to allocate memory, we do not call `clear_repository_format()` in some places and thus potentially leak memory. Fix this. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-07setup: refactor `upgrade_repository_format()` to have common exitPatrick Steinhardt1-11/+20
The `upgrade_repository_format()` function has multiple exit paths, which means that there is no common cleanup of acquired resources. While this isn't much of a problem right now, we're about to fix a memory leak that would require us to free the resource in every one of those exit paths. Refactor the code to have a common exit path so that the subsequent memory leak fix becomes easier to implement. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-07shallow: fix memory leak when registering shallow rootsPatrick Steinhardt3-1/+6
When registering shallow roots, we unset the list of parents of the to-be-registered commit if it's already been parsed. This causes us to leak memory though because we never free this list. Fix this. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-07test-bloom: stop setting up Git directory twicePatrick Steinhardt1-1/+0
We're setting up the Git directory twice in the `test-tool bloom` helper, once at the beginning of `cmd_bloom()` and once in the local subcommand implementation `get_bloom_filter_for_commit()`. This can lead to memory leaks as we'll overwrite variables of `the_repository` with newly allocated data structures. On top of that it's simply unnecessary. Fix this by only setting up the Git directory once. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-04t: avoid perl's pack/unpack "Q" specifierJeff King1-3/+27
The perl script introduced by 86b008ee61 (t: add library for munging chunk-format files, 2023-10-09) uses pack("Q") and unpack("Q") to read and write 64-bit values ("quadwords" in perl parlance) from the on-disk chunk files. However, some builds of perl may not support 64-bit integers at all, and throw an exception here. While some 32-bit platforms may still support 64-bit integers in perl (such as our linux32 CI environment), others reportedly don't (the NonStop 32-bit builds). We can work around this by treating the 64-bit values as two 32-bit values. We can't ever combine them into a single 64-bit value, but in practice this is OK. These are representing file offsets, and our files are much smaller than 4GB. So the upper half of the 64-bit value will always be 0. We can just introduce a few helper functions which perform the translation and double-check our assumptions. Reported-by: Randall S. Becker <randall.becker@nexbridge.ca> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-03ci: upgrade to using macos-13Johannes Schindelin2-7/+5
In April, GitHub announced that the `macos-13` pool is available: https://github.blog/changelog/2023-04-24-github-actions-macos-13-is-now-available/. It is only a matter of time until the `macos-12` pool is going away, therefore we should switch now, without pressure of a looming deadline. Since the `macos-13` runners no longer include Python2, we also drop specifically testing with Python2 and switch uniformly to Python3, see https://github.com/actions/runner-images/blob/HEAD/images/macos/macos-13-Readme.md for details about the software available on the `macos-13` pool's runners. Also, on macOS 13, Homebrew seems to install a `gcc@9` package that no longer comes with a regular `unistd.h` (there seems only to be a `ssp/unistd.h`), and hence builds would fail with: In file included from base85.c:1: git-compat-util.h:223:10: fatal error: unistd.h: No such file or directory 223 | #include <unistd.h> | ^~~~~~~~~~ compilation terminated. The reason why we install GCC v9.x explicitly is historical, and back in the days it was because it was the _newest_ version available via Homebrew: 176441bfb58 (ci: build Git with GCC 9 in the 'osx-gcc' build job, 2019-11-27). To reinstate the spirit of that commit _and_ to fix that build failure, let's switch to the now-newest GCC version: v13.x. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-03strvec: drop unnecessary include of hex.hLinus Arver1-1/+0
In 41771fa435 (cache.h: remove dependence on hex.h; make other files include it explicitly, 2023-02-24) we added this as part of a larger mechanical refactor. But strvec doesn't actually depend on hex.h, so remove it. Signed-off-by: Linus Arver <linusa@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-02tests: teach callers of test_i18ngrep to use test_grepJunio C Hamano225-1191/+1191
They are equivalents and the former still exists, so as long as the only change this commit makes are to rewrite test_i18ngrep to test_grep, there won't be any new bug, even if there still are callers of test_i18ngrep remaining in the tree, or when merged to other topics that add new uses of test_i18ngrep. This patch was produced more or less with git grep -l -e 'test_i18ngrep ' 't/t[0-9][0-9][0-9][0-9]-*.sh' | xargs perl -p -i -e 's/test_i18ngrep /test_grep /' and a good way to sanity check the result yourself is to run the above in a checkout of c4603c1c (test framework: further deprecate test_i18ngrep, 2023-10-31) and compare the resulting working tree contents with the result of applying this patch to the same commit. You'll see that test_i18ngrep in a few t/lib-*.sh files corrected, in addition to the manual reproduction. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-02Git 2.43-rc0v2.43.0-rc0Junio C Hamano2-1/+89
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-02Git 2.42.1v2.42.1Junio C Hamano3-2/+90
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-02Merge branch 'ms/doc-push-fix' into maint-2.42Junio C Hamano1-1/+1
Docfix. * ms/doc-push-fix: git-push doc: more visibility for -q option
2023-11-02Merge branch 'jc/commit-new-underscore-index-fix' into maint-2.42Junio C Hamano1-4/+4
Message fix. * jc/commit-new-underscore-index-fix: commit: do not use cryptic "new_index" in end-user facing messages
2023-11-02Merge branch 'wx/merge-ort-comment-typofix' into maint-2.42Junio C Hamano1-1/+1
Typofix. * wx/merge-ort-comment-typofix: merge-ort.c: fix typo 'neeed' to 'needed'
2023-11-02Merge branch 'ps/git-repack-doc-fixes' into maint-2.42Junio C Hamano1-6/+3
Doc updates. * ps/git-repack-doc-fixes: doc/git-repack: don't mention nonexistent "--unpacked" option doc/git-repack: fix syntax for `-g` shorthand option
2023-11-02Merge branch 'ni/die-message-fix-for-git-add' into maint-2.42Junio C Hamano1-5/+5
Message updates. * ni/die-message-fix-for-git-add: builtin/add.c: clean up die() messages
2023-11-02Merge branch 'jc/am-doc-whitespace-action-fix' into maint-2.42Junio C Hamano1-2/+2
Docfix. * jc/am-doc-whitespace-action-fix: am: align placeholder for --whitespace option with apply
2023-11-02Merge branch 'jc/update-list-references-to-lore' into maint-2.42Junio C Hamano1-1/+1
Doc update. * jc/update-list-references-to-lore: doc: update list archive reference to use lore.kernel.org
2023-11-02Merge branch 'ps/rewritten-is-per-worktree-doc' into maint-2.42Junio C Hamano1-3/+4
Doc update. * ps/rewritten-is-per-worktree-doc: doc/git-worktree: mention "refs/rewritten" as per-worktree refs
2023-11-02Merge branch 'sn/cat-file-doc-update' into maint-2.42Junio C Hamano2-19/+17
"git cat-file" documentation updates. * sn/cat-file-doc-update: doc/cat-file: make synopsis and description less confusing
2023-11-02Merge branch 'jk/decoration-and-other-leak-fixes' into maint-2.42Junio C Hamano10-16/+74
Leakfix. * jk/decoration-and-other-leak-fixes: daemon: free listen_addr before returning revision: clear decoration structs during release_revisions() decorate: add clear_decoration() function
2023-11-02Merge branch 'rs/parse-opt-ctx-cleanup' into maint-2.42Junio C Hamano1-1/+0
Code clean-up. * rs/parse-opt-ctx-cleanup: parse-options: drop unused parse_opt_ctx_t member
2023-11-02Merge branch 'ob/am-msgfix' into maint-2.42Junio C Hamano1-1/+2
The parameters to generate an error message have been corrected. * ob/am-msgfix: am: fix error message in parse_opt_show_current_patch()
2023-11-02Merge branch 'hy/doc-show-is-like-log-not-diff-tree' into maint-2.42Junio C Hamano1-1/+1
Doc update. * hy/doc-show-is-like-log-not-diff-tree: show doc: redirect user to git log manual instead of git diff-tree
2023-11-02Merge branch 'ch/clean-docfix' into maint-2.42Junio C Hamano1-1/+1
Typofix. * ch/clean-docfix: git-clean doc: fix "without do cleaning" typo
2023-11-02Merge branch 'eg/config-type-path-docfix' into maint-2.42Junio C Hamano1-1/+1
Typofix. * eg/config-type-path-docfix: git-config: fix misworded --type=path explanation
2023-11-02Merge branch 'ob/t3404-typofix' into maint-2.42Junio C Hamano1-1/+1
Code clean-up. * ob/t3404-typofix: t3404-rebase-interactive.sh: fix typos in title of a rewording test
2023-11-02Merge branch 'ob/sequencer-remove-dead-code' into maint-2.42Junio C Hamano1-4/+0
Code clean-up. * ob/sequencer-remove-dead-code: sequencer: remove unreachable exit condition in pick_commits()
2023-11-02Merge branch 'rs/name-rev-use-opt-hidden-bool' into maint-2.42Junio C Hamano1-6/+2
Simplify use of parse-options API a bit. * rs/name-rev-use-opt-hidden-bool: name-rev: use OPT_HIDDEN_BOOL for --peel-tag
2023-11-02Merge branch 'rs/grep-parseopt-simplify' into maint-2.42Junio C Hamano1-3/+2
Simplify use of parse-options API a bit. * rs/grep-parseopt-simplify: grep: use OPT_INTEGER_F for --max-depth
2023-11-02Merge branch 'ob/sequencer-reword-error-message' into maint-2.42Junio C Hamano1-1/+1
Update an error message (which would probably never been seen). * ob/sequencer-reword-error-message: sequencer: fix error message on failure to copy SQUASH_MSG
2023-11-02Merge branch 'bc/more-git-var' into maint-2.42Junio C Hamano2-1/+10
Fix-up for a topic that already has graduated. * bc/more-git-var: var: avoid a segmentation fault when `HOME` is unset
2023-11-02Merge branch 'jk/ci-retire-allow-ref' into maint-2.42Junio C Hamano3-30/+21
CI update. * jk/ci-retire-allow-ref: ci: deprecate ci/config/allow-ref script ci: allow branch selection through "vars"
2023-11-02Merge branch 'ws/git-svn-retire-faketerm' into maint-2.42Junio C Hamano1-18/+2
Code clean-up. * ws/git-svn-retire-faketerm: git-svn: drop FakeTerm hack
2023-11-02Merge branch 'ch/t6300-verify-commit-test-cleanup' into maint-2.42Junio C Hamano2-4/+2
Test clean-up. * ch/t6300-verify-commit-test-cleanup: t/t6300: drop magic filtering t/lib-gpg: forcibly run a trustdb update
2023-11-02Merge branch 'jc/mv-d-to-d-error-message-fix' into maint-2.42Junio C Hamano1-1/+1
Typofix in an error message. * jc/mv-d-to-d-error-message-fix: mv: fix error for moving directory to another
2023-11-02Merge branch 'ja/worktree-orphan' into maint-2.42Junio C Hamano1-1/+1
Typofix in an error message. * ja/worktree-orphan: builtin/worktree.c: fix typo in "forgot fetch" msg
2023-11-02Merge branch 'ob/t9001-indent-fix' into maint-2.42Junio C Hamano1-2/+2
Test style fix. * ob/t9001-indent-fix: t9001: fix indentation in test_no_confirm()
2023-11-02Merge branch 'jk/function-pointer-mismatches-fix' into maint-2.42Junio C Hamano2-8/+13
Code clean-up to please clang-18. * jk/function-pointer-mismatches-fix: hashmap: use expected signatures for comparison functions
2023-11-02Merge branch 'ds/upload-pack-error-sequence-fix' into maint-2.42Junio C Hamano1-2/+3
Error message generation fix. * ds/upload-pack-error-sequence-fix: upload-pack: fix exit code when denying fetch of unreachable object ID upload-pack: fix race condition in error messages
2023-11-02Merge branch 'ws/git-push-doc-grammofix' into maint-2.42Junio C Hamano1-1/+1
Doc update. * ws/git-push-doc-grammofix: git-push.txt: fix grammar
2023-11-02Merge branch 'jk/test-pass-ubsan-options-to-http-test' into maint-2.42Junio C Hamano2-0/+4
UBSAN options were not propagated through the test framework to git run via the httpd, unlike ASAN options, which has been corrected. * jk/test-pass-ubsan-options-to-http-test: test-lib: set UBSAN_OPTIONS to match ASan
2023-11-02Merge branch 'tb/send-email-extract-valid-address-error-message-fix' into ↵Junio C Hamano1-3/+3
maint-2.42 An error message given by "git send-email" when given a malformed address did not give correct information, which has been corrected. * tb/send-email-extract-valid-address-error-message-fix: git-send-email.perl: avoid printing undef when validating addresses
2023-11-02Merge branch 'jk/redact-h2h3-headers-fix' into maint-2.42Junio C Hamano1-6/+31
HTTP Header redaction code has been adjusted for a newer version of cURL library that shows its traces differently from earlier versions. * jk/redact-h2h3-headers-fix: http: update curl http/2 info matching for curl 8.3.0 http: factor out matching of curl http/2 trace lines
2023-11-02Merge branch 'pb/completion-aliases-doc' into maint-2.42Junio C Hamano1-0/+1
Clarify how "alias.foo = : git cmd ; aliased-command-string" should be spelled with necessary whitespaces around punctuation marks to work. * pb/completion-aliases-doc: completion: improve doc for complex aliases
2023-11-02Merge branch 'js/diff-cached-fsmonitor-fix' into maint-2.42Junio C Hamano2-6/+11
"git diff --cached" codepath did not fill the necessary stat information for a file when fsmonitor knows it is clean and ended up behaving as if it is not clean, which has been corrected. * js/diff-cached-fsmonitor-fix: diff-lib: fix check_removed when fsmonitor is on
2023-11-02Merge branch 'js/systemd-timers-wsl-fix' into maint-2.42Junio C Hamano1-1/+1
Update "git maintainance" timers' implementation based on systemd timers to work with WSL. * js/systemd-timers-wsl-fix: maintenance(systemd): support the Windows Subsystem for Linux
2023-11-02Merge branch 'pw/diff-no-index-from-named-pipes' into maint-2.42Junio C Hamano2-0/+20
"git diff --no-index -R <(one) <(two)" did not work correctly, which has been corrected. * pw/diff-no-index-from-named-pipes: diff --no-index: fix -R with stdin
2023-11-02Merge branch 'js/complete-checkout-t' into maint-2.42Junio C Hamano2-4/+12
The completion script (in contrib/) has been taught to treat the "-t" option to "git checkout" and "git switch" just like the "--track" option, to complete remote-tracking branches. * js/complete-checkout-t: completion(switch/checkout): treat --track and -t the same
2023-11-02Merge branch 'rs/grep-no-no-or' into maint-2.42Junio C Hamano1-1/+1
"git grep -e A --no-or -e B" is accepted, even though the negation of "or" did not mean anything, which has been tightened. * rs/grep-no-no-or: grep: reject --no-or
2023-11-02Merge branch 'so/diff-doc-for-patch-update' into maint-2.42Junio C Hamano1-7/+1
References from description of the `--patch` option in various manual pages have been simplified and improved. * so/diff-doc-for-patch-update: doc/diff-options: fix link to generating patch section
2023-11-02Merge branch 'pw/rebase-i-after-failure' into maint-2.42Junio C Hamano5-103/+228
Various fixes to the behaviour of "rebase -i" when the command got interrupted by conflicting changes. cf. <6b927687-cf6e-d73e-78fb-bd4f46736928@gmx.de> * pw/rebase-i-after-failure: rebase -i: fix adding failed command to the todo list rebase --continue: refuse to commit after failed command rebase: fix rewritten list for failed pick sequencer: factor out part of pick_commits() sequencer: use rebase_path_message() rebase -i: remove patch file after conflict resolution rebase -i: move unlink() calls
2023-11-02Merge branch 'ks/ref-filter-sort-numerically' into maint-2.42Junio C Hamano2-10/+26
"git for-each-ref --sort='contents:size'" sorts the refs according to size numerically, giving a ref that points at a blob twelve-byte (12) long before showing a blob hundred-byte (100) long. * ks/ref-filter-sort-numerically: ref-filter: sort numerically when ":size" is used
2023-11-02Merge branch 'jk/diff-result-code-cleanup' into maint-2.42Junio C Hamano17-95/+81
"git diff --no-such-option" and other corner cases around the exit status of the "diff" command has been corrected. * jk/diff-result-code-cleanup: diff: drop useless "status" parameter from diff_result_code() diff: drop useless return values in git-diff helpers diff: drop useless return from run_diff_{files,index} functions diff: die when failing to read index in git-diff builtin diff: show usage for unknown builtin_diff_files() options diff-files: avoid negative exit value diff: spell DIFF_INDEX_CACHED out when calling run_diff_index()
2023-11-02Merge branch 'ob/sequencer-empty-hint-fix' into maint-2.42Junio C Hamano2-2/+6
The use of API between two calls to require_clean_work_tree() from the sequencer code has been cleaned up for consistency. * ob/sequencer-empty-hint-fix: sequencer: rectify empty hint in call of require_clean_work_tree()
2023-11-02Merge branch 'ts/unpacklimit-config-fix' into maint-2.42Junio C Hamano4-9/+84
transfer.unpackLimit ought to be used as a fallback, but overrode fetch.unpackLimit and receive.unpackLimit instead. * ts/unpacklimit-config-fix: transfer.unpackLimit: fetch/receive.unpackLimit takes precedence
2023-11-02Merge branch 'jc/diff-exit-code-with-w-fixes' into maint-2.42Junio C Hamano3-18/+64
"git diff -w --exit-code" with various options did not work correctly, which is being addressed. * jc/diff-exit-code-with-w-fixes: diff: the -w option breaks --exit-code for --raw and other output modes t4040: remove test that succeeded for a wrong reason diff: teach "--stat -w --exit-code" to notice differences diff: mode-only change should be noticed by "--patch -w --exit-code" diff: move the fallback "--exit-code" code down
2023-11-02Merge branch 'tb/commit-graph-verify-fix' into maint-2.42Junio C Hamano2-20/+36
The commit-graph verification code that detects mixture of zero and non-zero generation numbers has been updated. * tb/commit-graph-verify-fix: commit-graph: avoid repeated mixed generation number warnings t/t5318-commit-graph.sh: test generation zero transitions during fsck commit-graph: verify swapped zero/non-zero generation cases commit-graph: introduce `commit_graph_generation_from_graph()`
2023-11-02Merge branch 'jc/ci-skip-same-commit' into maint-2.42Junio C Hamano1-0/+13
Tweak GitHub Actions CI so that pushing the same commit to multiple branch tips at the same time will not waste building and testing the same thing twice. * jc/ci-skip-same-commit: ci: avoid building from the same commit in parallel
2023-11-02Merge branch 'ds/scalar-updates' into maint-2.42Junio C Hamano5-44/+115
Scalar updates. * ds/scalar-updates: scalar reconfigure: help users remove buggy repos setup: add discover_git_directory_reason() scalar: add --[no-]src option
2023-11-02Merge branch 'mp/rebase-label-length-limit' into maint-2.42Junio C Hamano4-6/+62
Overly long label names used in the sequencer machinery are now chopped to fit under filesystem limitation. * mp/rebase-label-length-limit: rebase: allow overriding the maximal length of the generated labels sequencer: truncate labels to accommodate loose refs
2023-11-02Merge branch 'js/ci-coverity' into maint-2.42Junio C Hamano1-0/+163
GitHub CI workflow has learned to trigger Coverity check. * js/ci-coverity: coverity: detect and report when the token or project is incorrect coverity: allow running on macOS coverity: support building on Windows coverity: allow overriding the Coverity project coverity: cache the Coverity Build Tool ci: add a GitHub workflow to submit Coverity scans
2023-11-02Merge branch 'jk/test-lsan-denoise-output' into maint-2.42Junio C Hamano1-0/+1
Tests with LSan from time to time seem to emit harmless message that makes our tests unnecessarily flakey; we work it around by filtering the uninteresting output. * jk/test-lsan-denoise-output: test-lib: ignore uninteresting LSan output
2023-11-02Merge branch 'js/ci-san-skip-p4-and-svn-tests' into maint-2.42Junio C Hamano1-0/+2
Flakey "git p4" tests, as well as "git svn" tests, are now skipped in the (rather expensive) sanitizer CI job. * js/ci-san-skip-p4-and-svn-tests: ci(linux-asan-ubsan): let's save some time
2023-11-02Merge branch 'tb/mark-more-tests-as-leak-free' into maint-2.42Junio C Hamano4-0/+5
Tests that are known to pass with LSan are now marked as such. * tb/mark-more-tests-as-leak-free: leak tests: mark t5583-push-branches.sh as leak-free leak tests: mark t3321-notes-stripspace.sh as leak-free leak tests: mark a handful of tests as leak-free
2023-11-02max_tree_depth: lower it for MSVC to avoid stack overflowsJohannes Schindelin1-1/+14
There seems to be some internal stack overflow detection in MSVC's `malloc()` machinery that seems to be independent of the `stack reserve` and `heap reserve` sizes specified in the executable (editable via `EDITBIN /STACK:<n> <exe>` and `EDITBIN /HEAP:<n> <exe>`). In the newly test cases added by `jk/tree-name-and-depth-limit`, this stack overflow detection is unfortunately triggered before Git can print out the error message about too-deep trees and exit gracefully. Instead, it exits with `STATUS_STACK_OVERFLOW`. This corresponds to the numeric value -1073741571, something the MSYS2 runtime we sadly need to use to run Git's test suite cannot handle and which it internally maps to the exit code 127. Git's test suite, in turn, mistakes this to mean that the command was not found, and fails both test cases. Here is an example stack trace from an example run: [0x0] ntdll!RtlpAllocateHeap+0x31 0x4212603f50 0x7ff9d6d4cd49 [0x1] ntdll!RtlpAllocateHeapInternal+0x6c9 0x42126041b0 0x7ff9d6e14512 [0x2] ntdll!RtlDebugAllocateHeap+0x102 0x42126042b0 0x7ff9d6dcd8b0 [0x3] ntdll!RtlpAllocateHeap+0x7ec70 0x4212604350 0x7ff9d6d4cd49 [0x4] ntdll!RtlpAllocateHeapInternal+0x6c9 0x42126045b0 0x7ff9596ed480 [0x5] ucrtbased!heap_alloc_dbg_internal+0x210 0x42126046b0 0x7ff9596ed20d [0x6] ucrtbased!heap_alloc_dbg+0x4d 0x4212604750 0x7ff9596f037f [0x7] ucrtbased!_malloc_dbg+0x2f 0x42126047a0 0x7ff9596f0dee [0x8] ucrtbased!malloc+0x1e 0x42126047d0 0x7ff730fcc1ef [0x9] git!do_xmalloc+0x2f 0x4212604800 0x7ff730fcc2b9 [0xa] git!do_xmallocz+0x59 0x4212604840 0x7ff730fca779 [0xb] git!xmallocz_gently+0x19 0x4212604880 0x7ff7311b0883 [0xc] git!unpack_compressed_entry+0x43 0x42126048b0 0x7ff7311ac9a4 [0xd] git!unpack_entry+0x554 0x42126049a0 0x7ff7311b0628 [0xe] git!cache_or_unpack_entry+0x58 0x4212605250 0x7ff7311ad3a8 [0xf] git!packed_object_info+0x98 0x42126052a0 0x7ff7310a92da [0x10] git!do_oid_object_info_extended+0x3fa 0x42126053b0 0x7ff7310a44e7 [0x11] git!oid_object_info_extended+0x37 0x4212605460 0x7ff7310a38ba [0x12] git!repo_read_object_file+0x9a 0x42126054a0 0x7ff7310a6147 [0x13] git!read_object_with_reference+0x97 0x4212605560 0x7ff7310b4656 [0x14] git!fill_tree_descriptor+0x66 0x4212605620 0x7ff7310dc0a5 [0x15] git!traverse_trees_recursive+0x3f5 0x4212605680 0x7ff7310dd831 [0x16] git!unpack_callback+0x441 0x4212605790 0x7ff7310b4c95 [0x17] git!traverse_trees+0x5d5 0x42126058a0 0x7ff7310dc0f2 [0x18] git!traverse_trees_recursive+0x442 0x4212605980 0x7ff7310dd831 [0x19] git!unpack_callback+0x441 0x4212605a90 0x7ff7310b4c95 [0x1a] git!traverse_trees+0x5d5 0x4212605ba0 0x7ff7310dc0f2 [0x1b] git!traverse_trees_recursive+0x442 0x4212605c80 0x7ff7310dd831 [0x1c] git!unpack_callback+0x441 0x4212605d90 0x7ff7310b4c95 [0x1d] git!traverse_trees+0x5d5 0x4212605ea0 0x7ff7310dc0f2 [0x1e] git!traverse_trees_recursive+0x442 0x4212605f80 0x7ff7310dd831 [0x1f] git!unpack_callback+0x441 0x4212606090 0x7ff7310b4c95 [0x20] git!traverse_trees+0x5d5 0x42126061a0 0x7ff7310dc0f2 [0x21] git!traverse_trees_recursive+0x442 0x4212606280 0x7ff7310dd831 [...] [0xfad] git!cmd_main+0x2a2 0x42126ff740 0x7ff730fb6345 [0xfae] git!main+0xe5 0x42126ff7c0 0x7ff730fbff93 [0xfaf] git!wmain+0x2a3 0x42126ff830 0x7ff731318859 [0xfb0] git!invoke_main+0x39 0x42126ff8a0 0x7ff7313186fe [0xfb1] git!__scrt_common_main_seh+0x12e 0x42126ff8f0 0x7ff7313185be [0xfb2] git!__scrt_common_main+0xe 0x42126ff960 0x7ff7313188ee [0xfb3] git!wmainCRTStartup+0xe 0x42126ff990 0x7ff9d5ed257d [0xfb4] KERNEL32!BaseThreadInitThunk+0x1d 0x42126ff9c0 0x7ff9d6d6aa78 [0xfb5] ntdll!RtlUserThreadStart+0x28 0x42126ff9f0 0x0 I verified manually that `traverse_trees_cur_depth` was 562 when that happened, which is far below the 2048 that were already accepted into Git as a hard limit. Despite many attempts to figure out which of the internals trigger this `STATUS_STACK_OVERFLOW` and how to maybe increase certain sizes to avoid running into this issue and let Git behave the same way as under Linux, I failed to find any build-time/runtime knob we could turn to that effect. Note: even switching to using a different allocator (I used mimalloc because that's what Git for Windows uses for its GCC builds) does not help, as the zlib code used to unpack compressed pack entries _still_ uses the regular `malloc()`. And runs into the same issue. Note also: switching to using a different allocator _also_ for zlib code seems _also_ not to help. I tried that, and it still exited with `STATUS_STACK_OVERFLOW` that seems to have been triggered by a `mi_assert_internal()`, i.e. an internal assertion of mimalloc... So the best bet to work around this for now seems to just lower the maximum allowed tree depth _even further_ for MSVC builds. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-02merge-file: add an option to process object IDsbrian m. carlson3-18/+123
git merge-file knows how to merge files on the file system already. It would be helpful, however, to allow it to also merge single blobs. Teach it an `--object-id` option which means that its arguments are object IDs and not files to allow it to do so. We handle the empty blob specially since read_mmblob doesn't read it directly and otherwise users cannot specify an empty ancestor. Signed-off-by: brian m. carlson <bk2204@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-02git-merge-file doc: drop "-file" from argument placeholdersMartin Ågren1-10/+11
`git merge-file` takes three positional arguments. Each of them is documented as `<foo-file>`. In preparation for teaching this command to alternatively take three object IDs, make these placeholders a bit more generic by dropping the "-file" parts. Instead, clarify early that the three arguments are filenames. Even after the next commit, we can afford to present this file-centric view up front and in the general discussion, since it will remain the default one. Signed-off-by: Martin Ågren <martin.agren@gmail.com> Signed-off-by: brian m. carlson <bk2204@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-01Documentation/gitformat-pack.txt: fix incorrect MIDX documentationTaylor Blau1-4/+5
Back in 32f3c541e3 (multi-pack-index: write pack names in chunk, 2018-07-12) the MIDX's "Packfile Names" (or "PNAM", for short) chunk was described as containing an array of string entries. e0d1bcf825 notes that this is the only chunk in the MIDX format's specification that is not guaranteed to be 4-byte aligned, and so should be placed last. This isn't quite accurate: the entries within the PNAM chunk are not guaranteed to be 4-byte aligned since they are arbitrary strings, but the chunk itself is 4-byte aligned since the ending is padded with NUL bytes. That padding has always been there since 32f3c541e3 via midx.c::write_midx_pack_names(), which ended with: i = MIDX_CHUNK_ALIGNMENT - (written % MIDX_CHUNK_ALIGNMENT) if (i < MIDX_CHUNK_ALIGNMENT) { unsigned char padding[MIDX_CHUNK_ALIGNMENT]; memset(padding, 0, sizeof(padding)) hashwrite(f, padding, i); written += i; } In fact, 32f3c541e3's log message itself describes the chunk in its first paragraph with: Since filenames are not well structured, add padding to keep good alignment in later chunks. So these have always been externally aligned. Correct the corresponding part of our documentation to reflect that. Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-01Documentation/gitformat-pack.txt: fix typoTaylor Blau1-1/+1
e0d1bcf825 (multi-pack-index: add format details, 2018-07-12) describes the MIDX's "PNAM" chunk as having entries which are "null-terminated strings". This is a typo, as strings are terminated with a NUL character, which is a distinct concept from "NULL" or "null", which we typically reserve for the void pointer to address 0. Correct the documentation accordingly. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-01clang-format: fix typo in commentAditya Neelamraju1-3/+3
Signed-off-by: Aditya Neelamraju <adityanv97@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-01t: use git-show-ref(1) to check for ref existencePatrick Steinhardt5-27/+94
Convert tests that use `test_path_is_file` and `test_path_is_missing` to instead use a set of helpers `test_ref_exists` and `test_ref_missing`. These helpers are implemented via the newly introduced `git show-ref --exists` command. Thus, we can avoid intimate knowledge of how the ref backend stores references on disk. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-01builtin/show-ref: add new mode to check for reference existencePatrick Steinhardt3-6/+117
While we have multiple ways to show the value of a given reference, we do not have any way to check whether a reference exists at all. While commands like git-rev-parse(1) or git-show-ref(1) can be used to check for reference existence in case the reference resolves to something sane, neither of them can be used to check for existence in some other scenarios where the reference does not resolve cleanly: - References which have an invalid name cannot be resolved. - References to nonexistent objects cannot be resolved. - Dangling symrefs can be resolved via git-symbolic-ref(1), but this requires the caller to special case existence checks depending on whether or not a reference is symbolic or direct. Furthermore, git-rev-list(1) and other commands do not let the caller distinguish easily between an actually missing reference and a generic error. Taken together, this seems like sufficient motivation to introduce a separate plumbing command to explicitly check for the existence of a reference without trying to resolve its contents. This new command comes in the form of `git show-ref --exists`. This new mode will exit successfully when the reference exists, with a specific exit code of 2 when it does not exist, or with 1 when there has been a generic error. Note that the only way to properly implement this command is by using the internal `refs_read_raw_ref()` function. While the public function `refs_resolve_ref_unsafe()` can be made to behave in the same way by passing various flags, it does not provide any way to obtain the errno with which the reference backend failed when reading the reference. As such, it becomes impossible for us to distinguish generic errors from the explicit case where the reference wasn't found. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-01builtin/show-ref: explicitly spell out different modes in synopsisPatrick Steinhardt2-4/+10
The synopsis treats the `--verify` and the implicit mode the same. They are slightly different though: - They accept different sets of flags. - The implicit mode accepts patterns while the `--verify` mode accepts references. Split up the synopsis for these two modes such that we can disambiguate those differences. While at it, drop "--quiet" from the pattern mode's synopsis. It does not make a lot of sense to list patterns, but squelch the listing output itself. The description for "--quiet" is adapted accordingly. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-01builtin/show-ref: ensure mutual exclusiveness of subcommandsPatrick Steinhardt2-0/+13
The git-show-ref(1) command has three different modes, of which one is implicit and the other two can be chosen explicitly by passing a flag. But while these modes are standalone and cause us to execute completely separate code paths, we gladly accept the case where a user asks for both `--exclude-existing` and `--verify` at the same time even though it is not obvious what will happen. Spoiler: we ignore `--verify` and execute the `--exclude-existing` mode. Let's explicitly detect this invalid usage and die in case both modes were requested. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-01builtin/show-ref: refactor options for patterns subcommandPatrick Steinhardt1-13/+22
The patterns subcommand is the last command that still uses global variables to track its options. Convert it to use a structure instead with the same motivation as preceding commits. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-01builtin/show-ref: stop using global vars for `show_one()`Patrick Steinhardt1-22/+40
The `show_one()` function implicitly receives a bunch of options which are tracked via global variables. This makes it hard to see which subcommands of git-show-ref(1) actually make use of these options. Introduce a `show_one_options` structure that gets passed down to this function. This allows us to get rid of more global state and makes it more explicit which subcommands use those options. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-01builtin/show-ref: stop using global variable to count matchesPatrick Steinhardt1-3/+4
When passing patterns to git-show-ref(1) we're checking whether any reference matches -- if none do, we indicate this condition via an unsuccessful exit code. We're using a global variable to count these matches, which is required because the counter is getting incremented in a callback function. But now that we have the `struct show_ref_data` in place, we can get rid of the global variable and put the counter in there instead. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-01builtin/show-ref: refactor `--exclude-existing` optionsPatrick Steinhardt1-34/+44
It's not immediately obvious options which options are applicable to what subcommand in git-show-ref(1) because all options exist as global state. This can easily cause confusion for the reader. Refactor options for the `--exclude-existing` subcommand to be contained in a separate structure. This structure is stored on the stack and passed down as required. Consequently, it clearly delimits the scope of those options and requires the reader to worry less about global state. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-01builtin/show-ref: fix dead code when passing patternsPatrick Steinhardt1-4/+1
When passing patterns to `git show-ref` we have some code that will cause us to die if `verify && !quiet` is true. But because `verify` indicates a different subcommand of git-show-ref(1) that causes us to execute `cmd_show_ref__verify()` and not `cmd_show_ref__patterns()`, the condition cannot ever be true. Let's remove this dead code. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-01builtin/show-ref: fix leaking string bufferPatrick Steinhardt1-1/+3
Fix a leaking string buffer in `git show-ref --exclude-existing`. While the buffer is technically not leaking because its variable is declared as static, there is no inherent reason why it should be. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-01builtin/show-ref: split up different subcommandsPatrick Steinhardt1-47/+54
While not immediately obvious, git-show-ref(1) actually implements three different subcommands: - `git show-ref <patterns>` can be used to list references that match a specific pattern. - `git show-ref --verify <refs>` can be used to list references. These are _not_ patterns. - `git show-ref --exclude-existing` can be used as a filter that reads references from standard input, performing some conversions on each of them. Let's make this more explicit in the code by splitting up the three subcommands into separate functions. This also allows us to address the confusingly named `patterns` variable, which may hold either patterns or reference names. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-01builtin/show-ref: convert pattern to a local variablePatrick Steinhardt1-18/+28
The `pattern` variable is a global variable that tracks either the reference names (not patterns!) for the `--verify` mode or the patterns for the non-verify mode. This is a bit confusing due to the slightly different meanings. Convert the variable to be local. While this does not yet fix the double meaning of the variable, this change allows us to address it in a subsequent patch more easily by explicitly splitting up the different subcommands of git-show-ref(1). Note that we introduce a `struct show_ref_data` to pass the patterns to `show_ref()`. While this is overengineered now, we will extend this structure in a subsequent patch. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-01rev-list: add commit object support in `--missing` optionKarthik Nayak5-2/+101
The `--missing` object option in rev-list currently works only with missing blobs/trees. For missing commits the revision walker fails with a fatal error. Let's extend the functionality of `--missing` option to also support commit objects. This is done by adding a `missing_objects` field to `rev_info`. This field is an `oidset` to which we'll add the missing commits as we encounter them. The revision walker will now continue the traversal and call `show_commit()` even for missing commits. In rev-list we can then check if the commit is a missing commit and call the existing code for parsing `--missing` objects. A scenario where this option would be used is to find the boundary objects between different object directories. Consider a repository with a main object directory (GIT_OBJECT_DIRECTORY) and one or more alternate object directories (GIT_ALTERNATE_OBJECT_DIRECTORIES). In such a repository, using the `--missing=print` option while disabling the alternate object directory allows us to find the boundary objects between the main and alternate object directory. Helped-by: Patrick Steinhardt <ps@pks.im> Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Karthik Nayak <karthik.188@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-01rev-list: move `show_commit()` to the bottomKarthik Nayak1-43/+42
The `show_commit()` function already depends on `finish_commit()`, and in the upcoming commit, we'll also add a dependency on `finish_object__ma()`. Since in C symbols must be declared before they're used, let's move `show_commit()` below both `finish_commit()` and `finish_object__ma()`, so the code is cleaner as a whole without the need for declarations. Signed-off-by: Karthik Nayak <karthik.188@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-01revision: rename bit to `do_not_die_on_missing_objects`Karthik Nayak4-11/+12
The bit `do_not_die_on_missing_tree` is used in revision.h to ensure the revision walker does not die when encountering a missing tree. This is currently exclusively set within `builtin/rev-list.c` to ensure the `--missing` option works with missing trees. In the upcoming commits, we will extend `--missing` to also support missing commits. So let's rename the bit to `do_not_die_on_missing_objects`, which is object type agnostic and can be used for both trees/commits. Signed-off-by: Karthik Nayak <karthik.188@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-01Merge branch 'ps/do-not-trust-commit-graph-blindly-for-existence' into ↵Junio C Hamano5-2/+84
kn/rev-list-missing-fix * ps/do-not-trust-commit-graph-blindly-for-existence: commit: detect commits that exist in commit-graph but not in the ODB commit-graph: introduce envvar to disable commit existence checks
2023-11-01commit: detect commits that exist in commit-graph but not in the ODBPatrick Steinhardt2-1/+42
Commit graphs can become stale and contain references to commits that do not exist in the object database anymore. Theoretically, this can lead to a scenario where we are able to successfully look up any such commit via the commit graph even though such a lookup would fail if done via the object database directly. As the commit graph is mostly intended as a sort of cache to speed up parsing of commits we do not want to have diverging behaviour in a repository with and a repository without commit graphs, no matter whether they are stale or not. As commits are otherwise immutable, the only thing that we really need to care about is thus the presence or absence of a commit. To address potentially stale commit data that may exist in the graph, our `lookup_commit_in_graph()` function will check for the commit's existence in both the commit graph, but also in the object database. So even if we were able to look up the commit's data in the graph, we would still pretend as if the commit didn't exist if it is missing in the object database. We don't have the same safety net in `parse_commit_in_graph_one()` though. This function is mostly used internally in "commit-graph.c" itself to validate the commit graph, and this usage is fine. We do expose its functionality via `parse_commit_in_graph()` though, which gets called by `repo_parse_commit_internal()`, and that function is in turn used in many places in our codebase. For all I can see this function is never used to directly turn an object ID into a commit object without additional safety checks before or after this lookup. What it is being used for though is to walk history via the parent chain of commits. So when commits in the parent chain of a graph walk are missing it is possible that we wouldn't notice if that missing commit was part of the commit graph. Thus, a query like `git rev-parse HEAD~2` can succeed even if the intermittent commit is missing. It's unclear whether there are additional ways in which such stale commit graphs can lead to problems. In any case, it feels like this is a bigger bug waiting to happen when we gain additional direct or indirect callers of `repo_parse_commit_internal()`. So let's fix the inconsistent behaviour by checking for object existence via the object database, as well. This check of course comes with a performance penalty. The following benchmarks have been executed in a clone of linux.git with stable tags added: Benchmark 1: git -c core.commitGraph=true rev-list --topo-order --all (git = master) Time (mean ± σ): 2.913 s ± 0.018 s [User: 2.363 s, System: 0.548 s] Range (min … max): 2.894 s … 2.950 s 10 runs Benchmark 2: git -c core.commitGraph=true rev-list --topo-order --all (git = pks-commit-graph-inconsistency) Time (mean ± σ): 3.834 s ± 0.052 s [User: 3.276 s, System: 0.556 s] Range (min … max): 3.780 s … 3.961 s 10 runs Benchmark 3: git -c core.commitGraph=false rev-list --topo-order --all (git = master) Time (mean ± σ): 13.841 s ± 0.084 s [User: 13.152 s, System: 0.687 s] Range (min … max): 13.714 s … 13.995 s 10 runs Benchmark 4: git -c core.commitGraph=false rev-list --topo-order --all (git = pks-commit-graph-inconsistency) Time (mean ± σ): 13.762 s ± 0.116 s [User: 13.094 s, System: 0.667 s] Range (min … max): 13.645 s … 14.038 s 10 runs Summary git -c core.commitGraph=true rev-list --topo-order --all (git = master) ran 1.32 ± 0.02 times faster than git -c core.commitGraph=true rev-list --topo-order --all (git = pks-commit-graph-inconsistency) 4.72 ± 0.05 times faster than git -c core.commitGraph=false rev-list --topo-order --all (git = pks-commit-graph-inconsistency) 4.75 ± 0.04 times faster than git -c core.commitGraph=false rev-list --topo-order --all (git = master) We look at a ~30% regression in general, but in general we're still a whole lot faster than without the commit graph. To counteract this, the new check can be turned off with the `GIT_COMMIT_GRAPH_PARANOIA` envvar. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-11-01commit-graph: introduce envvar to disable commit existence checksPatrick Steinhardt4-1/+42
Our `lookup_commit_in_graph()` helper tries to look up commits from the commit graph and, if it doesn't exist there, falls back to parsing it from the object database instead. This is intended to speed up the lookup of any such commit that exists in the database. There is an edge case though where the commit exists in the graph, but not in the object database. To avoid returning such stale commits the helper function thus double checks that any such commit parsed from the graph also exists in the object database. This makes the function safe to use even when commit graphs aren't updated regularly. We're about to introduce the same pattern into other parts of our code base though, namely `repo_parse_commit_internal()`. Here the extra sanity check is a bit of a tougher sell: `lookup_commit_in_graph()` was a newly introduced helper, and as such there was no performance hit by adding this sanity check. If we added `repo_parse_commit_internal()` with that sanity check right from the beginning as well, this would probably never have been an issue to begin with. But by retrofitting it with this sanity check now we do add a performance regression to preexisting code, and thus there is a desire to avoid this or at least give an escape hatch. In practice, there is no inherent reason why either of those functions should have the sanity check whereas the other one does not: either both of them are able to detect this issue or none of them should be. This also means that the default of whether we do the check should likely be the same for both. To err on the side of caution, we thus rather want to make `repo_parse_commit_internal()` stricter than to loosen the checks that we already have in `lookup_commit_in_graph()`. The escape hatch is added in the form of a new GIT_COMMIT_GRAPH_PARANOIA environment variable that mirrors GIT_REF_PARANOIA. If enabled, which is the default, we will double check that commits looked up in the commit graph via `lookup_commit_in_graph()` also exist in the object database. This same check will also be added in `repo_parse_commit_internal()`. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-10-31test framework: further deprecate test_i18ngrepJunio C Hamano1-4/+6
As an attempt to come up with a useful mechanism to ensure that certain messages are left untranslated [*], we earlier wrote GIT_TEST_GETTEXT_POISON off as a failed experiment. But the output from the test helper was easier to use while debugging failed tests, compared to the same test writtein with the plain-vanilla "grep". Especially when a test that expects a certain string to appear in the output (e.g. "this test must fail with this message") fails, "grep message output" would just silently fail and in a &&-chained sequence of commands, it is hard to tell which step failed. test_i18ngrep explicitly said "we wanted to see a line that match this pattern but did not see a hit in this file". What we have as test_i18ngrep in our tree still retains this verbose output (even though we got rid of the "poison" support). Let's rename it to test_grep (because it is no longer about i18n at all) and then make test_i18ngrep a thin wrapper around it. Existing callers of test_i18ngrep can be mechanically rewritten to instead use test_grep over time, but it does not have to be done in this commit. [Footnote] * The idea was that human-facing messages are often translated, but there are messages that should never be translated. We use "grep" only for the latter kind of messages, and then run tests in "poison" mode that spew garbage for translatable messages. If such a test run fails, it means these messages tested with "grep" were marked for translation by mistake. test_i18ngrep was to be used for other messages that are to be translated, and was to always "succeed" when runing under the "poison" mode. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-10-31Merge branch 'jm/bisect-run-synopsis-fix'Junio C Hamano2-4/+4
Doc and usage message update. * jm/bisect-run-synopsis-fix: doc/git-bisect: clarify `git bisect run` syntax
2023-10-31Merge branch 'ii/branch-error-messages-update'Junio C Hamano4-47/+47
Error message update. * ii/branch-error-messages-update: builtin/branch.c: adjust error messages to coding guidelines
2023-10-30upload-pack: add tracing for fetchesRobert Coup2-11/+55
Information on how users are accessing hosted repositories can be helpful to server operators. For example, being able to broadly differentiate between fetches and initial clones; the use of shallow repository features; or partial clone filters. a29263c (fetch-pack: add tracing for negotiation rounds, 2022-08-02) added some information on have counts to fetch-pack itself to help diagnose negotiation; but from a git-upload-pack (server) perspective, there's no means of accessing such information without using GIT_TRACE_PACKET to examine the protocol packets. Improve this by emitting a Trace2 JSON event from upload-pack with summary information on the contents of a fetch request. * haves, wants, and want-ref counts can help determine (broadly) between fetches and clones, and the use of single-branch, etc. * shallow clone depth, tip counts, and deepening options. * any partial clone filter type. Signed-off-by: Robert Coup <robert@coup.net.nz> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-10-30The twenty-second batchJunio C Hamano1-0/+19
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-10-30Merge branch 'ms/doc-push-fix'Junio C Hamano1-1/+1
Docfix. * ms/doc-push-fix: git-push doc: more visibility for -q option
2023-10-30Merge branch 'jk/send-email-fix-addresses-from-composed-messages'Junio C Hamano3-85/+99
The codepath to handle recipient addresses `git send-email --compose` learns from the user was completely broken, which has been corrected. * jk/send-email-fix-addresses-from-composed-messages: send-email: handle to/cc/bcc from --compose message Revert "send-email: extract email-parsing code into a subroutine" doc/send-email: mention handling of "reply-to" with --compose
2023-10-30Merge branch 'ob/rebase-cleanup'Junio C Hamano1-30/+14
Code clean-up. * ob/rebase-cleanup: rebase: move parse_opt_keep_empty() down rebase: handle --strategy via imply_merge() as well rebase: simplify code related to imply_merge()
2023-10-30Merge branch 'jc/commit-new-underscore-index-fix'Junio C Hamano1-4/+4
Message fix. * jc/commit-new-underscore-index-fix: commit: do not use cryptic "new_index" in end-user facing messages
2023-10-30Merge branch 'wx/merge-ort-comment-typofix'Junio C Hamano1-1/+1
Typofix. * wx/merge-ort-comment-typofix: merge-ort.c: fix typo 'neeed' to 'needed'
2023-10-30Merge branch 'ps/git-repack-doc-fixes'Junio C Hamano1-6/+3
Doc updates. * ps/git-repack-doc-fixes: doc/git-repack: don't mention nonexistent "--unpacked" option doc/git-repack: fix syntax for `-g` shorthand option
2023-10-30Merge branch 'kh/pathspec-error-wo-repository-fix'Junio C Hamano2-1/+33
The pathspec code carelessly dereferenced NULL while emitting an error message, which has been corrected. * kh/pathspec-error-wo-repository-fix: grep: die gracefully when outside repository
2023-10-30Merge branch 'ni/die-message-fix-for-git-add'Junio C Hamano1-5/+5
Message updates. * ni/die-message-fix-for-git-add: builtin/add.c: clean up die() messages
2023-10-30Merge branch 'jc/am-doc-whitespace-action-fix'Junio C Hamano1-2/+2
Docfix. * jc/am-doc-whitespace-action-fix: am: align placeholder for --whitespace option with apply
2023-10-30Merge branch 'mm/p4-symlink-with-lfs'Junio C Hamano1-0/+4
"git p4" tried to store symlinks to LFS when told, but has been fixed not to do so, because it does not make sense. * mm/p4-symlink-with-lfs: git-p4 shouldn't attempt to store symlinks in LFS
2023-10-30Merge branch 'da/t7601-style-fix'Junio C Hamano1-12/+12
Coding style update. * da/t7601-style-fix: t7601: use "test_path_is_file" etc. instead of "test -f"
2023-10-30Merge branch 'jc/update-list-references-to-lore'Junio C Hamano1-1/+1
Doc update. * jc/update-list-references-to-lore: doc: update list archive reference to use lore.kernel.org
2023-10-30Merge branch 'jc/attr-tree-config'Junio C Hamano7-3/+119
The attribute subsystem learned to honor `attr.tree` configuration that specifies which tree to read the .gitattributes files from. * jc/attr-tree-config: attr: add attr.tree for setting the treeish to read attributes from attr: read attributes from HEAD when bare repo
2023-10-30Merge branch 'sn/typo-grammo-phraso-fixes'Junio C Hamano14-42/+41
Many typos, ungrammatical sentences and wrong phrasing have been fixed. * sn/typo-grammo-phraso-fixes: t/README: fix multi-prerequisite example doc/gitk: s/sticked/stuck/ git-jump: admit to passing merge mode args to ls-files doc/diff-options: improve wording of the log.diffMerges mention doc: fix some typos, grammar and wording issues
2023-10-29reflog: fix expire --single-worktreeRené Scharfe2-3/+26
33d7bdd645 (builtin/reflog.c: use parse-options api for expire, delete subcommands, 2022-01-06) broke the option --single-worktree of git reflog expire and added a non-printable short flag for it, presumably by accident. While before it set the variable "all_worktrees" to 0, now it sets it to 1, its default value. --no-single-worktree is required now to set it to 0. Fix it by replacing the variable with one that has the opposite meaning, to avoid the negation and its potential for confusion. The new variable "single_worktree" directly captures whether --single-worktree was given. Also remove the unprintable short flag SOH (start of heading) because it is undocumented, hard to use and is likely to have been added by mistake in connection with the negation bug above. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-10-29am, rebase: fix arghelp syntax of --emptyRené Scharfe3-4/+4
Use parentheses and pipes to present alternatives in the argument help for the --empty options of git am and git rebase, like in the rest of the documentation. While at it remove a stray use of the enum empty_action value STOP_ON_EMPTY_COMMIT to indicate that no short option is present. While it has a value of 0 and thus there is no user-visible change, that enum is not meant to hold short option characters. Hard-code 0, like we do for other options without a short option. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-10-29am: simplify --show-current-patch handlingRené Scharfe1-68/+44
Let the parse-options code detect and handle the use of options that are incompatible with --show-current-patch. This requires exposing the distinction between the "raw" and "diff" sub-modes. Do that by splitting the mode RESUME_SHOW_PATCH into RESUME_SHOW_PATCH_RAW and RESUME_SHOW_PATCH_DIFF and stop tracking sub-modes in a separate struct. The result is a simpler callback function and more precise error messages. The original reports a spurious argument or a NULL pointer: $ git am --show-current-patch --show-current-patch=diff error: options '--show-current-patch=diff' and '--show-current-patch=raw' cannot be used together $ git am --show-current-patch=diff --show-current-patch error: options '--show-current-patch=(null)' and '--show-current-patch=diff' cannot be used together With this patch we get the more precise: $ git am --show-current-patch --show-current-patch=diff error: --show-current-patch=diff is incompatible with --show-current-patch $ git am --show-current-patch=diff --show-current-patch error: --show-current-patch is incompatible with --show-current-patch=diff Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-10-29parse-options: make CMDMODE errors more preciseRené Scharfe4-57/+139
Only a single PARSE_OPT_CMDMODE option can be specified for the same variable at the same time. This is enforced by get_value(), but the error messages are imprecise in three ways: 1. If a non-PARSE_OPT_CMDMODE option changes the value variable of a PARSE_OPT_CMDMODE option then an ominously vague message is shown: $ t/helper/test-tool parse-options --set23 --mode1 error: option `mode1' : incompatible with something else Worse: If the order of options is reversed then no error is reported at all: $ t/helper/test-tool parse-options --mode1 --set23 boolean: 0 integer: 23 magnitude: 0 timestamp: 0 string: (not set) abbrev: 7 verbose: -1 quiet: 0 dry run: no file: (not set) Fortunately this can currently only happen in the test helper; actual Git commands don't share the same variable for the value of options with and without the flag PARSE_OPT_CMDMODE. 2. If there are multiple options with the same value (synonyms), then the one that is defined first is shown rather than the one actually given on the command line, which is confusing: $ git am --resolved --quit error: option `quit' is incompatible with --continue 3. Arguments of PARSE_OPT_CMDMODE options are not handled by the parse-option machinery. This is left to the callback function. We currently only have a single affected option, --show-current-patch of git am. Errors for it can show an argument that was not actually given on the command line: $ git am --show-current-patch --show-current-patch=diff error: options '--show-current-patch=diff' and '--show-current-patch=raw' cannot be used together The options --show-current-patch and --show-current-patch=raw are synonyms, but the error accuses the user of input they did not actually made. Or it can awkwardly print a NULL pointer: $ git am --show-current-patch=diff --show-current-patch error: options '--show-current-patch=(null)' and '--show-current-patch=diff' cannot be used together The reasons for these shortcomings is that the current code checks incompatibility only when encountering a PARSE_OPT_CMDMODE option at the command line, and that it searches the previous incompatible option by value. Fix the first two points by checking all PARSE_OPT_CMDMODE variables after parsing each option and by storing all relevant details if their value changed. Do that whether or not the changing options has the flag PARSE_OPT_CMDMODE set. Report an incompatibility only if two options change the variable to different values and at least one of them is a PARSE_OPT_CMDMODE option. This changes the output of the first three examples above to: $ t/helper/test-tool parse-options --set23 --mode1 error: --mode1 is incompatible with --set23 $ t/helper/test-tool parse-options --mode1 --set23 error: --set23 is incompatible with --mode1 $ git am --resolved --quit error: --quit is incompatible with --resolved Store the argument of PARSE_OPT_CMDMODE options of type OPTION_CALLBACK as well to allow taking over the responsibility for compatibility checking from the callback function. The next patch will use this capability to fix the messages for git am --show-current-patch. Use a linked list for storing the PARSE_OPT_CMDMODE variables. This somewhat outdated data structure is simple and suffices, as the number of elements per command is currently only zero or one. We do support multiple different command modes variables per command, but I don't expect that we'd ever use a significant number of them. Once we do we can switch to a hashmap. Since we no longer need to search the conflicting option, the all_opts parameter of get_value() is no longer used. Remove it. Extend the tests to check for both conflicting option names, but don't insist on a particular order. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-10-29bugreport: reject positional argumentsEmily Shaffer2-0/+12
git-bugreport already rejected unrecognized flag arguments, like `--diaggnose`, but this doesn't help if the user's mistake was to forget the `--` in front of the argument. This can result in a user's intended argument not being parsed with no indication to the user that something went wrong. Since git-bugreport presently doesn't take any positionals at all, let's reject all positionals and give the user a usage hint. Signed-off-by: Emily Shaffer <nasamuffin@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-10-29t0091-bugreport: stop using i18ngrepEmily Shaffer1-1/+1
Since e6545201ad (Merge branch 'ab/detox-config-gettext', 2021-04-13), test_i18ngrep is no longer required. Quit using it in the bugreport tests, since it's setting a bad example for tests added later. Signed-off-by: Emily Shaffer <nasamuffin@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-10-28Include gettext.h in MyFirstContribution tutorialJacob Stopak1-3/+4
The tutorial in Documentation/MyFirstContribution.txt has steps to print some text using the "_" function. However, this leads to compiler errors when running "make" since "gettext.h" is not #included. Update docs with a note to #include "gettext.h" in "builtin/psuh.c". Signed-off-by: Jacob Stopak <jacob@initialcommit.io> Reviewed-by: Emily Shaffer <nasamuffin@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-10-26send-email: move validation code below process_address_listMichael Strawbridge2-28/+51
Move validation logic below processing of email address lists so that email validation gets the proper email addresses. As a side effect, some initialization needed to be moved down. In order for validation and the actual email sending to have the same initial state, the initialized variables that get modified by pre_process_file are encapsulated in a new function. This fixes email address validation errors when the optional perl module Email::Valid is installed and multiple addresses are passed in on a single to/cc argument like --to=foo@example.com,bar@example.com. A new test was added to t9001 to expose failures with this case in the future. Reported-by: Bagas Sanjaya <bagasdotme@gmail.com> Signed-off-by: Michael Strawbridge <michael.strawbridge@amd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-10-24SubmittingPatches: call gitk's command "Copy commit reference"Andrei Rybak1-1/+1
Documentation/SubmittingPatches informs the contributor that gitk's context menu command "Copy commit summary" can be used to obtain the conventional format of referencing existing commits. This command in gitk was renamed to "Copy commit reference" in commit [1], following implementation of Git's "reference" pretty format in [2]. Update mention of this gitk command in Documentation/SubmittingPatches to its new name. [1] b8b60957ce (gitk: rename "commit summary" to "commit reference", 2019-12-12) [2] commit 1f0fc1d (pretty: implement 'reference' format, 2019-11-20) Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-10-23The twenty-first batchJunio C Hamano1-0/+17
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-10-23Merge branch 'en/docfixes'Junio C Hamano171-477/+478
Documentation typo and grammo fixes. * en/docfixes: (25 commits) documentation: add missing parenthesis documentation: add missing quotes documentation: add missing fullstops documentation: add some commas where they are helpful documentation: fix whitespace issues documentation: fix capitalization documentation: fix punctuation documentation: use clearer prepositions documentation: add missing hyphens documentation: remove unnecessary hyphens documentation: add missing article documentation: fix choice of article documentation: whitespace is already generally plural documentation: fix singular vs. plural documentation: fix verb vs. noun documentation: fix adjective vs. noun documentation: fix verb tense documentation: employ consistent verb tense for a list documentation: fix subject/verb agreement documentation: remove extraneous words ...
2023-10-23Merge branch 'bc/racy-4gb-files'Junio C Hamano6-2/+62
The index file has room only for lower 32-bit of the file size in the cached stat information, which means cached stat information will have 0 in its sd_size member for a file whose size is multiple of 4GiB. This is mistaken for a racily clean path. Avoid it by storing a bogus sd_size value instead for such files. * bc/racy-4gb-files: Prevent git from rehashing 4GiB files t: add a test helper to truncate files
2023-10-23Merge branch 'jc/fail-stash-to-store-non-stash'Junio C Hamano2-0/+10
Feeding "git stash store" with a random commit that was not created by "git stash create" now errors out. * jc/fail-stash-to-store-non-stash: stash: be careful what we store
2023-10-23Merge branch 'so/diff-merges-dd'Junio C Hamano5-49/+73
"git log" and friends learned "--dd" that is a short-hand for "--diff-merges=first-parent -p". * so/diff-merges-dd: completion: complete '--dd' diff-merges: introduce '--dd' option diff-merges: improve --diff-merges documentation
2023-10-23Merge branch 'jk/chunk-bounds'Junio C Hamano15-47/+570
The codepaths that read "chunk" formatted files have been corrected to pay attention to the chunk size and notice broken files. * jk/chunk-bounds: (21 commits) t5319: make corrupted large-offset test more robust chunk-format: drop pair_chunk_unsafe() commit-graph: detect out-of-order BIDX offsets commit-graph: check bounds when accessing BIDX chunk commit-graph: check bounds when accessing BDAT chunk commit-graph: bounds-check generation overflow chunk commit-graph: check size of generations chunk commit-graph: bounds-check base graphs chunk commit-graph: detect out-of-bounds extra-edges pointers commit-graph: check size of commit data chunk midx: check size of revindex chunk midx: bounds-check large offset chunk midx: check size of object offset chunk midx: enforce chunk alignment on reading midx: check size of pack names chunk commit-graph: check consistency of fanout table midx: check size of oid lookup chunk commit-graph: check size of oid fanout chunk midx: stop ignoring malformed oid fanout chunk t: add library for munging chunk-format files ...
2023-10-23doc/git-bisect: clarify `git bisect run` syntaxJavier Mora2-4/+4
The description of the `git bisect run` command syntax at the beginning of the manpage is `git bisect run <cmd>...`, which isn't quite clear about what `<cmd>` is or what the `...` mean; one could think that it is the whole (quoted) command line with all arguments in a single string, or that it supports multiple commands, or that it doesn't accept commands with arguments at all. Change to `git bisect run <cmd> [<arg>...]` to clarify the syntax, in both the manpage and the `git bisect -h` command output. Additionally, change `--term-{new,bad}` et al to `--term-(new|bad)` for consistency with the synopsis syntax conventions. Signed-off-by: Javier Mora <cousteaulecommandant@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-10-23builtin/branch.c: adjust error messages to coding guidelinesIsoken June Ibizugbe4-47/+47
As per the CodingGuidelines document, it is recommended that error messages such as die(), error() and warning(), should start with a lowercase letter and should not end with a period. This patch adjusts tests to match updated messages. Signed-off-by: Isoken June Ibizugbe <isokenjune@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-10-21merge-ort.c: fix typo 'neeed' to 'needed'王常新1-1/+1
Signed-off-by: 王常新 <wchangxin824@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-10-20The twentieth batchJunio C Hamano1-0/+12
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-10-20Merge branch 'ps/rewritten-is-per-worktree-doc'Junio C Hamano1-3/+4
Doc update. * ps/rewritten-is-per-worktree-doc: doc/git-worktree: mention "refs/rewritten" as per-worktree refs
2023-10-20Merge branch 'ak/pretty-decorate-more-fix'Junio C Hamano2-3/+7
Unlike "git log --pretty=%D", "git log --pretty="%(decorate)" did not auto-initialize the decoration subsystem, which has been corrected. * ak/pretty-decorate-more-fix: pretty: fix ref filtering for %(decorate) formats
2023-10-20Merge branch 'vd/loose-ref-iteration-optimization'Junio C Hamano7-49/+112
The code to iterate over loose references have been optimized to reduce the number of lstat() system calls. * vd/loose-ref-iteration-optimization: files-backend.c: avoid stat in 'loose_fill_ref_dir' dir.[ch]: add 'follow_symlink' arg to 'get_dtype' dir.[ch]: expose 'get_dtype' ref-cache.c: fix prefix matching in ref iteration
2023-10-20Merge branch 'ty/merge-tree-strategy-options'Junio C Hamano4-3/+59
"git merge-tree" learned to take strategy backend specific options via the "-X" option, like "git merge" does. * ty/merge-tree-strategy-options: merge: introduce {copy|clear}_merge_options() merge-tree: add -X strategy option
2023-10-20git-push doc: more visibility for -q optionMichal Suchanek1-1/+1
The "-v" option is shown in the SYNOPSIS section near the top, but "-q" is not shown anywhere there. List "-q" alongside "-v". Signed-off-by: Michal Suchanek <msuchanek@suse.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-10-20rebase: move parse_opt_keep_empty() downOswald Buddenhagen1-13/+12
This moves it right next to parse_opt_empty(), which is a much more logical place. As a side effect, this removes the need for a forward declaration of imply_merge(). Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-10-20rebase: handle --strategy via imply_merge() as wellOswald Buddenhagen1-12/+1
At least after the successive trimming of enum rebase_type mentioned in the previous commit, this code did exactly what imply_merge() does, so just call it instead. Suggested-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-10-20rebase: simplify code related to imply_merge()Oswald Buddenhagen1-5/+1
The code's evolution left in some bits surrounding enum rebase_type that don't really make sense any more. In particular, it makes no sense to invoke imply_merge() if the type is already known not to be REBASE_APPLY, and it makes no sense to assign the type after calling imply_merge(). enum rebase_type had more values until commit a74b35081c ("rebase: drop support for `--preserve-merges`") and commit 10cdb9f38a ("rebase: rename the two primary rebase backends"). The latter commit also renamed imply_interactive() to imply_merge(). Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-10-20send-email: handle to/cc/bcc from --compose messageJeff King3-12/+31
If the user writes a message via --compose, send-email will pick up various headers like "From", "Subject", etc and use them for other patches as if they were specified on the command-line. But we don't handle "To", "Cc", or "Bcc" this way; we just tell the user "those aren't interpeted yet" and ignore them. But it seems like an obvious thing to want, especially as the same feature exists when the cover letter is generated separately by format-patch. There it is gated behind the --to-cover option, but I don't think we'd need the same control here; since we generate the --compose template ourselves based on the existing input, if the user leaves the lines unchanged then the behavior remains the same. So let's fill in the implementation; like those other headers we already handle, we just need to assign to the initial_* variables. The only difference in this case is that they are arrays, so we'll feed them through parse_address_line() to split them (just like we would when reading a single string via prompting). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-10-20Revert "send-email: extract email-parsing code into a subroutine"Jeff King2-80/+75
This reverts commit b6049542b97e7b135e0e82bf996084d461224d32. Prior to that commit, we read the results of the user editing the "--compose" message in a loop, picking out parts we cared about, and streaming the result out to a ".final" file. That commit split the reading/interpreting into two phases; we'd now read into a hash, and then pick things out of the hash. The goal was making the code more readable. And in some ways it did, because the ugly regexes are confined to the reading phase. But it also introduced several bugs, because now the two phases need to match each other. In particular: - we pick out headers like "Subject: foo" with a case-insensitive regex, and then use the user-provided header name as the key in a case-sensitive hash. So if the user wrote "subject: foo", we'd no longer recognize it as a subject. - the namespace for the hash keys conflates header names with meta information like "body". If you put "body: foo" in your message, it would be misinterpreted as the actual message body (nobody is likely to do that in practice, but it seems like an unnecessary danger). - the handling for to/cc/bcc is totally broken. The behavior before that commit is to recognize and skip those headers, with a note to the user that they are not yet handled. Not great, but OK. But after the patch, the reading side now splits the addresses into a perl array-ref. But the interpreting side doesn't handle this at all, and blindly prints the stringified array-ref value. This leads to garbage like: (mbox) Adding to: ARRAY (0x555b4345c428) from line 'To: ARRAY(0x555b4345c428)' error: unable to extract a valid address from: ARRAY (0x555b4345c428) What to do with this address? ([q]uit|[d]rop|[e]dit): Probably not a huge deal, since nobody should even try to use those headers in the first place (since they were not implemented). But the new behavior is worse, and indicative of the sorts of problems that come from having the two layers. The revert had a few conflicts, due to later work in this area from 15dc3b9161 (send-email: rename variable for clarity, 2018-03-04) and d11c943c78 (send-email: support separate Reply-To address, 2018-03-04). I've ported the changes from those commits over as part of the conflict resolution. The new tests show the bugs. Note the use of GIT_SEND_EMAIL_NOTTY in the second one. Without it, the test is happy to reach outside the test harness to the developer's actual terminal (when run with the buggy state before this patch). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-10-20doc/send-email: mention handling of "reply-to" with --composeJeff King1-5/+5
The documentation for git-send-email lists the headers handled specially by --compose in a way that implies that this is the complete set of headers that are special. But one more was added by d11c943c78 (send-email: support separate Reply-To address, 2018-03-04) and never documented. Let's add it, and reword the documentation slightly to avoid having to specify the list of headers twice (as it is growing and will continue to do so as we add new features). If you read the code, you may notice that we also handle MIME-Version specially, in that we'll avoid over-writing user-provided MIME headers. I don't think this is worth mentioning, as it's what you'd expect to happen (as opposed to the other headers, which are picked up to be used in later emails). And certainly this feature existed when the documentation was expanded in 01d3861217 (git-send-email.txt: describe --compose better, 2009-03-16), and we chose not to mention it then. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-10-20grep: die gracefully when outside repositoryKristoffer Haugsbakk2-1/+33
Die gracefully when `git grep --no-index` is run outside of a Git repository and the path is outside the directory tree. If you are not in a Git repository and say: git grep --no-index search .. You trigger a `BUG`: BUG: environment.c:213: git environment hasn't been setup Aborted (core dumped) Because `..` is a valid path which is treated as a pathspec. Then `pathspec` figures out that it is not in the current directory tree. The `BUG` is triggered when `pathspec` tries to advise the user about how the path is not in the current (non-existing) repository. Reported-by: ks1322 ks1322 <ks1322@gmail.com> Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-10-19git-p4 shouldn't attempt to store symlinks in LFSMatthew McClain1-0/+4
git-p4.py would attempt to put a symlink in LFS if its file extension matched git-p4.largeFileExtensions. Git LFS doesn't store symlinks because smudge/clean filters don't handle symlinks. They never get passed to the filter process nor the smudge/clean filters, nor could that occur without a change to the protocol or command-line interface. Unless Git learned how to send them to the filters, Git LFS would have a hard time using them in any useful way. Git LFS's goal is to move large files out of the repository history, and symlinks are functionally limited to 4 KiB or a similar size on most systems. Signed-off-by: Matthew McClain <mmcclain@noprivs.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-10-18t7601: use "test_path_is_file" etc. instead of "test -f"Dorcas AnonoLitunya1-12/+12
Some tests in t7601 use "test -f" and "test ! -f" to see if a path exists or is missing. Use test_path_is_file and test_path_is_missing helper functions to clarify these tests a bit better. This especially matters for the "missing" case because "test ! -f F" will be happy if "F" exists as a directory, but the intent of the test is that "F" should not exist, even as a directory. The updated code expresses this better. Signed-off-by: Dorcas AnonoLitunya <anonolitunya@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-10-18am: align placeholder for --whitespace option with applyJunio C Hamano1-2/+2
`git am` passes the value given to its `--whitespace` option through to the underlying `git apply`, and the value is called <action> over there. Fix the documentation for the command that calls the value <option> to say <action> instead. Note that the option help given by `git am -h` already calls the value <action>, so there is no need to make a matching change there. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-10-18The nineteenth batchJunio C Hamano1-1/+9
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-10-18Merge branch 'jc/merge-ort-attr-index-fix'Junio C Hamano2-0/+28
Fix "git merge-tree" to stop segfaulting when the --attr-source option is used. * jc/merge-ort-attr-index-fix: merge-ort: initialize repo in index state
2023-10-18Merge branch 'sn/cat-file-doc-update'Junio C Hamano2-19/+17
"git cat-file" documentation updates. * sn/cat-file-doc-update: doc/cat-file: make synopsis and description less confusing
2023-10-18Merge branch 'xz/commit-title-soft-limit-doc'Junio C Hamano3-6/+6
Doc update. * xz/commit-title-soft-limit-doc: doc: correct the 50 characters soft limit (+)