summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* worktree: introduce is_shared_symref()Rubén Justo2023-02-252-31/+37
| | | | | | | | | | | | Add a new function, is_shared_symref(), which contains the heart of find_shared_symref(). Refactor find_shared_symref() to use the new function is_shared_symref(). Soon, we will use is_shared_symref() to search for symref beyond the first worktree that matches. Signed-off-by: Rubén Justo <rjusto@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* The ninth batchJunio C Hamano2023-01-221-0/+12
| | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'yc/doc-fetch-fix'Junio C Hamano2023-01-221-4/+4
|\ | | | | | | | | | | | | Doc fix. * yc/doc-fetch-fix: doc: fix non-existent config name
| * doc: fix non-existent config nameYukai Chou2023-01-141-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace non-existent `branch.<name>.fetch` to `remote.<repository>.fetch`, in the first example in `git-fetch` doc, which was introduced in d504f6975d (modernize fetch/merge/pull examples, 2009-10-21). Rename placeholder `<name>` to `<repository>`, to be consistent with all other uses in git docs, except that `git-config.txt` uses `remote.<name>.fetch` in its "Variables" section. Also add missing monospace markups. Signed-off-by: Yukai Chou <muzimuzhi@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'ab/bisect-cleanup'Junio C Hamano2023-01-223-36/+40
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Code clean-up. * ab/bisect-cleanup: bisect: no longer try to clean up left-over `.git/head-name` files bisect: remove Cogito-related code bisect run: fix the error message bisect: verify that a bogus option won't try to start a bisection bisect--helper: make the order consistently `argc, argv` bisect--helper: simplify exit code computation
| * | bisect: no longer try to clean up left-over `.git/head-name` filesJohannes Schindelin2023-01-132-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As per the code comment, the `.git/head-name` files were cleaned up for backwards-compatibility: an old version of `git bisect` could have left them behind. Now, just how old would such a version be? As of 0f497e75f05 (Eliminate confusing "won't bisect on seeked tree" failure, 2008-02-23), `git bisect` does not write that file anymore. Which corresponds to Git v1.5.4.4. Even if the likelihood is non-nil that there might still be users out there who use such an old version to start a bisection, but then decide to continue bisecting with a current Git version, it is highly improbable. So let's remove that code, at long last. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | bisect: remove Cogito-related codeJohannes Schindelin2023-01-131-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Once upon a time, there was this idea that Git would not actually be a single coherent program, but rather a set of low-level programs that users cobble together via shell scripts, or develop high-level user interfaces for Git, or both. Cogito was such a high-level user interface, incidentally implemented via shell scripts that cobble together Git calls. It did turn out relatively quickly that Git would much rather provide a useful high-level user interface itself. As of April 19th, 2007, Cogito was therefore discontinued (see https://lore.kernel.org/git/20070419124648.GL4489@pasky.or.cz/). Nevertheless, for almost 15 years after that announcement, Git carried special code in `git bisect` to accommodate Cogito. Since it is beyond doubt that there are no more Cogito users, let's remove the last remnant of Cogito-accommodating code. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | bisect run: fix the error messageJohannes Schindelin2023-01-132-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In d1bbbe45df8 (bisect--helper: reimplement `bisect_run` shell function in C, 2021-09-13), we ported the `bisect run` subcommand to C, including the part that prints out an error message when the implicit `git bisect bad` or `git bisect good` failed. However, the error message was supposed to print out whether the state was "good" or "bad", but used a bogus (because non-populated) `args` variable for it. This was fixed in [1], but as of [2] (when `bisect--helper` was changed to the present `bisect-state') the error message still talks about implementation details that should not concern end users. Fix that, and add a regression test to ensure that the intended form of the error message. 1. 80c2e9657f2 (bisect--helper: report actual bisect_state() argument on error, 2022-01-18 2. f37d0bdd42d (bisect: fix output regressions in v2.30.0, 2022-11-10) Helped-by: Elijah Newren <newren@gmail.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | bisect: verify that a bogus option won't try to start a bisectionJohannes Schindelin2023-01-131-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We do not want `git bisect --bogus-option` to start a bisection. To verify that, we look for the tell-tale error message `You need to start by "git bisect start"` and fail if it was found. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | bisect--helper: make the order consistently `argc, argv`Ævar Arnfjörð Bjarmason2023-01-131-15/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In C, the natural order is for `argc` to come before `argv` by virtue of the `main()` function declaring the parameters in precisely that order. It is confusing & distracting, then, when readers familiar with the C language read code where that order is switched around. Let's just change the order and avoid that type of developer friction. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | bisect--helper: simplify exit code computationJohannes Schindelin2023-01-131-8/+1
| |/ | | | | | | | | | | | | | | | | | | | | We _already_ have a function to determine whether a given `enum bisect_error` value is non-zero but still _actually_ indicates success. Let's use it instead of duplicating the logic. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'tl/ls-tree-code-clean-up'Junio C Hamano2023-01-222-108/+150
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Code clean-up. * tl/ls-tree-code-clean-up: t3104: remove shift code in 'test_ls_tree_format' ls-tree: cleanup the redundant SPACE ls-tree: make "line_termination" less generic ls-tree: fold "show_tree_data" into "cb" struct ls-tree: use a "struct options" ls-tree: don't use "show_tree_data" for "fast" callbacks
| * | t3104: remove shift code in 'test_ls_tree_format'Teng Long2023-01-141-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | In t3104-ls-tree-format.sh, There is a legacy 'shift 2' code and the relevant code block no longer depends on it anymore, so let's remove it for a small cleanup. Signed-off-by: Teng Long <dyroneteng@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | ls-tree: cleanup the redundant SPACETeng Long2023-01-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | An redundant space was found in ls-tree.c, which is no doubt a small change, but it might be OK to make a commit on its own. Signed-off-by: Teng Long <dyroneteng@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | ls-tree: make "line_termination" less genericÆvar Arnfjörð Bjarmason2023-01-141-14/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The "ls-tree" command isn't capable of ending "lines" with anything except '\n' or '\0', and in the latter case we can avoid calling write_name_quoted_relative() entirely. Let's do that, less for optimization and more for clarity, the write_name_quoted_relative() API itself does much the same thing. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Teng Long <dyroneteng@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | ls-tree: fold "show_tree_data" into "cb" structÆvar Arnfjörð Bjarmason2023-01-141-13/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After the the preceding two commits the only user of the "show_tree_data" struct needed it along with the "options" member, let's instead fold all of that into a "show_tree_data" struct that we'll use only for that callback. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Teng Long <dyroneteng@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | ls-tree: use a "struct options"Ævar Arnfjörð Bjarmason2023-01-141-87/+116
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As a first step towards being able to turn this code into an API some day let's change the "static" options in builtin/ls-tree.c into a "struct ls_tree_options" that can be constructed dynamically without the help of parse_options(). Because we're now using non-static variables for this we'll need to clear_pathspec() at the end of cmd_ls_tree(), least various tests start failing under SANITIZE=leak. The memory leak was already there before, now it's just being brought to the surface. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Teng Long <dyroneteng@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | ls-tree: don't use "show_tree_data" for "fast" callbacksÆvar Arnfjörð Bjarmason2023-01-141-26/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As noted in [1] the code that made it in as part of 9c4d58ff2c3 (ls-tree: split up "fast path" callbacks, 2022-03-23) was a "maybe a good idea, maybe not" RFC-quality patch. I hadn't looked very carefully at the resulting patterns. The implementation shared the "struct show_tree_data data", which was introduced in e81517155e0 (ls-tree: introduce struct "show_tree_data", 2022-03-23) both for use in 455923e0a15 (ls-tree: introduce "--format" option, 2022-03-23), and because the "fat" callback hadn't been split up as 9c4d58ff2c3 did. Now that that's been done we can see that most of what show_tree_common() was doing could be done lazily by the callbacks themselves, who in the pre-image were often using an odd mis-match of their own arguments and those same arguments stuck into the "data" structure. Let's also have the callers initialize the "type", rather than grabbing it from the "data" structure afterwards. 1. https://lore.kernel.org/git/cover-0.7-00000000000-20220310T134811Z-avarab@gmail.com/ Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Teng Long <dyronteng@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'ph/parse-date-reduced-precision'Junio C Hamano2023-01-222-0/+45
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Loosen date parsing heuristics. * ph/parse-date-reduced-precision: date.c: allow ISO 8601 reduced precision times
| * | | date.c: allow ISO 8601 reduced precision timesĐoàn Trần Công Danh2023-01-132-0/+45
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ISO 8601 permits "reduced precision" time representations to omit the seconds value or both the minutes and the seconds values. The abbreviate times could look like 17:45 or 1745 to omit the seconds, or simply as 17 to omit both the minutes and the seconds. parse_date_basic accepts the 17:45 format but it rejects the other two. Change it to accept 4-digit and 2-digit time values when they follow a recognized date and a 'T'. Before this change: $ TZ=UTC test-tool date approxidate 2022-12-13T23:00 2022-12-13T2300 2022-12-13T23 2022-12-13T23:00 -> 2022-12-13 23:00:00 +0000 2022-12-13T2300 -> 2022-12-13 23:54:13 +0000 2022-12-13T23 -> 2022-12-13 23:54:13 +0000 After this change: $ TZ=UTC helper/test-tool date approxidate 2022-12-13T23:00 2022-12-13T2300 2022-12-13T23 2022-12-13T23:00 -> 2022-12-13 23:00:00 +0000 2022-12-13T2300 -> 2022-12-13 23:00:00 +0000 2022-12-13T23 -> 2022-12-13 23:00:00 +0000 Note: ISO 8601 also allows reduced precision date strings such as "2022-12" and "2022". This patch does not attempt to address these. Reported-by: Pat LaVarre <plavarre@purestorage.com> Signed-off-by: Phil Hord <phil.hord@gmail.com> Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'pw/rebase-exec-cleanup'Junio C Hamano2023-01-222-36/+13
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Code clean-up. * pw/rebase-exec-cleanup: rebase: cleanup "--exec" option handling
| * | | rebase: cleanup "--exec" option handlingPhillip Wood2023-01-132-36/+13
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When handling "--exec" rebase collects the commands into a struct string_list, then prepends "exec " to each command creating a multi line string and finally splits that string back into a list of commands. This is an artifact of the scripted rebase and the need to support "rebase --preserve-merges". Now that "--preserve-merges" no-longer exists we can cleanup the way the argument is handled. There is no need to add the "exec " prefix to the commands as that is added by todo_list_to_strbuf(). Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'pb/doc-orig-head'Junio C Hamano2023-01-225-4/+14
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Document ORIG_HEAD a bit more. * pb/doc-orig-head: git-rebase.txt: add a note about 'ORIG_HEAD' being overwritten revisions.txt: be explicit about commands writing 'ORIG_HEAD' git-merge.txt: mention 'ORIG_HEAD' in the Description git-reset.txt: mention 'ORIG_HEAD' in the Description git-cherry-pick.txt: do not use 'ORIG_HEAD' in example
| * | | git-rebase.txt: add a note about 'ORIG_HEAD' being overwrittenPhilippe Blain2023-01-131-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'ORIG_HEAD' is written at the start of the rebase, but is not guaranteed to still point to the original branch tip at the end of the rebase. Indeed, using other commands that write 'ORIG_HEAD' during the rebase, like splitting a commit using 'git reset HEAD^', will lead to 'ORIG_HEAD' being overwritten. This causes confusion for some users [1]. Add a note about that in the 'Description' section, and mention the more robust alternative of using the branch's reflog. [1] https://lore.kernel.org/git/28ebf03b-e8bb-3769-556b-c9db17e43dbb@gmail.com/T/#m827179c5adcfb504d67f76d03c8e6942b55e5ed0 Reported-by: Erik Cervin Edin <erik@cervined.in> Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com> Acked-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | revisions.txt: be explicit about commands writing 'ORIG_HEAD'Philippe Blain2023-01-131-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When mentioning 'ORIG_HEAD', be explicit about which command write that pseudo-ref, namely 'git am', 'git merge', 'git rebase' and 'git reset'. Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com> Acked-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | git-merge.txt: mention 'ORIG_HEAD' in the DescriptionPhilippe Blain2023-01-131-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fact that 'git merge' writes 'ORIG_HEAD' before performing the merge is missing from the documentation of the command. Mention it in the 'Description' section. Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com> Acked-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | git-reset.txt: mention 'ORIG_HEAD' in the DescriptionPhilippe Blain2023-01-131-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fact that 'git reset' writes 'ORIG_HEAD' before changing HEAD is mentioned in an example, but is missing from the 'Description' section. Mention it in the discussion of the "'git reset' [<mode>] [<commit>]" form of the command. Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com> Acked-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | git-cherry-pick.txt: do not use 'ORIG_HEAD' in examplePhilippe Blain2023-01-131-1/+1
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 67ac1e1d57 (cherry-pick/revert: add support for -X/--strategy-option, 2010-12-10) added an example to the documentation of 'git cherry-pick'. This example mentions how to abort a failed cherry-pick and retry with an additional merge strategy option. The command used in the example to abort the cherry-pick is 'git reset --merge ORIG_HEAD', but cherry-pick does not write 'ORIG_HEAD' before starting its operation. So this command would checkout a commit unrelated to what was at HEAD when the user invoked cherry-pick. Use 'git cherry-pick --abort' instead. Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com> Acked-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'yo/doc-use-more-switch-c'Junio C Hamano2023-01-221-3/+3
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Doc update. * yo/doc-use-more-switch-c: doc: add "git switch -c" as another option on detached HEAD
| * | | doc: add "git switch -c" as another option on detached HEADYutaro Ohno2023-01-131-3/+3
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the "DETACHED HEAD" section in the git-checkout doc, it suggests using "git checkout -b <branch-name>" to create a new branch on the detached head. On the other hand, when you checkout a commit that is not at the tip of any named branch (e.g., when you checkout a tag), git suggests using "git switch -c <branch-name>". Add "git switch -c" as another option and mitigate this inconsistency. Signed-off-by: Yutaro Ohno <yutaro.ono.418@gmail.com> Acked-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'sk/merge-filtering-strategies-micro-optim'Junio C Hamano2023-01-221-1/+1
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Micro optimization. * sk/merge-filtering-strategies-micro-optim: merge: break out of all_strategy loop when strategy is found
| * | | merge: break out of all_strategy loop when strategy is foundSeija Kijin2023-01-131-1/+1
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | Once we find a match, there is no point to try finding the second match in the inner loop. Break out of the loop once we find the first match. Signed-off-by: Seija Kijin <doremylover123@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'jk/interop-error'Junio C Hamano2023-01-221-1/+1
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Test helper improvement. * jk/interop-error: t/interop: report which vanilla git command failed
| * | | t/interop: report which vanilla git command failedJeff King2023-01-131-1/+1
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The interop test library sets up wrappers "git.a" and "git.b" to represent the two versions to be tested. It also wraps vanilla "git" to report an error, with the goal of catching tests which accidentally fail to use one of the version-specific wrappers (which could invalidate the tests in a very subtle way). But when it catches an invocation of vanilla git, it doesn't give any details, which makes it very hard to debug exactly which invocation is responsible (especially if it's buried in a function invocation, etc). Let's report the arguments passed to git, which helps narrow it down. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'ar/bisect-doc-update'Junio C Hamano2023-01-221-2/+2
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Doc update. * ar/bisect-doc-update: git-bisect-lk2009: update nist report link git-bisect-lk2009: update java code conventions link
| * | | git-bisect-lk2009: update nist report linkAndrei Rybak2023-01-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit d656218a83 (docs/bisect-lk2009: update nist report link, 2017-04-20) replaced a dead link to news release on nist.gov. However, this might be confusing to the reader (like myself) because the article git-bisect-lk2009.txt quotes from the news release but the exact quote cannot be found in the full report. In addition to that, the link added in 2017 is also dead in 2023. Replace the reference to nist.gov with an version of the original NIST news release archived to the Wayback Machine. Include also an updated link to a live version of the full report. Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | git-bisect-lk2009: update java code conventions linkAndrei Rybak2023-01-131-1/+1
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A reference to Java Code Conventions in git-bisect-lk2009.txt uses an outdated URL that redirects to table of contents for the conventions. The actual claim about "80%" that this reference backs up is on the first page of the conventions: https://www.oracle.com/java/technologies/javase/codeconventions-introduction.html Use this newer URL and its title in the reference. Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'ar/test-cleanup'Junio C Hamano2023-01-223-16/+11
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Test clean-up. * ar/test-cleanup: t7527: use test_when_finished in 'case insensitive+preserving' t6422: drop commented out code t6003: uncomment test '--max-age=c3, --topo-order'
| * | | t7527: use test_when_finished in 'case insensitive+preserving'Andrei Rybak2023-01-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Most tests in t7527-builtin-fsmonitor.sh that start a daemon, use the helper function test_when_finished with stop_daemon_delete_repo. Function stop_daemon_delete_repo explicitly stops the daemon. Calling it via test_when_finished is needed for tests that don't check daemon's automatic shutdown logic [1] and it is needed to avoid daemons being left running in case of breakage of the logic of automatic shutdown of the daemon. Unlike these tests, test 'case insensitive+preserving' added in [2] has a call to function test_when_finished commented out. It was commented out in all versions of the patch [2] during development [3]. This seems to not be intentional, because neither commit message in [2], nor the comment above the test mention this line being commented out. Compare it, for example, to "# unicode_debug=true" which is explicitly described by a documentation comment above it. Uncomment test_when_finished for stop_daemon_delete_repo in test 'case insensitive+preserving' to ensure that daemons are not left running in cases when automatic shutdown logic of daemon itself is broken. [1] See documentation in "fsmonitor--daemon.h" for details. [2] caa9c37ec0 (t7527: test FSMonitor on case insensitive+preserving file system, 2022-05-26) [3] See mailing list thread https://lore.kernel.org/git/41f8cbc2ae45cb86e299eb230ad3cb0319256c37.1653601644.git.gitgitgadget@gmail.com/T/#t Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | t6422: drop commented out codeAndrei Rybak2023-01-131-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In commit [1] tests in t6422-merge-rename-corner-cases.sh were refactored to not run setup steps separately. This included replacing all tests like test_expect_success "setup ..." ' <code of setup> ' with corresponding Shell functions test_setup_... () { <code of setup> } During this replacement first and last lines of one of such tests got left commented out in code. Drop these lines to avoid confusion. [1] da1e295e00 (t604[236]: do not run setup in separate tests, 2019-10-22) Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | t6003: uncomment test '--max-age=c3, --topo-order'Andrei Rybak2023-01-131-13/+10
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Test '--max-age=c3, --topo-order' in t6003-rev-list-topo-order.sh has been commented out as failing since its introduction in [1]. However, the test is successful at least since commit [2] -- bisecting further is harder because of incompatibility of such old Git code with modern header file <openssl/bn.h> [3]. Uncomment this test to gain test coverage. [1] f573571a21 ([PATCH] Add t/t6003 with some --topo-order tests, 2005-07-07) [2] 765ac8ec46 (Rip out merge-order and make "git log <paths>..." work again., 2006-02-28) [3] BIGNUM used in git's `epoch.c` which was removed in [2] changed significantly between OpenSSL 1.0.2 and OpenSSL 1.1.0 See also https://stackoverflow.com/a/42295243/1083697 and https://lore.kernel.org/git/Y71qiCs+oAS2OegH@coredump.intra.peff.net/ Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'jc/doc-diff-patch.txt'Junio C Hamano2023-01-222-1/+8
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Doc update. * jc/doc-diff-patch.txt: docs: link generating patch sections
| * | | docs: link generating patch sectionsJohn Cai2023-01-132-1/+8
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, in the git-log documentation, the reference to generating patches does not match the section title. This can make the section "Generating patch text with -p" hard to find, since typically readers of the documentation will copy and paste to search the page. Let's make this more convenient for readers by linking it directly to the section. Since git-log pulls in diff-generate-patch.txt, we can provide a direct link to the section. Otherwise, change the verbiage to match exactly what the section title is, to at least make searching for it an easier task. Signed-off-by: John Cai <johncai86@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'es/hooks-and-local-env'Junio C Hamano2023-01-221-0/+12
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Doc update for environment variables set when hooks are invoked. * es/hooks-and-local-env: githooks: discuss Git operations in foreign repositories
| * | | githooks: discuss Git operations in foreign repositoriesEric Sunshine2023-01-131-0/+12
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Hook authors are periodically caught off-guard by difficult-to-diagnose errors when their hook invokes Git commands in a repository other than the local one. In particular, Git environment variables, such as GIT_DIR and GIT_WORK_TREE, which reference the local repository cause the Git commands to operate on the local repository rather than on the repository which the author intended. This is true whether the environment variables have been set manually by the user or automatically by Git itself. The same problem crops up when a hook invokes Git commands in a different worktree of the same repository, as well. Recommended best-practice[1,2,3,4,5,6] for avoiding this problem is for the hook to ensure that Git variables are unset before invoking Git commands in foreign repositories or other worktrees: unset $(git rev-parse --local-env-vars) However, this advice is not documented anywhere. Rectify this shortcoming by mentioning it in githooks.txt documentation. [1]: https://lore.kernel.org/git/YFuHd1MMlJAvtdzb@coredump.intra.peff.net/ [2]: https://lore.kernel.org/git/20200228190218.GC1408759@coredump.intra.peff.net/ [3]: https://lore.kernel.org/git/20190516221702.GA11784@sigill.intra.peff.net/ [4]: https://lore.kernel.org/git/20190422162127.GC9680@sigill.intra.peff.net/ [5]: https://lore.kernel.org/git/20180716183942.GB22298@sigill.intra.peff.net/ [6]: https://lore.kernel.org/git/20150203163235.GA9325@peff.net/ Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'rs/dup-array'Junio C Hamano2023-01-229-23/+30
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Code cleaning. * rs/dup-array: use DUP_ARRAY add DUP_ARRAY do full type check in BARF_UNLESS_COPYABLE factor out BARF_UNLESS_COPYABLE mingw: make argv2 in try_shell_exec() non-const
| * | | use DUP_ARRAYRené Scharfe2023-01-098-16/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a semantic patch for replace ALLOC_ARRAY+COPY_ARRAY with DUP_ARRAY to reduce code duplication and apply its results. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | add DUP_ARRAYRené Scharfe2023-01-091-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a macro for allocating and populating a shallow copy of an array. It is intended to replace a sequence like this: ALLOC_ARRAY(dst, n); COPY_ARRAY(dst, src, n); With the less repetitve: DUP_ARRAY(dst, src, n); It checks whether the types of source and destination are compatible to ensure the copy can be used safely. An easier alternative would be to only consider the source and return a void pointer, that could be used like this: dst = ARRAY_DUP(src, n); That would be more versatile, as it could be used in declarations as well. Making it type-safe would require the use of typeof_unqual from C23, though. So use the safe and compatible variant for now. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | do full type check in BARF_UNLESS_COPYABLERené Scharfe2023-01-091-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use __builtin_types_compatible_p to perform a full type check if possible. Otherwise fall back to the old size comparison, but add a non-evaluated assignment to catch more type mismatches. It doesn't flag copies between arrays with different signedness, but that's as close to a full type check as it gets without the builtin, as far as I can see. Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | factor out BARF_UNLESS_COPYABLERené Scharfe2023-01-091-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move the common basic element type check of COPY_ARRAY and MOVE_ARRAY to a new macro. This reduces code duplication and simplifies adding more elaborate checks. Suggested-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>