summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2022-03-23reset: remove 'reset.refresh' config optionLibravatar Victoria Dye3-18/+4
Remove the 'reset.refresh' option, requiring that users explicitly specify '--no-refresh' if they want to skip refreshing the index. The 'reset.refresh' option was introduced in 101cee42dd (reset: introduce --[no-]refresh option to --mixed, 2022-03-11) as a replacement for the refresh-skipping behavior originally controlled by 'reset.quiet'. Although 'reset.refresh=false' functionally served the same purpose as 'reset.quiet=true', it exposed [1] the fact that the existence of a global "skip refresh" option could potentially cause problems for users. Allowing a global config option to avoid refreshing the index forces scripts using 'git reset --mixed' to defensively use '--refresh' if index refresh is expected; if that option is missing, behavior of a script could vary from user-to-user without explanation. Furthermore, globally disabling index refresh in 'reset --mixed' was initially devised as a passive performance improvement; since the introduction of the option, other changes have been made to Git (e.g., the sparse index) with a greater potential performance impact without sacrificing index correctness. Therefore, we can more aggressively err on the side of correctness and limit the cases of skipping index refresh to only when a user specifies the '--no-refresh' option. [1] https://lore.kernel.org/git/xmqqy2179o3c.fsf@gitster.g/ Signed-off-by: Victoria Dye <vdye@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-23reset: remove 'reset.quiet' config optionLibravatar Victoria Dye6-12/+2
Remove the 'reset.quiet' config option, remove '--no-quiet' documentation in 'Documentation/git-reset.txt'. In 4c3abd0551 (reset: add new reset.quiet config setting, 2018-10-23), 'reset.quiet' was introduced as a way to globally change the default behavior of 'git reset --mixed' to skip index refresh. However, now that '--quiet' does not affect index refresh, 'reset.quiet' would only serve to globally silence logging. This was not the original intention of the config setting, and there's no precedent for such a setting in other commands with a '--quiet' option, so it appears to be obsolete. In addition to the options & its documentation, remove 'reset.quiet' from the recommended config for 'scalar'. Signed-off-by: Victoria Dye <vdye@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-23reset: do not make '--quiet' disable index refreshLibravatar Victoria Dye3-39/+7
Update '--quiet' to no longer implicitly skip refreshing the index in a mixed reset. Users now have the ability to explicitly disable refreshing the index with the '--no-refresh' option, so they no longer need to use '--quiet' to do so. Moreover, we explicitly remove the refresh-skipping behavior from '--quiet' because it is completely unrelated to the stated purpose of the option: "Be quiet, only report errors." Helped-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Victoria Dye <vdye@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-14stash: make internal resets quiet and refresh indexLibravatar Victoria Dye2-2/+36
Add the options '-q' and '--refresh' to the 'git reset' executed in 'reset_head()', and '--refresh' to the 'git reset -q' executed in 'do_push_stash(...)'. 'stash' is implemented such that git commands invoked as part of it (e.g., 'clean', 'read-tree', 'reset', etc.) have their informational output silenced. However, the 'reset' in 'reset_head()' is *not* called with '-q', leading to the potential for a misleading printout from 'git stash apply --index' if the stash included a removed file: Unstaged changes after reset: D <deleted file> Not only is this confusing in its own right (since, after the reset, 'git stash' execution would stage the deletion in the index), it would be printed even when the stash was applied with the '-q' option. As a result, the messaging is removed entirely by calling 'git status' with '-q'. Additionally, because the default behavior of 'git reset -q' is to skip refreshing the index, but later operations in 'git stash' subcommands expect a non-stale index, enable '--refresh' as well. Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Victoria Dye <vdye@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-14reset: suppress '--no-refresh' advice if logging is silencedLibravatar Victoria Dye1-1/+1
If using '--quiet' or 'reset.quiet=true', do not print the 'resetnoRefresh' advice string. For applications that rely on '--quiet' disabling all non-error logs, the advice message should be suppressed accordingly. Signed-off-by: Victoria Dye <vdye@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-14reset: replace '--quiet' with '--no-refresh' in performance adviceLibravatar Victoria Dye4-10/+10
Replace references to '--quiet' with '--no-refresh' in the advice on how to skip refreshing the index. When the advice was introduced, '--quiet' was the only way to avoid the expensive 'refresh_index(...)' at the end of a mixed reset. After introducing '--no-refresh', however, '--quiet' became only a fallback option for determining refresh behavior, overridden by '--[no-]refresh' or 'reset.refresh' if either is set. To ensure users are advised to use the most reliable option for avoiding 'refresh_index(...)', replace recommendation of '--quiet' with '--[no-]refresh'. Signed-off-by: Victoria Dye <vdye@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-14reset: introduce --[no-]refresh option to --mixedLibravatar Victoria Dye3-8/+87
Add a new --[no-]refresh option that is intended to explicitly determine whether a mixed reset should end in an index refresh. Starting at 9ac8125d1a (reset: don't compute unstaged changes after reset when --quiet, 2018-10-23), using the '--quiet' option results in skipping the call to 'refresh_index(...)' at the end of a mixed reset with the goal of improving performance. However, by coupling behavior that modifies the index with the option that silences logs, there is no way for users to have one without the other (i.e., silenced logs with a refreshed index) without incurring the overhead of a separate call to 'git update-index --refresh'. Furthermore, there is minimal user-facing documentation indicating that --quiet skips the index refresh, potentially leading to unexpected issues executing commands after 'git reset --quiet' that do not themselves refresh the index (e.g., internals of 'git stash', 'git read-tree'). To mitigate these issues, '--[no-]refresh' and 'reset.refresh' are introduced to provide a dedicated mechanism for refreshing the index. When either is set, '--quiet' and 'reset.quiet' revert to controlling only whether logs are silenced and do not affect index refresh. Helped-by: Derrick Stolee <derrickstolee@github.com> Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Victoria Dye <vdye@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-14reset: revise index refresh adviceLibravatar Victoria Dye2-4/+4
Update the advice describing index refresh from "enumerate unstaged changes" to "refresh the index." Describing 'refresh_index(...)' as "enumerating unstaged changes" is not fully representative of what an index refresh is doing; more generally, it updates the properties of index entries that are affected by outside-of-index state, e.g. CE_UPTODATE, which is affected by the file contents on-disk. This distinction is relevant to operations that read the index but do not refresh first - e.g., 'git read-tree' - where a stale index may cause incorrect behavior. In addition to changing the advice message, use the "advise" function to print advice. Signed-off-by: Victoria Dye <vdye@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-09The tenth batchLibravatar Junio C Hamano1-1/+27
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-09Merge branch 'ab/help-fixes'Libravatar Junio C Hamano5-24/+187
Updates to how command line options to "git help" are handled. * ab/help-fixes: help: don't print "\n" before single-section output help: add --no-[external-commands|aliases] for use with --all help: error if [-a|-g|-c] and [-i|-m|-w] are combined help: correct usage & behavior of "git help --all" help: note the option name on option incompatibility help.c: split up list_all_cmds_help() function help tests: test "git" and "git help [-a|-g] spacing help.c: use puts() instead of printf{,_ln}() for consistency help doc: add missing "]" to "[-a|--all]"
2022-03-09Merge branch 'ab/c99-variadic-macros'Libravatar Junio C Hamano8-246/+65
Remove the escape hatch we added when we introduced the weather balloon to use variadic macros unconditionally, to make it official that we now have a hard dependency on the feature. * ab/c99-variadic-macros: C99: remove hardcoded-out !HAVE_VARIADIC_MACROS code git-compat-util.h: clarify GCC v.s. C99-specific in comment
2022-03-09Merge branch 'hn/reftable-no-empty-keys'Libravatar Junio C Hamano7-19/+136
General clean-up in reftable implementation, including clarification of the API documentation, tightening the code to honor documented length limit, etc. * hn/reftable-no-empty-keys: reftable: rename writer_stats to reftable_writer_stats reftable: add test for length of disambiguating prefix reftable: ensure that obj_id_len is >= 2 on writing reftable: avoid writing empty keys at the block layer reftable: add a test that verifies that writing empty keys fails reftable: reject 0 object_id_len Documentation: object_id_len goes up to 31
2022-03-09Merge branch 'jc/cat-file-batch-commands'Libravatar Junio C Hamano3-22/+333
"git cat-file" learns "--batch-command" mode, which is a more flexible interface than the existing "--batch" or "--batch-check" modes, to allow different kinds of inquiries made. * jc/cat-file-batch-commands: cat-file: add --batch-command mode cat-file: add remove_timestamp helper cat-file: introduce batch_mode enum to replace print_contents cat-file: rename cmdmode to transform_mode
2022-03-09Merge branch 'pw/xdiff-alloc-fail'Libravatar Junio C Hamano4-48/+51
Improve failure case behaviour of xdiff library when memory allocation fails. * pw/xdiff-alloc-fail: xdiff: handle allocation failure when merging xdiff: refactor a function xdiff: handle allocation failure in patience diff xdiff: fix a memory leak
2022-03-09Merge branch 'en/present-despite-skipped'Libravatar Junio C Hamano19-128/+311
In sparse-checkouts, files mis-marked as missing from the working tree could lead to later problems. Such files were hard to discover, and harder to correct. Automatically detecting and correcting the marking of such files has been added to avoid these problems. * en/present-despite-skipped: repo_read_index: add config to expect files outside sparse patterns Accelerate clear_skip_worktree_from_present_files() by caching Update documentation related to sparsity and the skip-worktree bit repo_read_index: clear SKIP_WORKTREE bit from files present in worktree unpack-trees: fix accidental loss of user changes t1011: add testcase demonstrating accidental loss of user modifications
2022-03-06The ninth batchLibravatar Junio C Hamano1-0/+21
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-06Merge branch 'jt/ls-files-stage-recurse'Libravatar Junio C Hamano3-4/+20
Many output modes of "ls-files" do not work with its "--recurse-submodules" option, but the "-s" mode has been taught to work with it. * jt/ls-files-stage-recurse: ls-files: support --recurse-submodules --stage
2022-03-06Merge branch 'gc/stash-on-branch-with-multi-level-name'Libravatar Junio C Hamano2-1/+12
"git checkout -b branch/with/multi/level/name && git stash" only recorded the last level component of the branch name, which has been corrected. * gc/stash-on-branch-with-multi-level-name: stash: strip "refs/heads/" with skip_prefix
2022-03-06Merge branch 'ah/advice-switch-requires-detach-to-detach'Libravatar Junio C Hamano5-11/+35
The error message given by "git switch HEAD~4" has been clarified to suggest the "--detach" option that is required. * ah/advice-switch-requires-detach-to-detach: switch: mention the --detach option when dying due to lack of a branch
2022-03-06Merge branch 'ab/c99-designated-initializers'Libravatar Junio C Hamano11-183/+193
Use designated initializers we started using in mid 2017 in more parts of the codebase that are relatively quiescent. * ab/c99-designated-initializers: fast-import.c: use designated initializers for "partial" struct assignments refspec.c: use designated initializers for "struct refspec_item" convert.c: use designated initializers for "struct stream_filter*" userdiff.c: use designated initializers for "struct userdiff_driver" archive-*.c: use designated initializers for "struct archiver" object-file: use designated initializers for "struct git_hash_algo" trace2: use designated initializers for "struct tr2_dst" trace2: use designated initializers for "struct tr2_tgt" imap-send.c: use designated initializers for "struct imap_server_conf"
2022-03-06Merge branch 'mc/index-pack-report-max-size'Libravatar Junio C Hamano2-2/+14
When "index-pack" dies due to incoming data exceeding the maximum allowed input size, include the value of the limit in the error message. * mc/index-pack-report-max-size: index-pack: clarify the breached limit
2022-03-06Merge branch 'ac/usage-string-fixups'Libravatar Junio C Hamano5-9/+9
Usage-string normalization. * ac/usage-string-fixups: amend remaining usage strings according to style guide
2022-03-06Merge branch 'ab/test-leak-diag'Libravatar Junio C Hamano1-10/+40
Random test-framework clean-up. * ab/test-leak-diag: test-lib: add "fast_unwind_on_malloc=0" to LSAN_OPTIONS test-lib: make $GIT_BUILD_DIR an absolute path test-lib: correct and assert TEST_DIRECTORY overriding test-lib: add GIT_SAN_OPTIONS, inherit [AL]SAN_OPTIONS
2022-03-06Merge branch 'ab/hook-tests'Libravatar Junio C Hamano1-41/+53
Test modernization. * ab/hook-tests: hook tests: use a modern style for "pre-push" tests hook tests: test for exact "pre-push" hook input
2022-03-06Merge branch 'en/merge-ort-plug-leaks'Libravatar Junio C Hamano1-19/+17
Leakfix. * en/merge-ort-plug-leaks: merge-ort: fix small memory leak in unique_path() merge-ort: fix small memory leak in detect_and_process_renames()
2022-03-06Merge branch 'ds/worktree-docs'Libravatar Junio C Hamano2-197/+209
Tighten the language around "working tree" and "worktree" in the docs. * ds/worktree-docs: worktree: use 'worktree' over 'working tree' worktree: use 'worktree' over 'working tree' worktree: use 'worktree' over 'working tree' worktree: use 'worktree' over 'working tree' worktree: use 'worktree' over 'working tree' worktree: use 'worktree' over 'working tree' worktree: use 'worktree' over 'working tree' worktree: extract checkout_worktree() worktree: extract copy_sparse_checkout() worktree: extract copy_filtered_worktree_config() worktree: combine two translatable messages
2022-03-06Merge branch 'jc/rerere-train-modernise'Libravatar Junio C Hamano1-1/+1
Small modernization of the rerere-train script (in contrib/). * jc/rerere-train-modernise: rerere-train: two fixes to the use of "git show -s"
2022-03-06Merge branch 'rs/bisect-executable-not-found'Libravatar Junio C Hamano4-14/+125
A not-so-common mistake is to write a script to feed "git bisect run" without making it executable, in which case all tests will exit with 126 or 127 error codes, even on revisions that are marked as good. Try to recognize this situation and stop iteration early. * rs/bisect-executable-not-found: bisect--helper: double-check run command on exit code 126 and 127 bisect: document run behavior with exit codes 126 and 127 bisect--helper: release strbuf and strvec on run error bisect--helper: report actual bisect_state() argument on error
2022-03-06Merge branch 'en/sparse-checkout-fixes'Libravatar Junio C Hamano2-7/+161
Further polishing of "git sparse-checkout". * en/sparse-checkout-fixes: sparse-checkout: reject arguments in cone-mode that look like patterns sparse-checkout: error or warn when given individual files sparse-checkout: pay attention to prefix for {set, add} sparse-checkout: correctly set non-cone mode when expected sparse-checkout: correct reapply's handling of options
2022-03-06Merge branch 'cg/t3903-modernize'Libravatar Junio C Hamano2-9/+41
Test modernization. * cg/t3903-modernize: tests: make the code more readable tests: allow testing if a path is truly a file or a directory t/t3903-stash.sh: replace test [-d|-f] with test_path_is_*
2022-03-01repo_read_index: add config to expect files outside sparse patternsLibravatar Elijah Newren7-1/+66
Typically with sparse checkouts, we expect files outside the sparsity patterns to be marked as SKIP_WORKTREE and be missing from the working tree. Sometimes this expectation would be violated however; including in cases such as: * users grabbing files from elsewhere and writing them to the worktree (perhaps by editing a cached copy in an editor, copying/renaming, or even untarring) * various git commands having incomplete or no support for the SKIP_WORKTREE bit[1,2] * users attempting to "abort" a sparse-checkout operation with a not-so-early Ctrl+C (updating $GIT_DIR/info/sparse-checkout and the working tree is not atomic)[3]. When the SKIP_WORKTREE bit in the index did not reflect the presence of the file in the working tree, it traditionally caused confusion and was difficult to detect and recover from. So, in a sparse checkout, since af6a51875a (repo_read_index: clear SKIP_WORKTREE bit from files present in worktree, 2022-01-14), Git automatically clears the SKIP_WORKTREE bit at index read time for entries corresponding to files that are present in the working tree. There is another workflow, however, where it is expected that paths outside the sparsity patterns appear to exist in the working tree and that they do not lose the SKIP_WORKTREE bit, at least until they get modified. A Git-aware virtual file system[4] takes advantage of its position as a file system driver to expose all files in the working tree, fetch them on demand using partial clone on access, and tell Git to pay attention to them on demand by updating the sparse checkout pattern on writes. This means that commands like "git status" only have to examine files that have potentially been modified, whereas commands like "ls" are able to show the entire codebase without requiring manual updates to the sparse checkout pattern. Thus since af6a51875a, Git with such Git-aware virtual file systems unsets the SKIP_WORKTREE bit for all files and commands like "git status" have to fetch and examine them all. Introduce a configuration setting sparse.expectFilesOutsideOfPatterns to allow limiting the tracked set of files to a small set once again. A Git-aware virtual file system or other application that wants to maintain files outside of the sparse checkout can set this in a repository to instruct Git not to check for the presence of SKIP_WORKTREE files. The setting defaults to false, so most users of sparse checkout will still get the benefit of an automatically updating index to recover from the variety of difficult issues detailed in af6a51875a for paths with SKIP_WORKTREE set despite the path being present. [1] https://lore.kernel.org/git/xmqqbmb1a7ga.fsf@gitster-ct.c.googlers.com/ [2] The three long paragraphs in the middle of https://lore.kernel.org/git/CABPp-BH9tju7WVm=QZDOvaMDdZbpNXrVWQdN-jmfN8wC6YVhmw@mail.gmail.com/ [3] https://lore.kernel.org/git/CABPp-BFnFpzwGC11TLoLs8YK5yiisA5D5-fFjXnJsbESVDwZsA@mail.gmail.com/ [4] such as the vfsd described in https://lore.kernel.org/git/20220207190320.2960362-1-jonathantanmy@google.com/ Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Elijah Newren <newren@gmail.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-02-28test-lib: add "fast_unwind_on_malloc=0" to LSAN_OPTIONSLibravatar Ævar Arnfjörð Bjarmason1-0/+1
Add "fast_unwind_on_malloc=0" to LSAN_OPTIONS to get more meaningful stack traces from LSAN. This isn't required under ASAN which will emit traces such as this one for a leak in "t/t0006-date.sh": $ ASAN_OPTIONS=detect_leaks=1 ./t0006-date.sh -vixd [...] Direct leak of 3 byte(s) in 1 object(s) allocated from: #0 0x488b94 in strdup (t/helper/test-tool+0x488b94) #1 0x9444a4 in xstrdup wrapper.c:29:14 #2 0x5995fa in parse_date_format date.c:991:24 #3 0x4d2056 in show_dates t/helper/test-date.c:39:2 #4 0x4d174a in cmd__date t/helper/test-date.c:116:3 #5 0x4cce89 in cmd_main t/helper/test-tool.c:127:11 #6 0x4cd1e3 in main common-main.c:52:11 #7 0x7fef3c695e49 in __libc_start_main csu/../csu/libc-start.c:314:16 #8 0x422b09 in _start (t/helper/test-tool+0x422b09) SUMMARY: AddressSanitizer: 3 byte(s) leaked in 1 allocation(s). Aborted Whereas LSAN would emit this instead: $ ./t0006-date.sh -vixd [...] Direct leak of 3 byte(s) in 1 object(s) allocated from: #0 0x4323b8 in malloc (t/helper/test-tool+0x4323b8) #1 0x7f2be1d614aa in strdup string/strdup.c:42:15 SUMMARY: LeakSanitizer: 3 byte(s) leaked in 1 allocation(s). Aborted Now we'll instead git this sensible stack trace under LSAN. I.e. almost the same one (but starting with "malloc", as is usual for LSAN) as under ASAN: Direct leak of 3 byte(s) in 1 object(s) allocated from: #0 0x4323b8 in malloc (t/helper/test-tool+0x4323b8) #1 0x7f012af5c4aa in strdup string/strdup.c:42:15 #2 0x5cb164 in xstrdup wrapper.c:29:14 #3 0x495ee9 in parse_date_format date.c:991:24 #4 0x453aac in show_dates t/helper/test-date.c:39:2 #5 0x453782 in cmd__date t/helper/test-date.c:116:3 #6 0x451d95 in cmd_main t/helper/test-tool.c:127:11 #7 0x451f1e in main common-main.c:52:11 #8 0x7f012aef5e49 in __libc_start_main csu/../csu/libc-start.c:314:16 #9 0x42e0a9 in _start (t/helper/test-tool+0x42e0a9) SUMMARY: LeakSanitizer: 3 byte(s) leaked in 1 allocation(s). Aborted As the option name suggests this does make things slower, e.g. for t0001-init.sh we're around 10% slower: $ hyperfine -L v 0,1 'LSAN_OPTIONS=fast_unwind_on_malloc={v} make T=t0001-init.sh' -r 3 Benchmark 1: LSAN_OPTIONS=fast_unwind_on_malloc=0 make T=t0001-init.sh Time (mean ± σ): 2.135 s ± 0.015 s [User: 1.951 s, System: 0.554 s] Range (min … max): 2.122 s … 2.152 s 3 runs Benchmark 2: LSAN_OPTIONS=fast_unwind_on_malloc=1 make T=t0001-init.sh Time (mean ± σ): 1.981 s ± 0.055 s [User: 1.769 s, System: 0.488 s] Range (min … max): 1.941 s … 2.044 s 3 runs Summary 'LSAN_OPTIONS=fast_unwind_on_malloc=1 make T=t0001-init.sh' ran 1.08 ± 0.03 times faster than 'LSAN_OPTIONS=fast_unwind_on_malloc=0 make T=t0001-init.sh' I think that's more than worth it to get the more meaningful stack traces, we can always provide LSAN_OPTIONS=fast_unwind_on_malloc=0 for one-off "fast" runs. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-02-28test-lib: make $GIT_BUILD_DIR an absolute pathLibravatar Ævar Arnfjörð Bjarmason1-2/+3
Change the GIT_BUILD_DIR from a path like "/path/to/build/t/.." to "/path/to/build". The "TEST_DIRECTORY" here is already made an absolute path a few lines above this. We could simply do $(cd "$TEST_DIRECTORY"/.." && pwd) here, but as noted in the preceding commit the "$TEST_DIRECTORY" can't be anything except the path containing this test-lib.sh file at this point, so we can more cheaply and equally strip the "/t" off the end. This change will be helpful to LSAN_OPTIONS which will want to strip the build directory path from filenames, which we couldn't do if we had a "/.." in there. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-02-28test-lib: correct and assert TEST_DIRECTORY overridingLibravatar Ævar Arnfjörð Bjarmason1-5/+17
Correct a misleading comment added by me in 62f539043c7 (test-lib: Allow overriding of TEST_DIRECTORY, 2010-08-19), and add an assertion that TEST_DIRECTORY cannot point to any directory except the "t" directory in the top-level of git.git. This assertion is in effect not new, since we'd already die if that wasn't the case[1], but it and the updated commentary help to make that clearer. The existing comments were also on the wrong arms of the "if". I.e. the "allow tests to override this" was on the "test -z" arm. That came about due to a combination of 62f539043c7 and 85176d72513 (test-lib.sh: convert $TEST_DIRECTORY to an absolute path, 2013-11-17). Those earlier comments could be read as allowing the "$TEST_DIRECTORY" to be some path outside of t/. As explained in the updated comment that's impossible, rather it was meant for *tests* that ran outside of t/, i.e. the "t0000-basic.sh" tests that use "lib-subtest.sh". Those tests have a different working directory, but they set the "TEST_DIRECTORY" to the same path for bootstrapping. The comments now reflect that, and further comment on why we have a hard dependency on this. 1. https://lore.kernel.org/git/220222.86o82z8als.gmgdl@evledraar.gmail.com/ Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-02-28test-lib: add GIT_SAN_OPTIONS, inherit [AL]SAN_OPTIONSLibravatar Ævar Arnfjörð Bjarmason1-4/+20
Change our ASAN_OPTIONS and LSAN_OPTIONS to set defaults for those variables, rather than punting out entirely if we already have them in the environment. We want to take any user-provided settings over our own, but we can do that by prepending our defaults to the variable. The libsanitizer options parsing has "last option wins" semantics. It's now possible to do e.g.: LSAN_OPTIONS=report_objects=1 ./t0006-date.sh And not have the "report_objects=1" setting overwrite our sensible default of "abort_on_error=1", but by prepending to the list we ensure that: LSAN_OPTIONS=report_objects=1:abort_on_error=0 ./t0006-date.sh Will take the desired "abort_on_error=0" over our default. See b0f4c9087e1 (t: support clang/gcc AddressSanitizer, 2014-12-08) for the original pattern being altered here, and 85b81b35ff9 (test-lib: set LSAN_OPTIONS to abort by default, 2017-09-05) for when LSAN_OPTIONS was added in addition to the then-existing ASAN_OPTIONS. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-02-27rerere-train: two fixes to the use of "git show -s"Libravatar Junio C Hamano1-1/+1
The script uses "git show -s" to display the title of the merge commit being studied, without explicitly disabling the pager, which is not a safe thing to do in a script. For example, when the pager is set to "less" with "-SF" options (-S tells the pager not to fold lines but allow horizontal scrolling to show the overly long lines, -F tells the pager not to wait if the output in its entirety is shown on a single page), and the title of the merge commit is longer than the width of the terminal, the pager will wait until the end-user tells it to quit after showing the single line. Explicitly disable the pager with this "git show" invocation to fix this. The command uses the "--pretty=format:..." format, which adds LF in between each pair of commits it outputs, which means that the label for the merge being learned from will be followed by the next message on the same line. "--pretty=tformat:..." is what we should instead, which adds LF after each commit, or a more modern way to spell it, i.e. "--format=...". This existing breakage becomes easier to see, now we no longer use the pager. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-02-25switch: mention the --detach option when dying due to lack of a branchLibravatar Alex Henrie5-11/+35
Users who are accustomed to doing `git checkout <tag>` assume that `git switch <tag>` will do the same thing. Inform them of the --detach option so they aren't left wondering why `git switch` doesn't work but `git checkout` does. Signed-off-by: Alex Henrie <alexhenrie24@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-02-25The eighth batchLibravatar Junio C Hamano1-0/+29
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-02-25Merge branch 'tb/coc-plc-update'Libravatar Junio C Hamano1-1/+1
Document Taylor as a new member of Git PLC at SFC. Welcome. * tb/coc-plc-update: CODE_OF_CONDUCT.md: update PLC members list
2022-02-25Merge branch 'en/ort-inner-merge-conflict-report'Libravatar Junio C Hamano1-0/+5
Messages "ort" merge backend prepares while dealing with conflicted paths were unnecessarily confusing since it did not differentiate inner merges and outer merges. * en/ort-inner-merge-conflict-report: merge-ort: make informational messages from recursive merges clearer
2022-02-25Merge branch 'rs/pcre-invalid-utf8-fix-fix'Libravatar Junio C Hamano1-1/+1
Workaround we have for versions of PCRE2 before their version 10.36 were in effect only for their versions newer than 10.36 by mistake, which has been corrected. * rs/pcre-invalid-utf8-fix-fix: grep: fix triggering PCRE2_NO_START_OPTIMIZE workaround
2022-02-25Merge branch 'ds/core-untracked-cache-config'Libravatar Junio C Hamano1-1/+3
Setting core.untrackedCache to true failed to add the untracked cache extension to the index. * ds/core-untracked-cache-config: dir: force untracked cache with core.untrackedCache
2022-02-25Merge branch 'ab/diff-free-more'Libravatar Junio C Hamano5-9/+5
Leakfixes. * ab/diff-free-more: diff.[ch]: have diff_free() free options->parseopts diff.[ch]: have diff_free() call clear_pathspec(opts.pathspec)
2022-02-25Merge branch 'ab/date-mode-release'Libravatar Junio C Hamano20-54/+112
Plug (some) memory leaks around parse_date_format(). * ab/date-mode-release: date API: add and use a date_mode_release() date API: add basic API docs date API: provide and use a DATE_MODE_INIT date API: create a date.h, split from cache.h cache.h: remove always unused show_date_human() declaration
2022-02-25Merge branch 'jc/name-rev-stdin'Libravatar Junio C Hamano1-1/+1
Finishing touches to an earlier "name-rev --annotate-stdin" series. * jc/name-rev-stdin: name-rev: replace --stdin with --annotate-stdin in synopsis
2022-02-25Merge branch 'ab/grep-patterntype'Libravatar Junio C Hamano9-206/+195
Some code clean-up in the "git grep" machinery. * ab/grep-patterntype: grep: simplify config parsing and option parsing grep.c: do "if (bool && memchr())" not "if (memchr() && bool)" grep.h: make "grep_opt.pattern_type_option" use its enum grep API: call grep_config() after grep_init() grep.c: don't pass along NULL callback value built-ins: trust the "prefix" from run_builtin() grep tests: add missing "grep.patternType" config tests grep tests: create a helper function for "BRE" or "ERE" log tests: check if grep_config() is called by "log"-like cmds grep.h: remove unused "regex_t regexp" from grep_opt
2022-02-25Merge branch 'js/apply-partial-clone-filters-recursively'Libravatar Junio C Hamano8-8/+175
"git clone --filter=... --recurse-submodules" only makes the top-level a partial clone, while submodules are fully cloned. This behaviour is changed to pass the same filter down to the submodules. * js/apply-partial-clone-filters-recursively: clone, submodule: pass partial clone filters to submodules
2022-02-25Merge branch 'ja/i18n-common-messages'Libravatar Junio C Hamano42-85/+137
Unify more messages to help l10n. * ja/i18n-common-messages: i18n: fix some misformated placeholders in command synopsis i18n: remove from i18n strings that do not hold translatable parts i18n: factorize "invalid value" messages i18n: factorize more 'incompatible options' messages
2022-02-25Merge branch 'ab/only-single-progress-at-once'Libravatar Junio C Hamano6-76/+170
Further tweaks on progress API. * ab/only-single-progress-at-once: pack-bitmap-write.c: don't return without stop_progress() progress API: unify stop_progress{,_msg}(), fix trace2 bug progress.c: refactor stop_progress{,_msg}() to use helpers progress.c: use dereferenced "progress" variable, not "(*p_progress)" progress.h: format and be consistent with progress.c naming progress.c tests: test some invalid usage progress.c tests: make start/stop commands on stdin progress.c test helper: add missing braces leak tests: fix a memory leak in "test-progress" helper
2022-02-25Merge branch 'ds/sparse-checkout-requires-per-worktree-config'Libravatar Junio C Hamano13-49/+353
"git sparse-checkout" wants to work with per-worktree configuration, but did not work well in a worktree attached to a bare repository. * ds/sparse-checkout-requires-per-worktree-config: config: make git_configset_get_string_tmp() private worktree: copy sparse-checkout patterns and config on add sparse-checkout: set worktree-config correctly config: add repo_config_set_worktree_gently() worktree: create init_worktree_config() Documentation: add extensions.worktreeConfig details