summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-07-27Merge branch 'ds/t5510-brokequote' into maintJunio C Hamano
Test fix. source: <484a330e-0902-6e1b-8189-63c72dcea494@github.com> * ds/t5510-brokequote: t5510: replace 'origin' with URL more carefully
2022-07-27Merge branch 'tb/pack-objects-remove-pahole-comment' into maintJunio C Hamano
Comment fix. source: <1379af2e9d271b501ef3942398e7f159a9c77973.1656440978.git.me@ttaylorr.com> * tb/pack-objects-remove-pahole-comment: pack-objects.h: remove outdated pahole results
2022-07-27Merge branch 'en/t6429-test-must-be-empty-fix' into maintJunio C Hamano
A test fix. source: <pull.1276.git.1656652799863.gitgitgadget@gmail.com> * en/t6429-test-must-be-empty-fix: t6429: fix use of non-existent function
2022-07-27Merge branch 'ds/vscode-settings' into maintJunio C Hamano
* ds/vscode-settings: vscode: improve tab size and wrapping
2022-07-27Merge branch 'cr/setup-bug-typo' into maintJunio C Hamano
Typofix in a BUG() message. source: <pull.1255.git.1654782920256.gitgitgadget@gmail.com> * cr/setup-bug-typo: setup: fix function name in a BUG() message
2022-07-27Merge branch 'pb/diff-doc-raw-format' into maintJunio C Hamano
Update "git diff/log --raw" format documentation. source: <pull.1259.git.1655123383.gitgitgadget@gmail.com> * pb/diff-doc-raw-format: diff-index.txt: update raw output format in examples diff-format.txt: correct misleading wording diff-format.txt: dst can be 0* SHA-1 when path is deleted, too
2022-07-27Merge branch 'jk/revisions-doc-markup-fix' into maintJunio C Hamano
Documentation mark-up fix. source: <YrOmsA04FZae89be@coredump.intra.peff.net> * jk/revisions-doc-markup-fix: revisions.txt: escape "..." to avoid asciidoc horizontal ellipsis
2022-07-27Merge branch 'rs/combine-diff-with-incompatible-options' into maintJunio C Hamano
Certain diff options are currently ignored when combined-diff is shown; mark them as incompatible with the feature. source: <220524.86v8tuvfl1.gmgdl@evledraar.gmail.com> * rs/combine-diff-with-incompatible-options: combine-diff: abort if --output is given combine-diff: abort if --ignore-matching-lines is given
2022-07-27Merge branch 'ac/bitmap-format-doc' into maintJunio C Hamano
Adjust technical/bitmap-format to be formatted by AsciiDoc, and add some missing information to the documentation. source: <pull.1246.v4.git.1655355834.gitgitgadget@gmail.com> * ac/bitmap-format-doc: bitmap-format.txt: add information for trailing checksum bitmap-format.txt: fix some formatting issues bitmap-format.txt: feed the file to asciidoc to generate html
2022-07-27Merge branch 'ab/test-quoting-fix' into maintJunio C Hamano
Fixes for tests when the source directory has unusual characters in its path, e.g. whitespaces, double-quotes, etc. source: <cover-v2-0.3-00000000000-20220630T101646Z-avarab@gmail.com> * ab/test-quoting-fix: config tests: fix harmless but broken "rm -r" cleanup test-lib.sh: fix prepend_var() quoting issue tests: add missing double quotes to included library paths
2022-07-27Merge branch 'ro/mktree-allow-missing-fix' into maintJunio C Hamano
"git mktree --missing" lazily fetched objects that are missing from the local object store, which was totally unnecessary for the purpose of creating the tree object(s) from its input. source: <748f39a9-65aa-2110-cf92-7ddf81b5f507@roku.com> * ro/mktree-allow-missing-fix: mktree: do not check type of remote objects
2022-07-27Merge branch 'dr/i18n-die-warn-error-usage' into maintJunio C Hamano
Give _() markings to fatal/warning/usage: labels that are shown in front of these messages. source: <pull.1279.v2.git.git.1655819877758.gitgitgadget@gmail.com> * dr/i18n-die-warn-error-usage: i18n: mark message helpers prefix for translation
2022-07-27Merge branch 'ds/git-rebase-doc-markup' into maintJunio C Hamano
References to commands-to-be-typed-literally in "git rebase" documentation mark-up have been corrected. source: <pull.1270.v3.git.1656508868146.gitgitgadget@gmail.com> * ds/git-rebase-doc-markup: git-rebase.txt: use back-ticks consistently
2022-07-27Merge branch 'gg/worktree-from-the-above' into maintJunio C Hamano
In a non-bare repository, the behavior of Git when the core.worktree configuration variable points at a directory that has a repository as its subdirectory, regressed in Git 2.27 days. source: <20220616234433.225-1-gg.oss@outlook.com> source: <20220616231956.154-1-gg.oss@outlook.com> * gg/worktree-from-the-above: dir: minor refactoring / clean-up dir: traverse into repository
2022-07-27Merge branch 'fr/vimdiff-layout-fix' into maintJunio C Hamano
Recent update to vimdiff layout code has been made more robust against different end-user vim settings. source: <20220708181024.45839-1-greenfoo@u92.eu> * fr/vimdiff-layout-fix: vimdiff: make layout engine more robust against user vim settings
2022-07-27Merge branch 'en/merge-dual-dir-renames-fix' into maintJunio C Hamano
Fixes a long-standing corner case bug around directory renames in the merge-ort strategy. source: <pull.1268.v4.git.1656984823.gitgitgadget@gmail.com> * en/merge-dual-dir-renames-fix: merge-ort: fix issue with dual rename and add/add conflict merge-ort: shuffle the computation and cleanup of potential collisions merge-ort: make a separate function for freeing struct collisions merge-ort: small cleanups of check_for_directory_rename t6423: add tests of dual directory rename plus add/add conflict
2022-07-27Merge branch 'jk/diff-files-cleanup-fix' into maintJunio C Hamano
An earlier attempt to plug leaks placed a clean-up label to jump to at a bogus place, which as been corrected. source: <Ys0c0ePxPOqZ/5ck@coredump.intra.peff.net> * jk/diff-files-cleanup-fix: diff-files: move misplaced cleanup label
2022-07-27Merge branch 'js/vimdiff-quotepath-fix' into maintJunio C Hamano
Variable quoting fix in the vimdiff driver of "git mergetool" source: <pull.1287.v2.git.1657809063728.gitgitgadget@gmail.com> * js/vimdiff-quotepath-fix: mergetool(vimdiff): allow paths to contain spaces again
2022-07-27Merge branch 'js/shortlog-sort-stably' into maintJunio C Hamano
"git shortlog -n" relied on the underlying qsort() to be stable, which shouldn't have. Fixed. source: <pull.1290.git.1657813429221.gitgitgadget@gmail.com> * js/shortlog-sort-stably: shortlog: use a stable sort
2022-07-27Merge branch 'js/ci-github-workflow-markup' into maintJunio C Hamano
A fix for a regression in test framework. source: <pull.1288.git.1657789234416.gitgitgadget@gmail.com> * js/ci-github-workflow-markup: tests: fix incorrect --write-junit-xml code
2022-07-27The seventh batchJunio C Hamano
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-07-27Merge branch 'mb/p4-utf16-crlf'Junio C Hamano
"git p4" working on UTF-16 files on Windows did not implement CRLF-to-LF conversion correctly, which has been corrected. * mb/p4-utf16-crlf: git-p4: fix CR LF handling for utf16 files
2022-07-27Merge branch 'mb/p4-fixes'Junio C Hamano
Fix a few issues in "git p4". * mb/p4-fixes: git-p4: fix error handling in P4Unshelve.renameBranch() git-p4: fix typo in P4Submit.applyCommit()
2022-07-27Merge branch 'ds/win-syslog-compiler-fix'Junio C Hamano
Workaround for a false positive compiler warning. * ds/win-syslog-compiler-fix: compat/win32: correct for incorrect compiler warning
2022-07-27Merge branch 'ld/osx-keychain-usage-fix'Junio C Hamano
Workaround for a compiler warning against use of die() in osx-keychain (in contrib/). * ld/osx-keychain-usage-fix: osx-keychain: fix compiler warning
2022-07-27Merge branch 'vd/scalar-doc'Junio C Hamano
Doc update. * vd/scalar-doc: scalar: convert README.md into a technical design doc scalar: reword command documentation to clarify purpose
2022-07-27Merge branch 'ds/doc-wo-whitelist'Junio C Hamano
Avoid "white/black-list" in documentation and code comments. * ds/doc-wo-whitelist: transport.c: avoid "whitelist" t: avoid "whitelist" git.txt: remove redundant language git-cvsserver: clarify directory list daemon: clarify directory arguments
2022-07-27Merge branch 'mb/config-document-include'Junio C Hamano
Add missing documentation for "include" and "includeIf" features in "git config" file format, which incidentally teaches the command line completion to include them in its offerings. * mb/config-document-include: config.txt: document include, includeIf
2022-07-27Merge branch 'sg/index-format-doc-update'Junio C Hamano
Docfix. * sg/index-format-doc-update: index-format.txt: remove outdated list of supported extensions
2022-07-27Merge branch 'ma/sparse-checkout-cone-doc-fix'Junio C Hamano
Docfix. * ma/sparse-checkout-cone-doc-fix: config/core.txt: fix minor issues for `core.sparseCheckoutCone`
2022-07-27Merge branch 'ma/t4200-update'Junio C Hamano
Test fix. * ma/t4200-update: t4200: drop irrelevant code
2022-07-27Merge branch 'tl/pack-bitmap-error-messages'Junio C Hamano
Tweak various messages that come from the pack-bitmap codepaths. * tl/pack-bitmap-error-messages: pack-bitmap.c: continue looping when first MIDX bitmap is found pack-bitmap.c: using error() instead of silently returning -1 pack-bitmap.c: do not ignore error when opening a bitmap file pack-bitmap.c: rename "idx_name" to "bitmap_name" pack-bitmap.c: mark more strings for translations pack-bitmap.c: fix formatting of error messages
2022-07-27Merge branch 'ab/squelch-empty-fsync-traces'Junio C Hamano
Omit fsync-related trace2 entries when their values are all zero. * ab/squelch-empty-fsync-traces: trace2: only include "fsync" events if we git_fsync()
2022-07-27Merge branch 'js/commit-graph-parsing-without-repo-settings'Junio C Hamano
API tweak to make it easier to run fuzz testing on commit-graph parser. * js/commit-graph-parsing-without-repo-settings: commit-graph: pass repo_settings instead of repository
2022-07-27cmake: support local installations of gitCarlo Marcelo Arenas Belón
At least in systems where the user is local and not an administrator git will install in a subdirectory of %APPDATALOCAL%, so it makes sense to also look there for the shell needed by the cmake integration with Visual Studio. Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-07-27write_midx_bitmap(): drop unused refs_snapshot parameterJeff King
The refactoring in 90b2bb710d (midx: extract bitmap write setup, 2022-07-19) hoisted our call to find_commits_for_midx_bitmap() into the caller, which means we no longer need to see the refs_snapshot at all. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-07-27config.c: NULL check when reading protected configGlen Choo
In read_protected_config(), check whether each file name is NULL before attempting to read it, and add a BUG() call to git_config_from_file_with_options() to make this error easier to catch in the future. The NULL checks mirror what do_git_config_sequence() does (which read_protected_config() is modeled after). Without these NULL checks, multiple tests fail with "make SANITIZE=address", e.g. in the final test of t4010, xdg_config is NULL causing us to call fopen(NULL). Reported-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Glen Choo <chooglen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-07-27fetch-pack: write effective filter to trace2Jonathan Tan
Administrators of a managed Git environment (like the one at $DAYJOB) might want to quantify the performance change of fetches with and without filters from the client's point of view, and also detect if a server does not support it. Therefore, log the filter information being sent to the server whenever a fetch (or clone) occurs. Note that this is not necessarily the same as what's specified on the CLI, because during a fetch, the configured filter is used whenever a filter is not specified on the CLI. Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-07-27gitweb: remove title shortening heuristicsJulien Rouhaud
Those heuristics are way outdated and too specific to the kernel project to be useful outside of kernel.org. Since kernel.org doesn't use gitweb anymore and at least one project complained about incorrect behavior, entirely remove them. Signed-off-by: Julien Rouhaud <julien.rouhaud@free.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-07-23ls-files: introduce "--format" optionZheNing Hu
Add a new option "--format" that outputs index entries informations in a custom format, taking inspiration from the option with the same name in the `git ls-tree` command. "--format" cannot used with "-s", "-o", "-k", "-t", " --resolve-undo","--deduplicate" and "--eol". Signed-off-by: ZheNing Hu <adlternative@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-07-23merge: do not exit restore_state() prematurelyElijah Newren
Previously, if the user: * Had no local changes before starting the merge * A merge strategy makes changes to the working tree/index but returns with exit status 2 Then we'd call restore_state() to clean up the changes and either let the next merge strategy run (if there is one), or exit telling the user that no merge strategy could handle the merge. Unfortunately, restore_state() did not clean up the changes as expected; that function was a no-op if the stash was a null, and the stash would be null if there were no local changes before starting the merge. So, instead of "Rewinding the tree to pristine..." as the code claimed, restore_state() would leave garbage around in the index and working tree (possibly including conflicts) for either the next merge strategy or for the user after aborting the merge. And in the case of aborting the merge, the user would be unable to run "git merge --abort" to get rid of the unintended leftover conflicts, because the merge control files were not written as it was presumed that we had restored to a clean state already. Fix the main problem by making sure that restore_state() only skips the stash application if the stash is null rather than skipping the whole function. However, there is a secondary problem -- since merge.c forks subprocesses to do the cleanup, the in-memory index is left out-of-sync. While there was a refresh_cache(REFRESH_QUIET) call that attempted to correct that, that function would not handle cases where the previous merge strategy added conflicted entries. We need to drop the index and re-read it to handle such cases. (Alternatively, we could stop forking subprocesses and instead call some appropriate function to do the work which would update the in-memory index automatically. For now, just do the simple fix.) Also, add a testcase checking this, one for which the octopus strategy fails on the first commit it attempts to merge, and thus which it cannot handle at all and must completely bail on (as per the "exit 2" code path of commit 98efc8f3d8 ("octopus: allow manual resolve on the last round.", 2006-01-13)). Reported-by: ZheNing Hu <adlternative@gmail.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-07-23merge: ensure we can actually restore pre-merge stateElijah Newren
Merge strategies can: * succeed with a clean merge * succeed with a conflicted merge * fail to handle the given type of merge If one is thinking in terms of automatic mergeability, they would use the word "fail" instead of "succeed" for the second bullet, but I am focusing here on ability of the merge strategy to handle the given inputs, not on whether the given inputs are mergeable. The third category is about the merge strategy failing to know how to handle the given data; examples include: * Passing more than 2 branches to 'recursive' or 'ort' * Passing 2 or fewer branches to 'octopus' * Trying to do more complicated merges with 'resolve' (I believe directory/file conflicts will cause it to bail.) * Octopus running into a merge conflict for any branch OTHER than the final one (see the "exit 2" codepath of commit 98efc8f3d8 ("octopus: allow manual resolve on the last round.", 2006-01-13)) That final one is particularly interesting, because it shows that the merge strategy can muck with the index and working tree, and THEN bail and say "sorry, this strategy cannot handle this type of merge; use something else". Further, we do not currently expect the individual strategies to clean up after themselves, but instead expect builtin/merge.c to do so. For it to be able to, it needs to save the state before trying the merge strategy so it can have something to restore to. Therefore, remove the shortcut bypassing the save_state() call. There is another bug on the restore_state() side of things, so no testcase will be added until the next commit when we have addressed that issue as well. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-07-23merge: make restore_state() restore staged state tooElijah Newren
There are multiple issues at play here: 1) If `git merge` is invoked with staged changes, it should abort without doing any merging, and the user's working tree and index should be the same as before merge was invoked. 2) Merge strategies are responsible for enforcing the index == HEAD requirement. (See 9822175d2b ("Ensure index matches head before invoking merge machinery, round N", 2019-08-17) for some history around this.) 3) Merge strategies can bail saying they are not an appropriate handler for the merge in question (possibly allowing other strategies to be used instead). 4) Merge strategies can make changes to the index and working tree, and have no expectation to clean up after themselves, *even* if they bail out and say they are not an appropriate handler for the merge in question. (The `octopus` merge strategy does this, for example.) 5) Because of (3) and (4), builtin/merge.c stashes state before trying merge strategies and restores it afterward. Unfortunately, if users had staged changes before calling `git merge`, builtin/merge.c could do the following: * stash the changes, in order to clean up after the strategies * try all the merge strategies in turn, each of which report they cannot function due to the index not matching HEAD * restore the changes via "git stash apply" But that last step would have the net effect of unstaging the user's changes. Fix this by adding the "--index" option to "git stash apply". While at it, also squelch the stash apply output; we already report "Rewinding the tree to pristine..." and don't need a detailed `git status` report afterwards. Also while at it, switch to using strvec so folks don't have to count the arguments to ensure we avoided an off-by-one error, and so it's easier to add additional arguments to the command. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-07-23merge: fix save_state() to work when there are stat-dirty filesElijah Newren
When there are stat-dirty files, but no files are modified, `git stash create` exits with unsuccessful status. This causes merge to fail. Copy some code from sequencer.c's create_autostash to refresh the index first to avoid this problem. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-07-23merge: do not abort early if one strategy fails to handle the mergeElijah Newren
builtin/merge is setup to allow multiple strategies to be specified, and it will find the "best" result and use it. This is defeated if some of the merge strategies abort early when they cannot handle the merge. Fix the logic that calls recursive and ort to not do such an early abort, but instead return "2" or "unhandled" so that the next strategy can try to handle the merge. Coming up with a testcase for this is somewhat difficult, since recursive and ort both handle nearly any two-headed merge (there is a separate code path that checks for non-two-headed merges and already returns "2" for them). So use a somewhat synthetic testcase of having the index not match HEAD before the merge starts, since all merge strategies will abort for that. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-07-23merge: abort if index does not match HEAD for trivial mergesElijah Newren
As noted in the last commit and the links therein (especially commit 9822175d2b ("Ensure index matches head before invoking merge machinery, round N", 2019-08-17), we have had a very long history of problems with failing to enforce the requirement that index matches HEAD when starting a merge. The "trivial merge" logic in builtin/merge.c is yet another such case we previously missed. Add a check for it to ensure it aborts if the index does not match HEAD, and add a testcase where this fix is needed. Note that the fix here would also incidentally be an alternative fix for the testcase added in the last patch, but the fix in the last patch is still needed when multiple merge strategies are in use, so tweak the testcase from the previous commit so that it continues to exercise the codepath added in the last commit. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-07-23merge-resolve: abort if index does not match HEADElijah Newren
As noted in commit 9822175d2b ("Ensure index matches head before invoking merge machinery, round N", 2019-08-17), we have had a very long history of problems with failing to enforce the requirement that index matches HEAD when starting a merge. One of the commits referenced in the long tale of issues arising from lax enforcement of this requirement was commit 55f39cf755 ("merge: fix misleading pre-merge check documentation", 2018-06-30), which tried to document the requirement and noted there were some exceptions. As mentioned in that commit message, the `resolve` strategy was the one strategy that did not have an explicit index matching HEAD check, and the reason it didn't was that I wasn't able to discover any cases where the implementation would fail to catch the problem and abort, and didn't want to introduce unnecessary performance overhead of adding another check. Well, today I discovered a testcase where the implementation does not catch the problem and so an explicit check is needed. Add a testcase that previously would have failed, and update git-merge-resolve.sh to have an explicit check. Note that the code is copied from 3ec62ad9ff ("merge-octopus: abort if index does not match HEAD", 2016-04-09), so that we reuse the same message and avoid making translators need to translate some new message. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-07-23merge-ort-wrappers: make printed message match the one from recursiveElijah Newren
When the index does not match HEAD, the merge strategies are responsible to detect that condition and abort. The merge-ort-wrappers had code to implement this and meant to copy the error message from merge-recursive but deviated in two ways, both due to the message in merge-recursive being processed by another function that made additional changes: * It added an implicit "error: " prefix * It added an implicit trailing newline We can get these things by making use of the error() function. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-07-23builtin/cat-file.c: support NUL-delimited input with `-z`Taylor Blau
When callers are using `cat-file` via one of the stdin-driven `--batch` modes, all input is newline-delimited. This presents a problem when callers wish to ask about, e.g. tree-entries that have a newline character present in their filename. To support this niche scenario, introduce a new `-z` mode to the `--batch`, `--batch-check`, and `--batch-command` suite of options that instructs `cat-file` to treat its input as NUL-delimited, allowing the individual commands themselves to have newlines present. The refactoring here is slightly unfortunate, since we turn loops like: while (strbuf_getline(&buf, stdin) != EOF) into: while (1) { int ret; if (opt->nul_terminated) ret = strbuf_getline_nul(&input, stdin); else ret = strbuf_getline(&input, stdin); if (ret == EOF) break; } It's tempting to think that we could use `strbuf_getwholeline()` and specify either `\n` or `\0` as the terminating character. But for input on platforms that include a CR character preceeding the LF, this wouldn't quite be the same, since `strbuf_getline(...)` will trim any trailing CR, while `strbuf_getwholeline(&buf, stdin, '\n')` will not. In the future, we could clean this up further by introducing a variant of `strbuf_getwholeline()` that addresses the aforementioned gap, but that approach felt too heavy-handed for this pair of uses. Some tests are added in t1006 to ensure that `cat-file` produces the same output in `--batch`, `--batch-check`, and `--batch-command` modes with and without the new `-z` option. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-07-23t1006: extract --batch-command inputs to variablesTaylor Blau
A future commit will want to ensure that various `--batch`-related options produce the same output whether their input is newline terminated, or NUL terminated (and a to-be-implemented `-z` option exists). To prepare for this, extract the given input(s) into separate variables to that their LF characters can easily be converted into NUL bytes when testing the new `-z` mode. This is consistent with other tests in t1006 (which these days is no longer a shining example of our CodingGuidelines). Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>