aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2022-12-14Merge branch 'rs/multi-filter-args'Junio C Hamano4-65/+74
Fix a bug where `pack-objects` would not respect multiple `--filter` arguments when invoked directly. * rs/multi-filter-args: list-objects-filter: remove OPT_PARSE_LIST_OBJECTS_FILTER_INIT() pack-objects: simplify --filter handling pack-objects: fix handling of multiple --filter options t5317: demonstrate failure to handle multiple --filter options t5317: stop losing return codes of git ls-files
2022-12-14Merge branch 'tl/pack-bitmap-absolute-paths'Junio C Hamano2-15/+29
The pack-bitmap machinery is taught to log the paths of redundant bitmap(s) to trace2 instead of stderr. * tl/pack-bitmap-absolute-paths: pack-bitmap.c: trace bitmap ignore logs when midx-bitmap is found pack-bitmap.c: break out of the bitmap loop early if not tracing pack-bitmap.c: avoid exposing absolute paths pack-bitmap.c: remove unnecessary "open_pack_index()" calls
2022-12-14Merge branch 'yn/git-jump-emacs'Junio C Hamano2-4/+51
"git jump" (in contrib/) learned to present the "quickfix list" to its standard output (instead of letting it consumed by the editor it invokes), and learned to also drive emacs/emacsclient. * yn/git-jump-emacs: git-jump: invoke emacs/emacsclient git-jump: move valid-mode check earlier git-jump: add an optional argument '--stdout'
2022-12-14Merge branch 'ab/various-leak-fixes'Junio C Hamano77-48/+142
Various leak fixes. * ab/various-leak-fixes: built-ins: use free() not UNLEAK() if trivial, rm dead code revert: fix parse_options_concat() leak cherry-pick: free "struct replay_opts" members rebase: don't leak on "--abort" connected.c: free the "struct packed_git" sequencer.c: fix "opts->strategy" leak in read_strategy_opts() ls-files: fix a --with-tree memory leak revision API: call graph_clear() in release_revisions() unpack-file: fix ancient leak in create_temp_file() built-ins & libs & helpers: add/move destructors, fix leaks dir.c: free "ident" and "exclude_per_dir" in "struct untracked_cache" read-cache.c: clear and free "sparse_checkout_patterns" commit: discard partial cache before (re-)reading it {reset,merge}: call discard_index() before returning tests: mark tests as passing with SANITIZE=leak
2022-12-14Merge branch 'kz/merge-tree-merge-base'Junio C Hamano3-12/+131
"merge-tree" learns a new `--merge-base` option. * kz/merge-tree-merge-base: docs: fix description of the `--merge-base` option merge-tree.c: allow specifying the merge-base when --stdin is passed merge-tree.c: add --merge-base=<commit> option
2022-12-14Merge branch 'dd/git-bisect-builtin'Junio C Hamano7-124/+225
`git bisect` becomes a builtin. * dd/git-bisect-builtin: bisect; remove unused "git-bisect.sh" and ".gitignore" entry Turn `git bisect` into a full built-in bisect--helper: log: allow arbitrary number of arguments bisect--helper: handle states directly bisect--helper: emit usage for "git bisect" bisect test: test exit codes on bad usage bisect--helper: identify as bisect when report error bisect-run: verify_good: account for non-negative exit status bisect run: keep some of the post-v2.30.0 output bisect: fix output regressions in v2.30.0 bisect: refactor bisect_run() to match CodingGuidelines bisect tests: test for v2.30.0 "bisect run" regressions
2022-12-14object-file: inline write_buffer()René Scharfe1-9/+2
write_buffer() reports the OS error if it is unable to write. Its only caller dies in that case, giving some more context in its last message. Inline this function and show only a single error message that includes both the context (writing a loose object file) and the OS error. This shortens the code and simplifies the output. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-12-13userdiff: mark unused parameter in internal callbackJeff King1-1/+2
Since f12fa9ee6c (userdiff: add and use for_each_userdiff_driver(), 2021-04-08), lookup of userdiffs is done with a generic for_each_userdiff_driver(). But the name lookup doesn't use the "type" field, of course. We can't get rid of that field from the generic interface because it is used by t/helper/test-userdiff.c. So mark it as unused in this instance to silence -Wunused-parameter. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-12-13list-objects-filter: mark unused parameters in virtual functionsJeff King1-15/+15
The "struct filter" abstract type defines several virtual function pointers. Not all of the concrete functions need every parameter, but they have to conform to the generic interface. Mark unused ones to silence -Wunused-parameter. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-12-13diff: mark unused parameters in callbacksJeff King15-30/+41
The diff code provides a format_callback interface, but not every callback needs each parameter (e.g., the "opt" and "data" parameters are frequently left unused). Likewise for the output_prefix callback, the low-level change/add_remove interfaces, the callbacks used by xdi_diff(), etc. Mark unused arguments in the callback implementations to quiet -Wunused-parameter. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-12-13xdiff: mark unused parameter in xdl_call_hunk_func()Jeff King1-1/+1
This function is used interchangeably with xdl_emit via a function pointer, so we can't just drop the unused parameter. Mark it to silence -Wunused-parameter. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-12-13xdiff: drop unused parameter in def_ff()Jeff King1-2/+2
The def_ff() function is the default "find_func" for finding hunk headers. It has never used its "priv" argument since it was introduced in f258475a6e (Per-path attribute based hunk header selection., 2007-07-06). But back then we used a function pointer to switch between a caller-provided function and the default, so the two had to conform to the same interface. In ff2981f724 (xdiff: factor out match_func_rec(), 2016-05-28), that pointer indirection went away in favor of code which directly calls either of the two functions. So there's no need for def_ff() to retain this unused parameter. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-12-13ws: drop unused parameter from ws_blank_line()Jeff King4-10/+9
We take a ws_rule parameter, but have never looked at it since the function was added in 877f23ccb8 (Teach "diff --check" about new blank lines at end, 2008-06-26). A comment in the function does mention how we _could_ use it, but nobody has felt the need to do so for over a decade. We could keep it around as reminder of what could be done, but the comment serves that purpose. And in the meantime, it triggers -Wunused-parameter. So let's drop it, which in turn allows us to drop similar arguments further up the callstack. I've left the comment intact. It does still say "ws_rule", but that name is used consistently in the whitespace code, so the meaning is clear. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-12-13list-objects: drop process_gitlink() functionJeff King1-32/+1
Our object graph traversal code has a process_gitlink() function which we call when we see a gitlink entry. The function does nothing; it was added in the early days of gitlinks by 6e2f441bd4 (Teach git list-objects logic to not follow gitlinks, 2007-04-13). The comment above the function talks about some things we _could_ do. But in the intervening 15 years, nobody has touched the function, and the submodule code usually makes its own decisions about when and how to examine the links. At the generic traversal layer, we can't assume that the pointed-to commit is available. Let's drop this placeholder that isn't really helping anything. This silences some -Wunused-parameter warnings, and also gets rid of a crufty use of "const unsigned char *" to pass a raw hash value. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-12-13blob: drop unused parts of parse_blob_buffer()Jeff King3-7/+4
Our parse_blob_buffer() takes a ptr/len combo, just like parse_tree_buffer(), etc, and returns success or failure. But it doesn't actually do anything with them; we just set the "parsed" flag in the object and return success, without even looking at the contents. There could be some value to keeping these unused parameters: - it's consistent with the parse functions for other object types. But we already lost that consistency in 837d395a5c (Replace parse_blob() with an explanatory comment, 2010-01-18). - As the comment from 837d395a5c explains, callers are supposed to make sure they have the object content available. So in theory asking for these parameters could serve as a signal. But there are only two callers, and one of them always passes NULL (after doing a streaming check of the object hash). This shows that there aren't likely to be a lot of callers (since everyone either uses the type-generic parse functions, or handles blobs individually), and that they need to take special care anyway (because we usually want to avoid loading whole blobs in memory if we can avoid it). So let's just drop these unused parameters, and likewise the useless return value. While we're touching the header file, let's move the declaration of parse_blob_buffer() right below that explanatory comment, where it's more likely to be seen by people looking for the function. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-12-13ls-refs: use repository parameter to iterate refsJeff King4-10/+15
The ls_refs() function (for the v2 protocol command of the same name) takes a repository parameter (like all v2 commands), but ignores it. It should use it to access the refs. This isn't a bug in practice, since we only call this function when serving upload-pack from the main repository. But it's an awkward gotcha, and it causes -Wunused-parameter to complain. The main reason we don't use the repository parameter is that the ref iteration interface we call doesn't have a "refs_" variant that takes a ref_store. However we can easily add one. In fact, since there is only one other caller (in ref-filter.c), there is no need to maintain the non-repository wrapper; that caller can just use the_repository. It's still a long way from consistently using a repository object, but it's one small step in the right direction. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-12-13server_supports_v2(): use a separate function for die_on_errorJeff King3-16/+20
The server_supports_v2() helper lets a caller find out if the server supports a feature, and will optionally die if it's not supported. This makes the return value confusing, as it's only meaningful when the function is not asked to die. Coverity flagged a new call like: /* check that we support "foo" */ server_supports_v2("foo", 1); complaining that we usually checked the return value, but this time we didn't. But this call is correct, and other ones that did: if (server_supports_v2("foo", 1)) do_something_with_foo(); are "wrong", in the sense that we know the conditional will always be true (but there's no bug; the code is simply misleading). Let's split the "die" behavior into its own function which returns void, and modify each caller to use the correct one. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-12-13am: don't pass strvec to apply_parse_options()René Scharfe1-1/+11
apply_parse_options() passes the array of argument strings to parse_options(), which removes recognized options. The removed strings are not freed, though. Make a copy of the strvec to pass to the function to retain the pointers of its strings, so we release them all at the end. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-12-13commit: skip already cleared parents in clear_commit_marks_1()René Scharfe1-2/+4
Don't put clean parents on the pending list, as they and their ancestors don't need any treatment and would be skipped later anyway. This saves the allocation and release of a commit list item in ca. 20% of the cases during a run of the test suite. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-12-13reflog: clear leftovers in reflog_expiry_cleanup()René Scharfe1-1/+3
reflog_expiry_prepare() calls mark_reachable(), which recurively flags commits as REACHABLE. The traversal stops beyond a certain age threshold; the boundary commits also marked as REACHABLE and put back into mark_list at the end. unreachable() finishes the traversal down to the roots if necessary -- but if all interesting commits are younger than the age threshold then only recent commits need to be visited. When this optimization works then the boundary commits still sit there in mark_list at the end. Clear their REACHABLE flag and release the commit list allocations. While at it remove a duplicate code line from mark_reachable(); the same flag is already set five lines up. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-12-13Git 2.39.1v2.39.1Junio C Hamano3-2/+7
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-12-13Sync with 2.38.3Junio C Hamano21-125/+567
2022-12-13Git 2.38.3v2.38.3Junio C Hamano3-2/+7
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-12-13Sync with Git 2.37.5Junio C Hamano20-125/+562
2022-12-13Git 2.37.5v2.37.5Junio C Hamano3-2/+7
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-12-13Merge branch 'maint-2.36' into maint-2.37Junio C Hamano19-125/+557
2022-12-13Git 2.36.4v2.36.4Junio C Hamano3-2/+7
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-12-13Merge branch 'maint-2.35' into maint-2.36Junio C Hamano18-125/+552
2022-12-13Git 2.35.6v2.35.6Junio C Hamano3-2/+7
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-12-13Merge branch 'maint-2.34' into maint-2.35Junio C Hamano17-125/+547
2022-12-13Git 2.34.6v2.34.6Junio C Hamano3-2/+7
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-12-13Merge branch 'maint-2.33' into maint-2.34Junio C Hamano17-125/+546
2022-12-13Git 2.33.6v2.33.6Junio C Hamano3-2/+7
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-12-13Sync with Git 2.32.5Junio C Hamano16-125/+541
2022-12-13Git 2.32.5v2.32.5Junio C Hamano3-2/+10
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-12-13Merge branch 'ps/attr-limits-with-fsck' into maint-2.32Junio C Hamano3-43/+130
2022-12-13Sync with Git 2.31.6Junio C Hamano12-82/+403
2022-12-13Git 2.31.6v2.31.6Junio C Hamano3-2/+7
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-12-13Sync with Git 2.30.7Junio C Hamano11-82/+402
2022-12-13Git 2.30.7v2.30.7Junio C Hamano3-2/+88
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-12-13http-fetch: invoke trace2_cmd_name()Jonathan Tan1-0/+3
ee4512ed48 ("trace2: create new combined trace facility", 2019-02- 22) introduced trace2_cmd_name() and taught both the Git built-ins and some non-built-ins to use it. However, http-fetch was not one of them (perhaps due to its low usage at the time). Teach http-fetch to invoke this function. After this patch, this function will be invoked right after argument parsing, just like in remote-curl.c. Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-12-13help.c: fix autocorrect in work tree for bare repositorySimon Gerber2-1/+7
Currently, auto correction doesn't work reliably for commands which must run in a work tree (e.g. `git status`) in Git work trees which are created from a bare repository. As far as I'm able to determine, this has been broken since commit 659fef199f (help: use early config when autocorrecting aliases, 2017-06-14), where the call to `git_config()` in `help_unknown_cmd()` was replaced with a call to `read_early_config()`. From what I can tell, the actual cause for the unexpected error is that we call `git_default_config()` in the `git_unknown_cmd_config` callback instead of simply returning `0` for config entries which we aren't interested in. Calling `git_default_config()` in this callback to `read_early_config()` seems like a bad idea since those calls will initialize a bunch of state in `environment.c` (among other things `is_bare_repository_cfg`) before we've properly detected that we're running in a work tree. All other callbacks provided to `read_early_config()` appear to only extract their configurations while simply returning `0` for all other config keys. This commit changes the `git_unknown_cmd_config` callback to not call `git_default_config()`. Instead we also simply return `0` for config keys which we're not interested in. Additionally the commit adds a new test case covering `help.autocorrect` in a work tree created from a bare clone. Signed-off-by: Simon Gerber <gesimu@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-12-13tests(mingw): avoid very slow `mingw_test_cmp`Johannes Schindelin2-67/+1
When Git's test suite uses `test_cmp`, it is not actually trying to compare binary files as the name `cmp` would suggest to users familiar with Unix' tools, but the tests instead verify that actual output matches the expected text. On Unix, `cmp` works well enough for Git's purposes because only Line Feed characters are used as line endings. However, on Windows, while most tools accept Line Feeds as line endings, many tools produce Carriage Return + Line Feed line endings, including some of the tools used by the test suite (which are therefore provided via Git for Windows SDK). Therefore, `cmp` would frequently fail merely due to different line endings. To accommodate for that, the `mingw_test_cmp` function was introduced into Git's test suite to perform a line-by-line comparison that ignores line endings. This function is a Bash function that is only used on Windows, everywhere else `cmp` is used. This is a double whammy because `cmp` is fast, and `mingw_test_cmp` is slow, even more so on Windows because it is a Bash script function, and Bash scripts are known to run particularly slowly on Windows due to Bash's need for the POSIX emulation layer provided by the MSYS2 runtime. The commit message of 32ed3314c104 (t5351: avoid using `test_cmp` for binary data, 2022-07-29) provides an illuminating account of the consequences: On Windows, the platform on which Git could really use all the help it can get to improve its performance, the time spent on one entire test script was reduced from half an hour to less than half a minute merely by avoiding a single call to `mingw_test_cmp` in but a single test case. Learning the lesson to avoid shell scripting wherever possible, the Git for Windows project implemented a minimal replacement for `mingw_test_cmp` in the form of a `test-tool` subcommand that parses the input files line by line, ignoring line endings, and compares them. Essentially the same thing as `mingw_test_cmp`, but implemented in C instead of Bash. This solution served the Git for Windows project well, over years. However, when this solution was finally upstreamed, the conclusion was reached that a change to use `git diff --no-index` instead of `mingw_test_cmp` was more easily reviewed and hence should be used instead. The reason why this approach was not even considered in Git for Windows is that in 2007, there was already a motion on the table to use Git's own diff machinery to perform comparisons in Git's test suite, but it was dismissed in https://lore.kernel.org/git/xmqqbkrpo9or.fsf@gitster.g/ as undesirable because tests might potentially succeed due to bugs in the diff machinery when they should not succeed, and those bugs could therefore hide regressions that the tests try to prevent. By the time Git for Windows' `mingw-test-cmp` in C was finally contributed to the Git mailing list, reviewers agreed that the diff machinery had matured enough and should be used instead. When the concern was raised that the diff machinery, due to its complexity, would perform substantially worse than the test helper originally implemented in the Git for Windows project, a test demonstrated that these performance differences are well lost within the 100+ minutes it takes to run Git's test suite on Windows. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-12-12Git 2.39v2.39.0Junio C Hamano1-1/+1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-12-12Merge tag 'l10n-2.39.0-rnd1' of https://github.com/git-l10n/git-poJunio C Hamano9-3717/+5514
l10n-2.39.0-rnd1 * tag 'l10n-2.39.0-rnd1' of https://github.com/git-l10n/git-po: l10n: zh_TW.po: Git 2.39-rc2 l10n: tr: v2.39.0 updates l10n: Update Catalan translation l10n: bg.po: Updated Bulgarian translation (5501t) l10n: de.po: update German translation l10n: zh_CN v2.39.0 round 1 l10n: fr: v2.39 rnd 1 l10n: po-id for 2.39 (round 1) l10n: sv.po: Update Swedish translation (5501t0f0)
2022-12-11Sync with Git 2.38.2Junio C Hamano1-0/+7
2022-12-11Git 2.38.2v2.38.2Junio C Hamano2-1/+8
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-12-11l10n: zh_TW.po: Git 2.39-rc2pan934121-921/+1240
Signed-off-by: pan93412 <pan93412@gmail.com>
2022-12-10ci: use a newer `github-script` versionJohannes Schindelin1-3/+3
The old version we currently use runs in node.js v12.x, which is being deprecated in GitHub Actions. The new version uses node.js v16.x. Incidentally, this also avoids the warning about the deprecated `::set-output::` workflow command because the newer version of the `github-script` Action uses the recommended new way to specify outputs. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Taylor Blau <me@ttaylorr.com>
2022-12-10Merge branch 'jx/ci-ubuntu-fix' into maint-2.38Junio C Hamano3-17/+13
Adjust the GitHub CI to newer ubuntu release. * jx/ci-ubuntu-fix: ci: install python on ubuntu ci: use the same version of p4 on both Linux and macOS ci: remove the pipe after "p4 -V" to catch errors github-actions: run gcc-8 on ubuntu-20.04 image