Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/t
AgeCommit message (Collapse)Author
2023-08-10Merge branch 'pw/rebase-skip-commit-message-fix'Junio C Hamano
"git rebase -i" with a series of squash/fixup, when one of the steps stopped in conflicts and ended up getting skipped, did not handle the accumulated commit log messages, which has been corrected. * pw/rebase-skip-commit-message-fix: rebase --skip: fix commit message clean up when skipping squash
2023-08-10Merge branch 'bc/ident-dot-is-no-longer-crud-letter'Junio C Hamano
Exclude "." from the set of characters to be removed from the beginning and the end of the human-readable name. * bc/ident-dot-is-no-longer-crud-letter: ident: don't consider '.' a crud
2023-08-07Merge branch 'rs/bundle-parseopt-cleanup'Junio C Hamano
Code clean-up. * rs/bundle-parseopt-cleanup: bundle: use OPT_PASSTHRU_ARGV
2023-08-07Merge branch 'tb/commit-graph-tests'Junio C Hamano
Test updates. * tb/commit-graph-tests: t/lib-commit-graph.sh: avoid sub-shell in `graph_git_behavior()` t5328: avoid top-level directory changes t5318: avoid top-level directory changes t/lib-commit-graph.sh: avoid directory change in `graph_git_behavior()` t/lib-commit-graph.sh: allow `graph_read_expect()` in sub-directories
2023-08-04Merge branch 'jc/branch-in-use-error-message'Junio C Hamano
"git branch -f X" to repoint the branch X said that X was "checked out" in another worktree, even when branch X was not and instead being bisected or rebased. The message was reworded to say the branch was "in use". * jc/branch-in-use-error-message: branch: update the message to refuse touching a branch in-use
2023-08-04Merge branch 'hy/blame-in-bare-with-contents'Junio C Hamano
"git blame --contents=file" has been taught to work in a bare repository. * hy/blame-in-bare-with-contents: blame: allow --contents to work with bare repo
2023-08-04Merge branch 'jc/parse-options-short-help'Junio C Hamano
Command line parser fix, and a small parse-options API update. * jc/parse-options-short-help: short help: allow a gap smaller than USAGE_GAP remote: simplify "remote add --tags" help text short help: allow multi-line opthelp
2023-08-04Merge branch 'ja/worktree-orphan-fix'Junio C Hamano
Fix tests with unportable regex patterns. * ja/worktree-orphan-fix: t2400: rewrite regex to avoid unintentional PCRE builtin/worktree.c: convert tab in advice to space t2400: drop no-op `--sq` from rev-parse call
2023-08-03rebase --skip: fix commit message clean up when skipping squashPhillip Wood
During a series of "fixup" and/or "squash" commands, the interactive rebase accumulates a commit message from all the commits that are being squashed together. If one of the commits has conflicts when it is picked and the user chooses to skip that commit then we need to remove that commit's message from accumulated messages. To do this 15ef69314d5 (rebase --skip: clean up commit message after a failed fixup/squash, 2018-04-27) updated commit_staged_changes() to reset the accumulated message to the commit message of HEAD (which does not contain the message from the skipped commit) when the last command was "fixup" or "squash" and there are no staged changes. Unfortunately the code to do this contains two bugs. (1) If parse_head() fails we pass an invalid pointer to unuse_commit_buffer(). (2) The reconstructed message uses the entire commit buffer from HEAD including the headers, rather than just the commit message. The first issue is fixed by splitting up the "if" condition into several statements each with its own error handling. The second issue is fixed by finding the start of the commit message within the commit buffer using find_commit_subject(). The existing test added by 15ef69314d5 is modified to show the effect of this bug. The bug is triggered when skipping the first command in the chain (as the test does before this commit) but the effect is hidden because opts->current_fixup_count is set to zero which leads update_squash_messages() to recreate the squash message file from scratch overwriting the bad message created by commit_staged_changes(). The test is also updated to explicitly check the commit messages rather than relying on grep to ensure they do not contain any stray commit headers. To check the commit message the function test_commit_message() is moved from t3437-rebase-fixup-options.sh to test-lib.sh. As the function is now publicly available it is updated to provide better error detection and avoid overwriting the commonly used files "actual" and "expect". Support for reading the expected commit message from stdin is also added. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-08-02ident: don't consider '.' a crudbrian m. carlson
When we process a user's name (as in user.name), we strip all leading and trailing crud from it. Right now, we consider a dot a crud character, and strip it off. However, this is unsuitable for many personal names because humans frequently have abbreviated suffixes, such as "Jr." or "Sr." at the end of their names, and this corrupts them. Some other users may wish to use an abbreviated name or initial, which will pose a problem especially in cultures that write the family name first, followed by the personal name. Since the current approach causes lots of practical problems, let's avoid it by no longer considering a dot to be crud. Note that "." in the name forces the entire name to be quoted to please mailers, but stripping "." only at the beginning and the end does not help a name with "." in the middle (like "brian m. carlson") so this change will not make it much worse. A name like "Given Family, Jr." that did not have to be quoted now would need to be, in order to be placed on the e-mail headers, though. This is based on a weather-balloon patch by Jeff King sent in Aug 2021 https://lore.kernel.org/git/YSKm8Q8nyTavQaox@coredump.intra.peff.net/ Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-08-02Merge branch 'ks/ref-filter-describe'Junio C Hamano
"git branch --list --format=<format>" and friends are taught a new "%(describe)" placeholder. * ks/ref-filter-describe: ref-filter: add new "describe" atom ref-filter: add multiple-option parsing functions
2023-08-02Merge branch 'ah/sequencer-rewrite-todo-fix'Junio C Hamano
When the user edits "rebase -i" todo file so that it starts with a "fixup", which would make it invalid, the command truncated the rest of the file before giving an error and returning the control back to the user. Stop truncating to make it easier to correct such a malformed todo file. * ah/sequencer-rewrite-todo-fix: sequencer: finish parsing the todo list despite an invalid first line
2023-08-02Merge branch 'bb/use-trace2-counters-for-fsync-stats'Junio C Hamano
Instead of inventing a custom counter variables for debugging, use existing trace2 facility in the fsync customization codepath. * bb/use-trace2-counters-for-fsync-stats: wrapper: use trace2 counters to collect fsync stats
2023-07-31bundle: use OPT_PASSTHRU_ARGVRené Scharfe
"git bundle" passes the progress control options to "git pack-objects" by parsing and then recreating them explicitly. Simplify that process by using OPT_PASSTHRU_ARGV instead. This also fixes --no-quiet, which has been doing the same as --quiet since its introduction by 79862b6b77 (bundle-create: progress output control, 2019-11-10) because it had been defined using OPT_SET_INT with a value of 0, which sets 0 when negated as well. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-07-28Merge branch 'rs/describe-parseopt-fix'Junio C Hamano
Command line parser fix. * rs/describe-parseopt-fix: describe: fix --no-exact-match
2023-07-28Merge branch 'jc/parse-options-reset'Junio C Hamano
Command line parser fix. * jc/parse-options-reset: reset: reject --no-(mixed|soft|hard|merge|keep) option
2023-07-28Merge branch 'jc/parse-options-show-branch'Junio C Hamano
Command line parser fixes. * jc/parse-options-show-branch: show-branch: reject --[no-](topo|date)-order show-branch: --no-sparse should give dense output
2023-07-28Merge branch 'jc/transport-parseopt-fix'Junio C Hamano
Command line parser fixes. * jc/transport-parseopt-fix: fetch: reject --no-ipv[46] parse-options: introduce OPT_IPVERSION()
2023-07-27t2400: rewrite regex to avoid unintentional PCREJacob Abel
Replace all cases of `\s` with ` ` as it is not part of POSIX BRE or ERE and therefore not all versions of grep handle it. For the same reason all cases of `\S` are replaced with `[^ ]`. It is not an exact replacement but it is close enough for this use case. Also, do not write `\+` in BRE and expect it to mean 1 or more; it is a GNU extension that may not work everywhere. Remove `.*` from the end of a pattern that is not right-anchored. Signed-off-by: Jacob Abel <jacobabel@nullpo.dev> Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-07-27t2400: drop no-op `--sq` from rev-parse callJacob Abel
Signed-off-by: Jacob Abel <jacobabel@nullpo.dev> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-07-27Merge branch 'jc/branch-parseopt-fix'Junio C Hamano
Command line parser fixes. * jc/branch-parseopt-fix: branch: reject "--no-all" and "--no-remotes" early
2023-07-27Merge branch 'rs/ls-tree-no-full-name-fix'Junio C Hamano
Command line parser fix. * rs/ls-tree-no-full-name-fix: ls-tree: fix --no-full-name
2023-07-25Merge branch 'jk/nested-points-at'Junio C Hamano
"git tag --list --points-at X" showed tags that directly refers to object X, but did not list a tag that points at such a tag, which has been corrected. * jk/nested-points-at: ref-filter: simplify return type of match_points_at ref-filter: avoid parsing non-tags in match_points_at() ref-filter: avoid parsing tagged objects in match_points_at() ref-filter: handle nested tags in --points-at option
2023-07-25Merge branch 'rs/ref-filter-signature-fix'Junio C Hamano
Test fix. * rs/ref-filter-signature-fix: t6300: fix setup with GPGSSH but without GPG
2023-07-25Merge branch 'jk/unused-parameter'Junio C Hamano
Mark-up unused parameters in the code so that we can eventually enable -Wunused-parameter by default. * jk/unused-parameter: t/helper: mark unused callback void data parameters tag: mark unused parameters in each_tag_name_fn callbacks rev-parse: mark unused parameter in for_each_abbrev callback replace: mark unused parameter in each_mergetag_fn callback replace: mark unused parameter in ref callback merge-tree: mark unused parameter in traverse callback fsck: mark unused parameters in various fsck callbacks revisions: drop unused "opt" parameter in "tweak" callbacks count-objects: mark unused parameter in alternates callback am: mark unused keep_cr parameters http-push: mark unused parameter in xml callback http: mark unused parameters in curl callbacks do_for_each_ref_helper(): mark unused repository parameter test-ref-store: drop unimplemented reflog-expire command
2023-07-25Merge branch 'dk/t4002-syntaxo-fix'Junio C Hamano
Test fix. * dk/t4002-syntaxo-fix: t4002: fix "diff can read from stdin" syntax
2023-07-25Merge branch 'ah/advise-force-pushing'Junio C Hamano
Help newbies by suggesting that there are cases where force-pushing is a valid and sensible thing to update a branch at a remote repository, rather than reconciling with merge/rebase. * ah/advise-force-pushing: push: don't imply that integration is always required before pushing remote: don't imply that integration is always required before pushing wt-status: don't show divergence advice when committing
2023-07-25t/lib-commit-graph.sh: avoid sub-shell in `graph_git_behavior()`Taylor Blau
In a previous commit, we introduced a sub-shell in the implementation of `graph_git_behavior()`, in order to allow us to pass `-C "$DIR"` directly to the git processes spawned by `graph_git_two_modes()`. Now that its callers are always operating from the "$TRASH_DIRECTORY" instead of one of its sub-directories, we can drop the inner sub-shell, as it is no longer required. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-07-25t5328: avoid top-level directory changesTaylor Blau
In a similar spirit as the last commit, avoid top-level directory changes in the last remaining commit-graph related test, t5328. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-07-25t5318: avoid top-level directory changesTaylor Blau
Avoid changing the current working directory from outside of a sub-shell during the tests in t5318. Each test has mostly straightforward changes, either: - Removing the top-level `cd "$TRASH_DIRECTORY/full"`, which is unnecessary after ensuring that other tests don't change their working directory outside of a sub-shell. - Changing any Git invocations which want to be in a sub-directory by either (a) adding a "-C $DIR" argument, or (b) moving the whole test into a sub-shell. While we're here, remove any explicit "git config core.commitGraph true" invocations which were designed to enable use of the commit-graph. These are unnecessary following 31b1de6a09b (commit-graph: turn on commit-graph by default, 2019-08-13). Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-07-25t/lib-commit-graph.sh: avoid directory change in `graph_git_behavior()`Taylor Blau
The `graph_git_behavior()` helper asserts that a number of common Git operations (such as `git log --oneline`, `git log --topo-order`, etc.) produce identical output regardless of whether or not a commit-graph is in use. This helper takes as its second argument the location (relative to the `$TRASH_DIRECTORY`) of the Git repostiory under test. In order to run each of its commands within that repository, it first changes into that directory, without the use of a sub-shell. This pollutes future tests which expect to be run in the top-level `$TRASH_DIRECTORY` as usual. We could wrap `graph_git_behavior()` in a sub-shell, like: graph_git_behavior() { # ... ( cd "$TRASH_DIRECTORY/$DIR" && graph_git_two_modesl ) } , but since we're invoking git directly, we can pass along a "-C $DIR" when "$DIR" is non-empty. Note, however, that until the remaining callers are cleaned up to avoid changing working directories outside of a sub-shell, that we need to ensure that we are operating in the top-level $TRASH_DIRECTORY. The inner-subshell will go away in a future commit once it is no longer necessary. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-07-25t/lib-commit-graph.sh: allow `graph_read_expect()` in sub-directoriesTaylor Blau
The `graph_read_expect()` function is used to ensure that the output of the "read-graph" test helper matches certain parameters (e.g., how many commits are in the graph, which chunks were written, etc.). It expects the Git repository being tested to be at the current working directory. However, a handful of t5318 tests use different repositories stored in sub-directories. To work around this, several tests in t5318 change into the relevant repository outside of a sub-shell, altering the context for the rest of the suite. Prepare to remove these globally-scoped directory changes by teaching `graph_read_expect()` to take an optional "-C dir" to specify where the repository containing the commit-graph being tested is. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-07-24ref-filter: add new "describe" atomKousik Sanagavarapu
Duplicate the logic of %(describe) and friends from pretty to ref-filter. In the future, this change helps in unifying both the formats as ref-filter will be able to do everything that pretty is doing and we can have a single interface. The new atom "describe" and its friends are equivalent to the existing pretty formats with the same name. Helped-by: Junio C Hamano <gitster@pobox.com> Mentored-by: Christian Couder <christian.couder@gmail.com> Mentored-by: Hariom Verma <hariom18599@gmail.com> Signed-off-by: Kousik Sanagavarapu <five231003@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-07-24sequencer: finish parsing the todo list despite an invalid first lineAlex Henrie
Before the todo list is edited it is rewritten to shorten the OIDs of the commits being picked and to append advice about editing the list. The exact advice depends on whether the todo list is being edited for the first time or not. After the todo list has been edited it is rewritten to lengthen the OIDs of the commits being picked and to remove the advice. If the edited list cannot be parsed then this last step is skipped. Prior to db81e50724 (rebase-interactive: use todo_list_write_to_file() in edit_todo_list(), 2019-03-05) if the existing todo list could not be parsed then the initial rewrite was skipped as well. This had the unfortunate consequence that if the list could not be parsed after the initial edit the advice given to the user was wrong when they re-edited the list. This change relied on todo_list_parse_insn_buffer() returning the whole todo list even when it cannot be parsed. Unfortunately if the list starts with a "fixup" command then it will be truncated and the remaining lines are lost. Fix this by continuing to parse after an initial "fixup" commit as we do when we see any other invalid line. Signed-off-by: Alex Henrie <alexhenrie24@gmail.com> [jc: removed an apparently unneeded subshell around the test body] Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-07-22branch: update the message to refuse touching a branch in-useJunio C Hamano
The "git branch -f" command can refuse to force-update a branch that is used by another worktree. The original rationale for this behaviour was that updating a branch that is checked out in another worktree, without making a matching change to the index and the working tree files in that worktree, will lead to a very confused user. "git diff HEAD" will no longer give a useful patch, because HEAD is a commit unrelated to what the index and the working tree in the worktree were based on, for example. These days, the same mechanism also protects branches that are being rebased or bisected, and the same machanism is expected to be the right place to add more checks, when we decide to protect branches undergoing other kinds of operations. We however forgot to rethink the messaging, which originally said that we are refusing to touch the branch because it is "checked out" elsewhere, when d2ba271a (branch: check for bisects and rebases, 2022-06-14) started to protect branches that are being rebased or bisected. The spirit of the check has always been that we do not want to disrupt the use of the same branch in other worktrees. Let's reword the message slightly to say that the branch is "used by" another worktree, instead of "checked out". We could teach the branch.c:prepare_checked_out_branches() function to remember why it decided that a particular branch needs protecting (i.e. was it because it was checked out? being bisected? something else?) in addition to which worktree the branch was in use, and use that in the error message to say "you cannot force update this branch because it is being bisected in the worktree X", etc., but it is dubious that such extra complexity is worth it. The message already tells which directory the worktree in question is, and it should be just a "chdir" away for the user to find out what state it is in, if the user felt curious enough. So let's not go there yet. Helped-by: Josh Sref <jsoref@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-07-21Merge branch 'tb/refs-exclusion-and-packed-refs'Junio C Hamano
Enumerating refs in the packed-refs file, while excluding refs that match certain patterns, has been optimized. * tb/refs-exclusion-and-packed-refs: ls-refs.c: avoid enumerating hidden refs where possible upload-pack.c: avoid enumerating hidden refs where possible builtin/receive-pack.c: avoid enumerating hidden references refs.h: implement `hidden_refs_to_excludes()` refs.h: let `for_each_namespaced_ref()` take excluded patterns revision.h: store hidden refs in a `strvec` refs/packed-backend.c: add trace2 counters for jump list refs/packed-backend.c: implement jump lists to avoid excluded pattern(s) refs/packed-backend.c: refactor `find_reference_location()` refs: plumb `exclude_patterns` argument throughout builtin/for-each-ref.c: add `--exclude` option ref-filter.c: parameterize match functions over patterns ref-filter: add `ref_filter_clear()` ref-filter: clear reachable list pointers after freeing ref-filter.h: provide `REF_FILTER_INIT` refs.c: rename `ref_filter`
2023-07-21describe: fix --no-exact-matchRené Scharfe
Since 2c33f75754 (Teach git-describe --exact-match to avoid expensive tag searches, 2008-02-24) git describe accepts --no-exact-match, but it does the same as --exact-match, an alias for --candidates=0. That's because it's defined using OPT_SET_INT with a value of 0, which sets 0 when negated as well. Let --no-exact-match set the number of candidates to the default value instead. Users that need a more specific lack of exactitude can specify their preferred value using --candidates, as before. The "--no-exact-match" option was not covered in the tests, so let's add a few. Also add a case where --exact-match option is used on a commit that cannot be described without distance from tags and make sure the command fails. Signed-off-by: René Scharfe <l.s.r@web.de> [jc: added trivial tests] Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-07-21blame: allow --contents to work with bare repoHan Young
The --contents option can be used with git blame to blame the file as if it had the contents from the specified file. Since 1a3119ed (blame: allow --contents to work with non-HEAD commit, 2023-03-24), the --contents option can work with non-HEAD commit. However, if you try to use --contents in a bare repository, you get the following error: fatal: this operation must be run in a work tree This is because before trying to generate a fake working tree commit, we always call setup_work_tree(). But in a bare repo, working tree is not available. The call to setup_work_tree is used to prepare the reading of the blamed file in the working tree, which isn't necessary if we are reading the contents from the specific file instead of the file in the working tree. Add a check in setup_scoreboard to skip setup_work_tree if we are reading from the file specified in --contents. This enables us to use --contents in a bare repo. This is a nice addition on top of 1a3119ed, having a working tree to use --contents is optional. Add test for the --contents option with bare repo to the annotate-tests.sh test script. Signed-off-by: Han Young <hanyang.tony@bytedance.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-07-20wrapper: use trace2 counters to collect fsync statsBeat Bolli
As mentioned in the thread starting at [1], trace2 counters should be used to count events instead of ad-hoc static variables. Convert the two fsync static variables to trace2 counters, reducing the coupling between wrapper.c and the trace2 subsystem. Adjust t/t5351 to match the trace2 counter output format. The counters are not per-thread because the ones being replaced also were not. [1] https://lore.kernel.org/git/20230627195251.1973421-2-calvinwan@google.com/ Signed-off-by: Beat Bolli <dev+git@drbeat.li> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-07-20reset: reject --no-(mixed|soft|hard|merge|keep) optionJunio C Hamano
"git reset --no-mixed" behaved exactly like "git reset --mixed", which was nonsense. If there were only two kinds, e.g. "mixed" vs "separate", it might have made sense to make "git reset --no-mixed" behave identically to "git reset --separate" and vice-versa, but because we have many types of reset, let's just forbid "--no-mixed" and negated form of other types. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-07-20show-branch: reject --[no-](topo|date)-orderJunio C Hamano
"git show-branch --no-topo-order" behaved exactly the same way as "git show-branch --topo-order" did, which was nonsense. This was because we choose between topo- and date- by setting a variable to either REV_SORT_IN_GRAPH_ORDER or REV_SORT_BY_COMMIT_DATE with OPT_SET_INT() and REV_SORT_IN_GRAPH_ORDER happens to be 0. The OPT_SET_INT() macro assigns 0 to the target variable in respose to the negated form of its option. "--no-date-order" by luck behaves identically to "--topo-order" exactly for the same reason, and it sort-of makes sense right now, but the "sort-of makes sense" will quickly break down once we add a third way to sort. Not-A may be B when there are only two choices between A and B, but once your choices become among A, B, and C, not-A does not mean B. Just mark these two ordering options to reject negation, and add a test, which was missing. "git show-branch --no-reflog" is also unnegatable, so throw in a test for that while we are at it. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-07-20short help: allow a gap smaller than USAGE_GAPJunio C Hamano
The parse-options API responds to "git cmd -h" by listing the option flag (padded to the USAGE_OPTS_WIDTH column), followed by USAGE_GAP (set to 2) whitespaces, followed by the help text. If the flags part does not fit within the USAGE_OPTS_WIDTH, the help text is given on its own line. Imagine that "@" below depicts the USAGE_OPTS_WIDTH'th column, and "#" are for the usage help text, the output may look like this: @@@@@@@@@@@@@ ######################################## -f description of the flag '-f' comes here --short=<num> description of the flag '--short' --very-long-option=<number> description of the flag '--very-long-option' This is all good and nice in principle, but it becomes awkward when the flags part is just one column over the limit and forces a line break. See the description of the "--almost" option below: @@@@@@@@@@@@@ ######################################## -f description of the flag '-f' comes here --short=<num> description of the flag '--short' --almost=<num> description of the flag '--almost' --very-long-option=<number> description of the flag '--very-long-option' If we allow shrinking the gap to a single whitespace only in such a case, we would instead get: @@@@@@@@@@@@@ ######################################## -f description of the flag '-f' comes here --short=<num> description of the flag '--short' --almost=<num> description of the flag '--almost' --very-long-option=<number> description of the flag '--very-long-option' and the boundary between the flags and their descriptions does not become any harder to see, while saving precious vertical screen real estate. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-07-20short help: allow multi-line opthelpJunio C Hamano
When "-h" triggers the short-help in a command that implements its option parsing using the parse-options API, the option help text is shown with a single fprintf() as a long line. When the text is multi-line, the second and subsequent lines are not left padded, that breaks the alignment across options. Borrowing the idea from the advice API where its hint strings are shown with (localized) "hint:" prefix, let's internally split the (localized) help text into lines, and showing the first line, pad the remaining lines to align. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-07-19show-branch: --no-sparse should give dense outputJunio C Hamano
"git show-branch --no-sparse" behaved exactly the same way as "git show-branch --sparse", which did not make any sense. This was because it used a variable "dense" initialized to 1 by default to give "non sparse" behaviour, and OPT_SET_INT() to set the varilable to 0 in response to the "--sparse" option. Unfortunately, OPT_SET_INT() sets 0 to the given variable when the option is negated. Flip the polarity of the variable "dense" by renaming it to "sparse" and initializing it to 0, and have OPT_SET_INT() set the variable to 1 when "--sparse" is given. This way, "--no-sparse" would set 0 to the variable and would give us the "dense" behaviour. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-07-19fetch: reject --no-ipv[46]Junio C Hamano
Now we have introduced OPT_IPVERSION(), tweak its implementation so that "git clone", "git fetch", and "git push" reject the negated form of "Use only IP version N" options. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-07-18branch: reject "--no-all" and "--no-remotes" earlyJunio C Hamano
As the command line parser for "git branch --all" forgets to use PARSE_OPT_NONEG, it accepted "git branch --no-all", and then passed a nonsense value to the underlying machinery, leading to a fatal error "filter_refs: invalid type". The "--remotes" option had exactly the same issue. Catch the unsupported options early in the option parser. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-07-18ls-tree: fix --no-full-nameRené Scharfe
Since 61fdbcf98b (ls-tree: migrate to parse-options, 2009-11-13) git ls-tree has accepted the option --no-full-name, but it does the same as --full-name, contrary to convention. That's because it's defined using OPT_SET_INT with a value of 0, where the negative variant sets 0 as well. Turn --no-full-name into the opposite of --full-name by using OPT_BOOL instead and storing the option's status directly in a variable named "full_name" instead of in negated form in "chomp_prefix". Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-07-18Merge branch 'tb/fsck-no-progress'Junio C Hamano
"git fsck --no-progress" still spewed noise from the commit-graph subsystem, which has been corrected. * tb/fsck-no-progress: commit-graph.c: avoid duplicated progress output during `verify` commit-graph.c: pass progress to `verify_one_commit_graph()` commit-graph.c: iteratively verify commit-graph chains commit-graph.c: extract `verify_one_commit_graph()` fsck: suppress MIDX output with `--no-progress` fsck: suppress commit-graph output with `--no-progress`
2023-07-18Merge branch 'tb/repack-cleanup'Junio C Hamano
The recent change to "git repack" made it react less nicely when a leftover .idx file that no longer has the corresponding .pack file in the repository, which has been corrected. * tb/repack-cleanup: builtin/repack.c: avoid dir traversal in `collect_pack_filenames()` builtin/repack.c: only repack `.pack`s that exist
2023-07-18ref-filter: handle nested tags in --points-at optionJan Klötzke
Tags are dereferenced until reaching a different object type to handle nested tags, e.g. on checkout. In contrast, "git tag --points-at=..." fails to list such nested tags because only one level of indirection is obtained in filter_refs(). Implement the recursive dereferencing for the "--points-at" option when filtering refs to unify the behaviour. Signed-off-by: Jan Klötzke <jan@kloetzke.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>