summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2022-03-18rebase: set REF_HEAD_DETACH in checkout_up_to_date()Libravatar John Cai2-0/+11
"git rebase A B" where B is not a commit should behave as if the HEAD got detached at B and then the detached HEAD got rebased on top of A. A bug however overwrites the current branch to point at B, when B is a descendant of A (i.e. the rebase ends up being a fast-forward). See [1] for the original bug report. The callstack from checkout_up_to_date() is the following: cmd_rebase() -> checkout_up_to_date() -> reset_head() -> update_refs() -> update_ref() When B is not a valid branch but an oid, rebase sets the head_name of rebase_options to NULL. This value gets passed down this call chain through the branch member of reset_head_opts also getting set to NULL all the way to update_refs(). Then update_refs() checks ropts.branch to decide whether or not to switch branches. If ropts.branch is NULL, it calls update_ref() to update HEAD. At this point however, from rebase's point of view, we want a detached HEAD. But, since checkout_up_to_date() does not set the RESET_HEAD_DETACH flag, the update_ref() call will deference HEAD and update the branch its pointing to. We want the HEAD detached at B instead. Fix this bug by adding the RESET_HEAD_DETACH flag in checkout_up_to_date if B is not a valid branch, so that once reset_head() calls update_refs(), it calls update_ref() with REF_NO_DEREF which updates HEAD directly intead of deferencing it and updating the branch that HEAD points to. Also add a test to ensure the correct behavior. [1] https://lore.kernel.org/git/YiokTm3GxIZQQUow@newk/ Reported-by: Michael McClimon <michael@mcclimon.org> Signed-off-by: John Cai <johncai86@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-03-18rebase: use test_commit helper in setupLibravatar John Cai1-7/+2
To prepare for the next commit that will test rebase with oids instead of branch names, update the rebase setup test to add a couple of tags we can use. This uses the test_commit helper so we can replace some lines that add a commit manually. Setting logAllRefUpdates is not necessary because it's on by default for repositories with a working tree. Helped-by: Phillip Wood <phillip.wood123@gmail.com> Signed-off-by: John Cai <johncai86@gmail.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
2022-02-25Merge branch 'ab/ambiguous-object-name'Libravatar Junio C Hamano2-12/+190
Error output given in response to an ambiguous object name has been improved. * ab/ambiguous-object-name: object-name: re-use "struct strbuf" in show_ambiguous_object() object-name: iterate ambiguous objects before showing header object-name: show date for ambiguous tag objects object-name: make ambiguous object output translatable object-name: explicitly handle bad tags in show_ambiguous_object() object-name: explicitly handle OBJ_BAD in show_ambiguous_object() object-name tests: add tests for ambiguous object blind spots
2022-02-24fast-import.c: use designated initializers for "partial" struct assignmentsLibravatar Ævar Arnfjörð Bjarmason1-4/+10
Change a few existing non-designated initializer assignments to use "partial" designated initializer assignments. I.e. we're now omitting the "NULL" or "0" fields and letting the initializer take care of them for us. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-02-24refspec.c: use designated initializers for "struct refspec_item"Libravatar Ævar Arnfjörð Bjarmason1-7/+7
Change the "struct refspec_item" at the top of refspec.c to use designated initializers. Let's keep the "= 0" assignments for self-documentation purposes, even though they're now redundant. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-02-24convert.c: use designated initializers for "struct stream_filter*"Libravatar Ævar Arnfjörð Bjarmason1-9/+9
Change the "struct stream_filter_vtbl" and "struct stream_filter" assignments in convert.c to use designated initializers. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-02-24userdiff.c: use designated initializers for "struct userdiff_driver"Libravatar Ævar Arnfjörð Bjarmason1-14/+22
Change the "struct userdiff_driver" assignmentns to use designated initializers, but let's keep the PATTERNS() and IPATTERN() convenience macros to avoid churn, but have them defined in terms of designated initializers. For the "driver_true" and "driver_false" let's have the compiler implicitly initialize most of the fields, but let's leave a redundant ".binary = 0" for "driver_true" to make it obvious that it's the opposite of the the ".binary = 1" for "driver_false". Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-02-24archive-*.c: use designated initializers for "struct archiver"Libravatar Ævar Arnfjörð Bjarmason2-6/+6
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>