Compare

d7e8ff85654db0af86abc1612e82557dfb8e0dff..995251109fa3e631e6fc7204e8cad128e8da2217

doc/refs: backtick-quote commands and options consistently

The git-refs doc was converted to the synopsis style in 89be7d2774
(builtin/refs: add '--no-reflog' flag to drop reflogs, 2025-02-21).  The
commands and options were not backtick-quoted at that time.  84f3d6e11e
(doc lint: check that synopsis manpages have synopsis inlines,
2025-08-11) applied backtick-quotes to the existing commands and
options.

Subsequently, a number of commands and options were added without such
quoting, leaving the documentation rendered inconsistently.  Apply
backtick-quotes to all entries.

Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Todd Zullinger <tmz@pobox.com> · 2026-09-15 13:10 UTC · committed by Junio C Hamano

Browse files
26 files changed, +63 −403
modified Documentation/config/maintenance.adoc
@@ -41,7 +41,6 @@ The possible strategies are:
41 41 This repacking strategy is a full replacement for the `gc` strategy and is
42 42 recommended for large repositories. This is the default strategy for manual
43 43 maintenance.
44 - +
45 44 * `incremental`: This setting optimizes for performing small maintenance
46 45 activities that do not delete any data. This does not schedule the `gc`
47 46 task, but runs the `prefetch` and `commit-graph` tasks hourly, the
modified Documentation/git-cherry-pick.adoc
@@ -25,8 +25,7 @@ happens:
25 25 1. The current branch and `HEAD` pointer stay at the last commit
26 26 successfully made.
27 27 2. The `CHERRY_PICK_HEAD` ref is set to point at the commit that
28 - introduced the change that is difficult to apply, unless the
29 - `--no-commit` option was given.
28 + introduced the change that is difficult to apply.
30 29 3. Paths in which the change applied cleanly are updated both
31 30 in the index file and in your working tree.
32 31 4. For conflicting paths, the index file records up to three
@@ -102,11 +101,6 @@ OPTIONS
102 101 +
103 102 This is useful when cherry-picking more than one commits'
104 103 effect to your index in a row.
105 - +
106 - This option does not record `CHERRY_PICK_HEAD`, so a plain `git commit`
107 - afterwards records you as the author. That is by design: what you are
108 - building is your own work, which you keep changing before committing,
109 - rather than a reproduction of the original commit.
110 104
111 105 -s::
112 106 --signoff::
modified Documentation/git-pack-refs.adoc
@@ -7,8 +7,8 @@ git-pack-refs - Pack heads and tags for efficient repository access
7 7
8 8 SYNOPSIS
9 9 --------
10 - [verse]
11 - 'git pack-refs' [--all] [--no-prune] [--auto] [--include <pattern>] [--exclude <pattern>]
10 + [synopsis]
11 + git pack-refs [--all] [--no-prune] [--auto] [--include <pattern>] [--exclude <pattern>]
12 12
13 13 DESCRIPTION
14 14 -----------
@@ -52,8 +52,8 @@ BUGS
52 52 ----
53 53
54 54 Older documentation written before the packed-refs mechanism was
55 - introduced may still say things like ".git/refs/heads/<branch> file
56 - exists" when it means "branch <branch> exists".
55 + introduced may still say things like ".git/refs/heads/_<branch>_ file
56 + exists" when it means "branch _<branch>_ exists".
57 57
58 58
59 59 GIT
modified Documentation/git-refs.adoc
@@ -54,40 +54,40 @@ These limitations may eventually be lifted.
54 54 `verify`::
55 55 Verify reference database consistency.
56 56
57 - list::
57 + `list`::
58 58 List references in the repository with support for filtering,
59 59 formatting, and sorting. This subcommand is an alias for
60 60 linkgit:git-for-each-ref[1] and offers identical functionality.
61 61
62 - exists::
62 + `exists`::
63 63 Check whether the given reference exists. Returns an exit code of 0 if
64 64 it does, 2 if it is missing, and 1 in case looking up the reference
65 65 failed with an error other than the reference being missing. This does
66 66 not verify whether the reference resolves to an actual object.
67 67
68 - optimize::
68 + `optimize`::
69 69 Optimizes references to improve repository performance and reduce disk
70 70 usage. This subcommand is an alias for linkgit:git-pack-refs[1] and
71 71 offers identical functionality.
72 72
73 - create::
73 + `create`::
74 74 Create the given reference, which must not already exist, pointing at
75 75 `<new-value>`.
76 76
77 - delete::
77 + `delete`::
78 78 Delete the given reference. This subcommand mirrors `git update-ref -d`
79 79 (see linkgit:git-update-ref[1]). When `<old-value>` is given, the
80 80 reference is only deleted after verifying that it currently contains
81 81 `<old-value>`.
82 82
83 - update::
83 + `update`::
84 84 Update the given reference to point at `<new-value>`. If `<old-value>`
85 85 is given, the reference is only updated after verifying that it
86 86 currently contains `<old-value>`. As a special case, an all-zeroes
87 87 `<new-value>` deletes the branch, whereas an all-zeroes `<old-value>`
88 88 ensures that the branch does not yet exist.
89 89
90 - rename::
90 + `rename`::
91 91 Rename the reference `<oldref>` to `<newref>`. The old reference must
92 92 exist and the new reference must not yet exist, and both must have a
93 93 well-formed name (see linkgit:git-check-ref-format[1]).
modified Documentation/git.adoc
@@ -25,8 +25,7 @@ and full access to internals.
25 25 See linkgit:gittutorial[7] to get started, then see
26 26 linkgit:giteveryday[7] for a useful minimum set of
27 27 commands. The link:user-manual.html[Git User's Manual] has a more
28 - in-depth introduction. See linkgit:gitdatamodel[7] if you want to
29 - learn about the data model and important terminology.
28 + in-depth introduction.
30 29
31 30 After you mastered the basic concepts, you can come back to this
32 31 page to learn what commands Git offers. You can learn more about
@@ -470,9 +469,7 @@ Higher level SCMs may provide and manage additional information in the
470 469
471 470 Terminology
472 471 -----------
473 - Please see linkgit:gitglossary[7]. See linkgit:gitdatamodel[7] for a
474 - discussion of the core data model, which includes important terminology
475 - used throughout the documentation.
472 + Please see linkgit:gitglossary[7].
476 473
477 474
478 475 Environment Variables
@@ -1202,9 +1199,8 @@ SEE ALSO
1202 1199 --------
1203 1200 linkgit:gittutorial[7], linkgit:gittutorial-2[7],
1204 1201 linkgit:giteveryday[7], linkgit:gitcvs-migration[7],
1205 - linkgit:gitglossary[7], linkgit:gitdatamodel[7],
1206 - linkgit:gitcore-tutorial[7], linkgit:gitcli[7],
1207 - link:user-manual.html[The Git User's Manual],
1202 + linkgit:gitglossary[7], linkgit:gitcore-tutorial[7],
1203 + linkgit:gitcli[7], link:user-manual.html[The Git User's Manual],
1208 1204 linkgit:gitworkflows[7]
1209 1205
1210 1206 GIT
modified Documentation/gitdatamodel.adoc
@@ -300,10 +300,6 @@ $ git reflog main --date=iso --no-decorate
300 300 4ccb6d7 main@{2025-09-29 15:16:48 -0400}: commit (initial): Initial commit
301 301 ----
302 302
303 - SEE ALSO
304 - --------
305 - linkgit:gitglossary[7]
306 -
307 303 GIT
308 304 ---
309 305 Part of the linkgit:git[1] suite
modified Documentation/gitglossary.adoc
@@ -16,7 +16,6 @@ include::glossary-content.adoc[]
16 16
17 17 SEE ALSO
18 18 --------
19 - linkgit:gitdatamodel[7],
20 19 linkgit:gittutorial[7],
21 20 linkgit:gittutorial-2[7],
22 21 linkgit:gitcvs-migration[7],
modified Documentation/glossary-content.adoc
@@ -251,8 +251,7 @@ for a more flexible and robust system to do the same thing.
251 251 as objects. The index is a stored version of your
252 252 <<def_working_tree,working tree>>. Truth be told, it can also contain a second, and even
253 253 a third version of a working tree, which are used
254 - when <<def_merge,merging>>. See "THE INDEX" in
255 - linkgit:gitdatamodel[7] for details.
254 + when <<def_merge,merging>>.
256 255
257 256 [[def_index_entry]]index entry::
258 257 The information regarding a particular file, stored in the
@@ -291,8 +290,7 @@ This commit is referred to as a "merge commit", or sometimes just a
291 290 [[def_object]]object::
292 291 The unit of storage in Git. It is uniquely identified by the
293 292 <<def_SHA1,SHA-1>> of its contents. Consequently, an
294 - object cannot be changed. See "OBJECTS" in
295 - linkgit:gitdatamodel[7] for details.
293 + object cannot be changed.
296 294
297 295 [[def_object_database]]object database::
298 296 Stores a set of "objects", and an individual <<def_object,object>> is
@@ -589,17 +587,12 @@ extended in the future:
589 587 Different subhierarchies are used for different purposes. For example,
590 588 the `refs/heads/` hierarchy is used to represent local branches whereas
591 589 the `refs/tags/` hierarchy is used to represent local tags..
592 - +
593 - See also "REFERENCES" in linkgit:gitdatamodel[7].
594 590
595 591 [[def_reflog]]reflog::
596 592 A reflog shows the local "history" of a ref. In other words,
597 593 it can tell you what the 3rd last revision in _this_ repository
598 594 was, and what was the current state in _this_ repository,
599 - yesterday 9:14pm.
600 - +
601 - See "REFLOGS" in linkgit:gitdatamodel[7] for a short explanation of the
602 - format. See linkgit:git-reflog[1] for details.
595 + yesterday 9:14pm. See linkgit:git-reflog[1] for details.
603 596
604 597 [[def_refspec]]refspec::
605 598 A "refspec" is used by <<def_fetch,fetch>> and
modified Documentation/pack-refs-options.adoc
@@ -1,4 +1,4 @@
1 - --all::
1 + `--all`::
2 2
3 3 The command by default packs all tags and refs that are already
4 4 packed, and leaves other refs
@@ -8,12 +8,12 @@ This option causes all refs to be packed as well, with the exception
8 8 of hidden refs, broken refs, and symbolic refs. Useful for a repository
9 9 with many branches of historical interests.
10 10
11 - --no-prune::
11 + `--no-prune`::
12 12
13 13 The command usually removes loose refs under `$GIT_DIR/refs`
14 14 hierarchy after packing them. This option tells it not to.
15 15
16 - --auto::
16 + `--auto`::
17 17
18 18 Pack refs as needed depending on the current state of the ref database. The
19 19 behavior depends on the ref format used by the repository and may change in the
@@ -29,7 +29,7 @@ future.
29 29 maintains the property that N is at least twice as big as N+1. Only
30 30 tables that violate this property are compacted.
31 31
32 - --include <pattern>::
32 + `--include <pattern>`::
33 33
34 34 Pack refs based on a `glob(7)` pattern. Repetitions of this option
35 35 accumulate inclusion patterns. If a ref is both included in `--include` and
@@ -38,7 +38,7 @@ tags from being included by default. Symbolic refs and broken refs will never
38 38 be packed. When used with `--all`, it will be a noop. Use `--no-include` to clear
39 39 and reset the list of patterns.
40 40
41 - --exclude <pattern>::
41 + `--exclude <pattern>`::
42 42
43 43 Do not pack refs matching the given `glob(7)` pattern. Repetitions of this option
44 44 accumulate exclusion patterns. Use `--no-exclude` to clear and reset the list of
modified builtin/commit.c
@@ -515,25 +515,13 @@ static const char *prepare_index(const char **argv, const char *prefix,
515 515 */
516 516 commit_style = COMMIT_PARTIAL;
517 517
518 - switch (sequencer_ongoing_operation(the_repository, whence)) {
519 - case ONGOING_NONE:
520 - break;
521 - case ONGOING_MERGE:
522 - die(_("cannot do a partial commit during a merge."));
523 - case ONGOING_CHERRY_PICK:
524 - die(_("cannot do a partial commit during a cherry-pick."));
525 - case ONGOING_REBASE_NOW_EMPTY:
526 - /*
527 - * A pick that became empty is not a conflict, and creating
528 - * a new commit (partial or not) poses no problem.
529 - */
530 - break;
531 - case ONGOING_REVERT:
532 - die(_("cannot do a partial commit during a revert."));
533 - case ONGOING_AM:
534 - die(_("cannot do a partial commit during an am session."));
535 - case ONGOING_REBASE_CONFLICT:
536 - die(_("cannot do a partial commit while resolving conflicts during a rebase."));
518 + if (whence != FROM_COMMIT) {
519 + if (whence == FROM_MERGE)
520 + die(_("cannot do a partial commit during a merge."));
521 + else if (is_from_cherry_pick(whence))
522 + die(_("cannot do a partial commit during a cherry-pick."));
523 + else if (is_from_rebase(whence))
524 + die(_("cannot do a partial commit during a rebase."));
537 525 }
538 526
539 527 if (list_paths(&partial, !current_head ? NULL : "HEAD", &pathspec))
@@ -905,7 +893,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
905 893 */
906 894 else if (whence == FROM_MERGE)
907 895 hook_arg1 = "merge";
908 - else if (is_from_cherry_pick(whence) || is_from_rebase_now_empty(whence)) {
896 + else if (is_from_cherry_pick(whence) || whence == FROM_REBASE_PICK) {
909 897 hook_arg1 = "commit";
910 898 hook_arg2 = "CHERRY_PICK_HEAD";
911 899 }
@@ -1098,7 +1086,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
1098 1086 if (amend)
1099 1087 fputs(_(empty_amend_advice), stderr);
1100 1088 else if (is_from_cherry_pick(whence) ||
1101 - is_from_rebase_now_empty(whence)) {
1089 + whence == FROM_REBASE_PICK) {
1102 1090 fputs(_(empty_cherry_pick_advice), stderr);
1103 1091 if (whence == FROM_CHERRY_PICK_SINGLE)
1104 1092 fputs(_(empty_cherry_pick_advice_single), stderr);
@@ -1338,30 +1326,15 @@ static int parse_and_validate_options(int argc, const char *argv[],
1338 1326 use_editor = 0;
1339 1327
1340 1328 /* Sanity check options */
1341 - if (amend) {
1342 - if (!current_head)
1343 - die(_("You have nothing to amend."));
1344 - /*
1345 - * Refuse to amend in the middle of any operation that is
1346 - * meant to record its result as a new commit on top of HEAD
1347 - * rather than by rewriting HEAD.
1348 - */
1349 - switch (sequencer_ongoing_operation(s->repo, whence)) {
1350 - case ONGOING_NONE:
1351 - break;
1352 - case ONGOING_MERGE:
1329 + if (amend && !current_head)
1330 + die(_("You have nothing to amend."));
1331 + if (amend && whence != FROM_COMMIT) {
1332 + if (whence == FROM_MERGE)
1353 1333 die(_("You are in the middle of a merge -- cannot amend."));
1354 - case ONGOING_CHERRY_PICK:
1334 + else if (is_from_cherry_pick(whence))
1355 1335 die(_("You are in the middle of a cherry-pick -- cannot amend."));
1356 - case ONGOING_REBASE_NOW_EMPTY:
1357 - die(_("The now-empty commit has been dropped -- cannot amend."));
1358 - case ONGOING_REVERT:
1359 - die(_("You are in the middle of a revert -- cannot amend."));
1360 - case ONGOING_AM:
1361 - die(_("You are in the middle of an am session -- cannot amend."));
1362 - case ONGOING_REBASE_CONFLICT:
1363 - die(_("You are resolving conflicts during a rebase -- cannot amend."));
1364 - }
1336 + else if (whence == FROM_REBASE_PICK)
1337 + die(_("You are in the middle of a rebase -- cannot amend."));
1365 1338 }
1366 1339 if (fixup_message && squash_message)
1367 1340 die(_("options '%s' and '%s' cannot be used together"), "--squash", "--fixup");
@@ -1380,7 +1353,7 @@ static int parse_and_validate_options(int argc, const char *argv[],
1380 1353 if (amend && !use_message && !fixup_message)
1381 1354 use_message = "HEAD";
1382 1355 if (!use_message && !is_from_cherry_pick(whence) &&
1383 - !is_from_rebase_now_empty(whence) && renew_authorship)
1356 + !is_from_rebase(whence) && renew_authorship)
1384 1357 die(_("--reset-author can be used only with -C, -c or --amend."));
1385 1358 if (use_message) {
1386 1359 use_message_buffer = read_commit_message(use_message);
@@ -1389,7 +1362,7 @@ static int parse_and_validate_options(int argc, const char *argv[],
1389 1362 author_message_buffer = use_message_buffer;
1390 1363 }
1391 1364 }
1392 - if ((is_from_cherry_pick(whence) || is_from_rebase_now_empty(whence)) &&
1365 + if ((is_from_cherry_pick(whence) || whence == FROM_REBASE_PICK) &&
1393 1366 !renew_authorship) {
1394 1367 author_message = "CHERRY_PICK_HEAD";
1395 1368 author_message_buffer = read_commit_message(author_message);
@@ -1914,7 +1887,7 @@ int cmd_commit(int argc,
1914 1887 if (!reflog_msg)
1915 1888 reflog_msg = is_from_cherry_pick(whence)
1916 1889 ? "commit (cherry-pick)"
1917 - : is_from_rebase_now_empty(whence)
1890 + : is_from_rebase(whence)
1918 1891 ? "commit (rebase)"
1919 1892 : "commit";
1920 1893 commit_list_insert(current_head, &parents);
modified builtin/history.c
@@ -786,10 +786,6 @@ static int write_ondisk_index(struct repository *repo,
786 786 opts.dst_index = &index;
787 787
788 788 tree = repo_parse_tree_indirect(repo, oid);
789 - if (!tree) {
790 - ret = error(_("unable to parse tree %s"), oid_to_hex(oid));
791 - goto out;
792 - }
793 789 init_tree_desc(&tree_desc, &tree->object.oid, tree->buffer, tree->size);
794 790
795 791 if (unpack_trees(1, &tree_desc, &opts)) {
modified builtin/submodule--helper.c
@@ -80,7 +80,6 @@ static int get_default_remote_submodule(const char *module_path, char **default_
80 80 struct repository subrepo;
81 81 const char *remote_name = NULL;
82 82 char *url = NULL;
83 - int ret = 0;
84 83
85 84 sub = submodule_from_path(the_repository, null_oid(the_hash_algo), module_path);
86 85 if (sub && sub->url) {
@@ -97,11 +96,9 @@ static int get_default_remote_submodule(const char *module_path, char **default_
97 96 }
98 97
99 98 if (repo_submodule_init(&subrepo, the_repository, module_path,
100 - null_oid(the_hash_algo)) < 0) {
101 - ret = die_message(_("could not get a repository handle for submodule '%s'"),
99 + null_oid(the_hash_algo)) < 0)
100 + return die_message(_("could not get a repository handle for submodule '%s'"),
102 101 module_path);
103 - goto out;
104 - }
105 102
106 103 /* Look up by URL first */
107 104 if (url)
@@ -111,11 +108,10 @@ static int get_default_remote_submodule(const char *module_path, char **default_
111 108
112 109 *default_remote = xstrdup(remote_name);
113 110
114 - out:
115 111 repo_clear(&subrepo);
116 112 free(url);
117 113
118 - return ret;
114 + return 0;
119 115 }
120 116
121 117 static int module_get_default_remote(int argc, const char **argv, const char *prefix,
modified ci/install-dependencies.sh
@@ -164,9 +164,9 @@ sparse)
164 164 libexpat-dev gettext zlib1g-dev sparse
165 165 ;;
166 166 Documentation)
167 - sudo apt-get -q -y install asciidoc xmlto docbook-xsl-ns make ruby \
168 - asciidoctor
167 + sudo apt-get -q -y install asciidoc xmlto docbook-xsl-ns make ruby
169 168
169 + sudo gem install --version 1.5.8 asciidoctor
170 170 sudo gem install concurrent-ruby
171 171 ;;
172 172 esac
modified command-list.txt
@@ -217,7 +217,6 @@ gitcli userinterfaces
217 217 gitcore-tutorial guide
218 218 gitcredentials guide
219 219 gitcvs-migration guide
220 - gitdatamodel guide
221 220 gitdiffcore guide
222 221 giteveryday guide
223 222 gitfaq guide
modified fetch-pack.c
@@ -1853,13 +1853,6 @@ static struct ref *do_fetch_pack_v2(struct fetch_pack_args *args,
1853 1853 }
1854 1854 }
1855 1855
1856 - if (packfile_uris.nr) {
1857 - trace2_region_enter("fetch-pack", "packfile-uris",
1858 - the_repository);
1859 - trace2_data_intmax("fetch-pack", the_repository,
1860 - "packfile-uris/count", packfile_uris.nr);
1861 - }
1862 -
1863 1856 for (i = 0; i < packfile_uris.nr; i++) {
1864 1857 bool created_keep;
1865 1858 int j;
@@ -1913,11 +1906,6 @@ static struct ref *do_fetch_pack_v2(struct fetch_pack_args *args,
1913 1906 repo_get_object_directory(the_repository),
1914 1907 packhash));
1915 1908 }
1916 -
1917 - if (packfile_uris.nr)
1918 - trace2_region_leave("fetch-pack", "packfile-uris",
1919 - the_repository);
1920 -
1921 1909 string_list_clear(&packfile_uris, 0);
1922 1910 strvec_clear(&index_pack_args);
1923 1911
modified pathspec.c
@@ -749,8 +749,8 @@ void clear_pathspec(struct pathspec *pathspec)
749 749 int i, j;
750 750
751 751 for (i = 0; i < pathspec->nr; i++) {
752 - free((void *)pathspec->items[i].match);
753 - free((void *)pathspec->items[i].original);
752 + free(pathspec->items[i].match);
753 + free(pathspec->items[i].original);
754 754
755 755 for (j = 0; j < pathspec->items[i].attr_match_nr; j++)
756 756 free(pathspec->items[i].attr_match[j].value);
modified pathspec.h
@@ -35,8 +35,8 @@ struct pathspec {
35 35 unsigned magic;
36 36 int max_depth;
37 37 struct pathspec_item {
38 - const char *match;
39 - const char *original;
38 + char *match;
39 + char *original;
40 40 unsigned magic;
41 41 int len, prefix;
42 42 int nowildcard_len;
modified repository.c
@@ -386,8 +386,7 @@ void repo_clear(struct repository *repo)
386 386 odb_free(repo->objects);
387 387 repo->objects = NULL;
388 388
389 - if (repo->parsed_objects)
390 - parsed_object_pool_clear(repo->parsed_objects);
389 + parsed_object_pool_clear(repo->parsed_objects);
391 390 FREE_AND_NULL(repo->parsed_objects);
392 391
393 392 repo_settings_clear(repo);
modified sequencer.c
@@ -142,13 +142,6 @@ static GIT_PATH_FUNC(rebase_path_author_script, "rebase-merge/author-script")
142 142 * command is processed, this file is deleted.
143 143 */
144 144 static GIT_PATH_FUNC(rebase_path_amend, "rebase-merge/amend")
145 - /*
146 - * The apply ("am") backend keeps its state in the rebase-apply directory;
147 - * the "applying" file within it marks a plain `git am` (as opposed to an
148 - * apply-based rebase).
149 - */
150 - static GIT_PATH_FUNC(apply_dir, "rebase-apply")
151 - static GIT_PATH_FUNC(apply_path_applying, "rebase-apply/applying")
152 145 /*
153 146 * When we stop at a given patch via the "edit" command, this file contains
154 147 * the commit object name of the corresponding patch.
@@ -6963,7 +6956,7 @@ int sequencer_determine_whence(struct repository *r, enum commit_whence *whence)
6963 6956 !repo_get_oid(r, "REBASE_HEAD", &rebase_head) &&
6964 6957 !repo_get_oid(r, "CHERRY_PICK_HEAD", &cherry_pick_head) &&
6965 6958 oideq(&rebase_head, &cherry_pick_head))
6966 - *whence = FROM_REBASE_NOW_EMPTY;
6959 + *whence = FROM_REBASE_PICK;
6967 6960 else
6968 6961 *whence = FROM_CHERRY_PICK_SINGLE;
6969 6962
@@ -6973,56 +6966,6 @@ int sequencer_determine_whence(struct repository *r, enum commit_whence *whence)
6973 6966 return 0;
6974 6967 }
6975 6968
6976 - enum ongoing_operation sequencer_ongoing_operation(struct repository *r,
6977 - enum commit_whence whence)
6978 - {
6979 - /*
6980 - * The merge, cherry-pick, and (empty) rebase-pick stops are already
6981 - * distinguished by 'whence'.
6982 - */
6983 - switch (whence) {
6984 - case FROM_MERGE:
6985 - return ONGOING_MERGE;
6986 - case FROM_CHERRY_PICK_SINGLE:
6987 - case FROM_CHERRY_PICK_MULTI:
6988 - return ONGOING_CHERRY_PICK;
6989 - case FROM_REBASE_NOW_EMPTY:
6990 - return ONGOING_REBASE_NOW_EMPTY;
6991 - case FROM_COMMIT:
6992 - break;
6993 - }
6994 -
6995 - /*
6996 - * 'whence' is FROM_COMMIT, but we may still be in the middle of an
6997 - * operation that records its result on top of HEAD; detect those
6998 - * from their on-disk state.
6999 - */
7000 -
7001 - /* In the middle of a revert? */
7002 - if (refs_ref_exists(get_main_ref_store(r), "REVERT_HEAD"))
7003 - return ONGOING_REVERT;
7004 -
7005 - /* In the middle of an `am`? */
7006 - if (file_exists(apply_path_applying()))
7007 - return ONGOING_AM;
7008 -
7009 - /*
7010 - * In the middle of a rebase that stopped for conflict resolution?
7011 - * The apply backend only ever stops for conflicts, so the presence
7012 - * of its state directory is enough. The merge backend writes
7013 - * stopped-sha whenever it hands control back to the user, but omits
7014 - * `amend` unless it stopped with HEAD already pointing at the commit
7015 - * to be amended (a clean edit/reword stop); its absence therefore
7016 - * marks a conflicted stop.
7017 - */
7018 - if (file_exists(apply_dir()) ||
7019 - (file_exists(rebase_path_stopped_sha()) &&
7020 - !file_exists(rebase_path_amend())))
7021 - return ONGOING_REBASE_CONFLICT;
7022 -
7023 - return ONGOING_NONE;
7024 - }
7025 -
7026 6969 int sequencer_get_update_refs_state(const char *wt_dir,
7027 6970 struct string_list *refs)
7028 6971 {
modified sequencer.h
@@ -277,30 +277,6 @@ int sequencer_get_last_command(struct repository* r,
277 277 enum replay_action *action);
278 278 int sequencer_determine_whence(struct repository *r, enum commit_whence *whence);
279 279
280 - /*
281 - * An in-progress operation that records its result (often a conflict
282 - * resolution) as a new commit on top of HEAD. Some ways of invoking
283 - * "git commit" -- amending HEAD, or a partial commit -- are almost
284 - * always a mistake during such an operation.
285 - */
286 - enum ongoing_operation {
287 - ONGOING_NONE = 0,
288 - ONGOING_MERGE,
289 - ONGOING_CHERRY_PICK,
290 - ONGOING_REBASE_NOW_EMPTY,
291 - ONGOING_REVERT,
292 - ONGOING_AM,
293 - ONGOING_REBASE_CONFLICT
294 - };
295 -
296 - /*
297 - * Return which in-progress operation, if any, is underway; see enum
298 - * ongoing_operation. 'whence' is the origin already computed for the
299 - * pending commit.
300 - */
301 - enum ongoing_operation sequencer_ongoing_operation(struct repository *r,
302 - enum commit_whence whence);
303 -
304 280 /**
305 281 * Append the set of ref-OID pairs that are currently stored for the 'git
306 282 * rebase --update-refs' feature if such a rebase is currently happening.
modified t/t3404-rebase-interactive.sh
@@ -1858,7 +1858,7 @@ test_expect_success 'post-commit hook is called' '
1858 1858 test_cmp expect actual
1859 1859 '
1860 1860
1861 - test_expect_success 'partial commit is allowed when a rebase pick becomes empty' '
1861 + test_expect_success 'correct error message for partial commit after empty pick' '
1862 1862 test_when_finished "git rebase --abort" &&
1863 1863 (
1864 1864 set_fake_editor &&
@@ -1867,7 +1867,8 @@ test_expect_success 'partial commit is allowed when a rebase pick becomes empty'
1867 1867 test_must_fail git rebase -i A D
1868 1868 ) &&
1869 1869 echo x >file1 &&
1870 - git commit file1
1870 + test_must_fail git commit file1 2>err &&
1871 + test_grep "cannot do a partial commit during a rebase." err
1871 1872 '
1872 1873
1873 1874 test_expect_success 'correct error message for commit --amend after empty pick' '
@@ -1880,128 +1881,7 @@ test_expect_success 'correct error message for commit --amend after empty pick'
1880 1881 ) &&
1881 1882 echo x>file1 &&
1882 1883 test_must_fail git commit -a --amend 2>err &&
1883 - test_grep "now-empty commit has been dropped -- cannot amend." err
1884 - '
1885 -
1886 - test_expect_success 'commit --amend is refused at a rebase conflict stop' '
1887 - test_when_finished "git rebase --abort" &&
1888 - git checkout --detach conflict-branch &&
1889 - (
1890 - set_fake_editor &&
1891 - FAKE_LINES="1 3" &&
1892 - export FAKE_LINES &&
1893 - test_must_fail git rebase -i A
1894 - ) &&
1895 - test_path_is_file .git/rebase-merge/patch &&
1896 - test_path_is_missing .git/rebase-merge/amend &&
1897 - echo resolved >conflict &&
1898 - git add conflict &&
1899 - test_must_fail git commit --amend --no-edit 2>err &&
1900 - test_grep "You are resolving conflicts during a rebase -- cannot amend" err
1901 - '
1902 -
1903 - test_expect_success 'commit --amend is refused when an "edit" pick conflicts' '
1904 - test_when_finished "git rebase --abort" &&
1905 - git checkout --detach conflict-branch &&
1906 - (
1907 - set_fake_editor &&
1908 - FAKE_LINES="1 edit 3" &&
1909 - export FAKE_LINES &&
1910 - test_must_fail git rebase -i A
1911 - ) &&
1912 - test_path_is_file .git/rebase-merge/patch &&
1913 - test_path_is_missing .git/rebase-merge/amend &&
1914 - echo resolved >conflict &&
1915 - git add conflict &&
1916 - test_must_fail git commit --amend --no-edit 2>err &&
1917 - test_grep "You are resolving conflicts during a rebase -- cannot amend" err
1918 - '
1919 -
1920 - test_expect_success 'commit --amend is allowed at a rebase edit stop' '
1921 - test_when_finished "git rebase --abort" &&
1922 - git checkout --detach no-conflict-branch &&
1923 - (
1924 - set_fake_editor &&
1925 - FAKE_LINES="edit 1 2 3 4" &&
1926 - export FAKE_LINES &&
1927 - git rebase -i A
1928 - ) &&
1929 - test_path_is_file .git/rebase-merge/amend &&
1930 - echo tweak >fileJ &&
1931 - git add fileJ &&
1932 - git commit --amend --no-edit
1933 - '
1934 -
1935 - test_expect_success 'commit --amend is allowed at a rebase break stop' '
1936 - test_when_finished "git rebase --abort" &&
1937 - git checkout --detach no-conflict-branch &&
1938 - (
1939 - set_fake_editor &&
1940 - FAKE_LINES="break 1 2 3 4" &&
1941 - export FAKE_LINES &&
1942 - git rebase -i A
1943 - ) &&
1944 - test_must_fail git rev-parse --verify REBASE_HEAD &&
1945 - echo tweak >fileJ &&
1946 - git add fileJ &&
1947 - git commit --amend --no-edit
1948 - '
1949 -
1950 - test_expect_success 'commit --amend is refused at an apply-backend conflict stop' '
1951 - test_when_finished "rm -rf apply-backend" &&
1952 - test_create_repo apply-backend &&
1953 - (
1954 - cd apply-backend &&
1955 - test_commit base file &&
1956 - git branch -M mainline &&
1957 - test_commit upstream file upstream &&
1958 - git checkout -b side mainline~1 &&
1959 - test_commit conflicting file side &&
1960 - test_commit unrelated other &&
1961 - test_must_fail git rebase --apply mainline &&
1962 - # the apply backend only ever stops for conflicts, and
1963 - # leaves HEAD on the previously-applied commit
1964 - test_path_is_dir .git/rebase-apply &&
1965 - test_path_is_missing .git/rebase-apply/applying &&
1966 - echo resolved >file &&
1967 - git add file &&
1968 - test_must_fail git commit --amend --no-edit 2>err &&
1969 - test_grep "You are resolving conflicts during a rebase -- cannot amend" err
1970 - )
1971 - '
1972 -
1973 - test_expect_success 'partial commit is refused at a rebase conflict stop' '
1974 - test_when_finished "git rebase --abort" &&
1975 - git checkout --detach conflict-branch &&
1976 - (
1977 - set_fake_editor &&
1978 - FAKE_LINES="1 3" &&
1979 - export FAKE_LINES &&
1980 - test_must_fail git rebase -i A
1981 - ) &&
1982 - echo resolved >conflict &&
1983 - git add conflict &&
1984 - test_must_fail git commit conflict 2>err &&
1985 - test_grep "cannot do a partial commit while resolving conflicts during a rebase." err
1986 - '
1987 -
1988 - test_expect_success 'partial commit is refused at an apply-backend conflict stop' '
1989 - test_when_finished "rm -rf apply-backend" &&
1990 - test_create_repo apply-backend &&
1991 - (
1992 - cd apply-backend &&
1993 - test_commit base file &&
1994 - git branch -M mainline &&
1995 - test_commit upstream file upstream &&
1996 - git checkout -b side mainline~1 &&
1997 - test_commit conflicting file side &&
1998 - test_commit unrelated other &&
1999 - test_must_fail git rebase --apply mainline &&
2000 - echo resolved >file &&
2001 - git add file &&
2002 - test_must_fail git commit file 2>err &&
2003 - test_grep "cannot do a partial commit while resolving conflicts during a rebase." err
2004 - )
1884 + test_grep "middle of a rebase -- cannot amend." err
2005 1885 '
2006 1886
2007 1887 test_expect_success 'todo has correct onto hash' '
modified t/t3507-cherry-pick-conflict.sh
@@ -79,8 +79,7 @@ test_expect_success 'advice from failed cherry-pick --no-commit' "
79 79 EOF
80 80 test_must_fail git cherry-pick --no-commit picked 2>actual &&
81 81
82 - test_cmp expected actual &&
83 - test_ref_missing CHERRY_PICK_HEAD
82 + test_cmp expected actual
84 83 "
85 84
86 85 test_expect_success 'failed cherry-pick sets CHERRY_PICK_HEAD' '
@@ -365,28 +364,6 @@ test_expect_success 'failed revert sets REVERT_HEAD' '
365 364 test_cmp_rev picked REVERT_HEAD
366 365 '
367 366
368 - test_expect_success 'commit --amend of revert fails' '
369 - pristine_detach initial &&
370 -
371 - test_must_fail git revert picked &&
372 - echo resolved >foo &&
373 - git add foo &&
374 - test_must_fail git commit --amend 2>err &&
375 -
376 - test_grep "in the middle of a revert -- cannot amend." err
377 - '
378 -
379 - test_expect_success 'partial commit during a revert fails' '
380 - pristine_detach initial &&
381 -
382 - test_must_fail git revert picked &&
383 - echo resolved >foo &&
384 - git add foo &&
385 - test_must_fail git commit foo 2>err &&
386 -
387 - test_grep "cannot do a partial commit during a revert." err
388 - '
389 -
390 367 test_expect_success 'successful revert does not set REVERT_HEAD' '
391 368 pristine_detach base &&
392 369 git revert base &&
modified t/t4151-am-abort.sh
@@ -63,28 +63,6 @@ do
63 63
64 64 done
65 65
66 - test_expect_success 'commit --amend during a failed am fails' '
67 - git reset --hard initial &&
68 - cp file-2-expect file-2 &&
69 - test_must_fail git am 000[1245]-*.patch &&
70 - echo resolved >file-1 &&
71 - git add file-1 &&
72 - test_must_fail git commit --amend 2>err &&
73 - test_grep "in the middle of an am session -- cannot amend." err &&
74 - git am --abort
75 - '
76 -
77 - test_expect_success 'partial commit during a failed am fails' '
78 - git reset --hard initial &&
79 - cp file-2-expect file-2 &&
80 - test_must_fail git am 000[1245]-*.patch &&
81 - echo resolved >file-1 &&
82 - git add file-1 &&
83 - test_must_fail git commit file-1 2>err &&
84 - test_grep "cannot do a partial commit during an am session." err &&
85 - git am --abort
86 - '
87 -
88 66 test_expect_success 'am -3 --skip removes otherfile-4' '
89 67 git reset --hard initial &&
90 68 test_must_fail git am -3 0003-*.patch &&
modified t/t5702-protocol-v2.sh
@@ -1223,7 +1223,7 @@ configure_exclusion () {
1223 1223
1224 1224 test_expect_success 'part of packfile response provided as URI' '
1225 1225 P="$HTTPD_DOCUMENT_ROOT_PATH/http_parent" &&
1226 - rm -rf "$P" http_child log trace2 &&
1226 + rm -rf "$P" http_child log &&
1227 1227
1228 1228 git init "$P" &&
1229 1229 git -C "$P" config "uploadpack.allowsidebandall" "true" &&
@@ -1238,15 +1238,10 @@ test_expect_success 'part of packfile response provided as URI' '
1238 1238 configure_exclusion "$P" other-blob >h2 &&
1239 1239
1240 1240 GIT_TRACE=1 GIT_TRACE_PACKET="$(pwd)/log" GIT_TEST_SIDEBAND_ALL=1 \
1241 - GIT_TRACE2_EVENT="$(pwd)/trace2" \
1242 1241 git -c protocol.version=2 \
1243 1242 -c fetch.uriprotocols=http,https \
1244 1243 clone "$HTTPD_URL/smart/http_parent" http_child &&
1245 1244
1246 - test_grep \"event\":\"region_enter\".*\"label\":\"packfile-uris\" trace2 &&
1247 - test_grep \"key\":\"packfile-uris/count\",\"value\":\"2\" trace2 &&
1248 - test_grep \"event\":\"region_leave\".*\"label\":\"packfile-uris\" trace2 &&
1249 -
1250 1245 # Ensure that my-blob and other-blob are in separate packfiles.
1251 1246 for idx in http_child/.git/objects/pack/*.idx
1252 1247 do
modified t/t7426-submodule-get-default-remote.sh
@@ -60,23 +60,6 @@ test_expect_success 'get-default-remote fails with non-submodule path' '
60 60 )
61 61 '
62 62
63 - test_expect_success 'get-default-remote fails with uninitialized submodule' '
64 - test_when_finished "
65 - git -C super config -f .gitmodules --remove-section submodule.uninitialized &&
66 - git -C super update-index --force-remove uninitialized
67 - " &&
68 - (
69 - cd super &&
70 - git config -f .gitmodules submodule.uninitialized.path uninitialized &&
71 - git config -f .gitmodules submodule.uninitialized.url ../sub &&
72 - head=$(git -C ../sub rev-parse HEAD) &&
73 - git update-index --add --cacheinfo 160000,$head,uninitialized &&
74 - test_must_fail git submodule--helper get-default-remote \
75 - uninitialized 2>err &&
76 - test_grep "could not get a repository handle" err
77 - )
78 - '
79 -
80 63 test_expect_success 'get-default-remote fails without path argument' '
81 64 (
82 65 cd super &&
modified wt-status.h
@@ -41,7 +41,7 @@ enum commit_whence {
41 41 FROM_MERGE, /* commit came from merge */
42 42 FROM_CHERRY_PICK_SINGLE, /* commit came from cherry-pick */
43 43 FROM_CHERRY_PICK_MULTI, /* commit came from a sequence of cherry-picks */
44 - FROM_REBASE_NOW_EMPTY /* rebase applied a pick that became empty */
44 + FROM_REBASE_PICK /* commit came from a pick/reword/edit */
45 45 };
46 46
47 47 static inline int is_from_cherry_pick(enum commit_whence whence)
@@ -50,9 +50,9 @@ static inline int is_from_cherry_pick(enum commit_whence whence)
50 50 whence == FROM_CHERRY_PICK_MULTI;
51 51 }
52 52
53 - static inline int is_from_rebase_now_empty(enum commit_whence whence)
53 + static inline int is_from_rebase(enum commit_whence whence)
54 54 {
55 - return whence == FROM_REBASE_NOW_EMPTY;
55 + return whence == FROM_REBASE_PICK;
56 56 }
57 57
58 58 struct wt_status_change_data {