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
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2023-09-14 21:16:59 +0300
committerJunio C Hamano <gitster@pobox.com>2023-09-14 21:16:59 +0300
commitf73604fabf7aa8bc294f346f6a610adb5a464e5e (patch)
treece46f57d0962e4da900de1fcd73b02c2e9255586 /sequencer.c
parent86b56ff267962ab91aa368b10d6df10b1e9e291e (diff)
parentc9192f9e45f12f7e4c93488eb77a3098e75a78cc (diff)
Merge branch 'ob/revert-of-revert-is-reapply'
The default log message created by "git revert", when reverting a commit that records a revert, has been tweaked. * ob/revert-of-revert-is-reapply: git-revert.txt: add discussion sequencer: beautify subject of reverts of reverts
Diffstat (limited to 'sequencer.c')
-rw-r--r--sequencer.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/sequencer.c b/sequencer.c
index afebf7e37c..3c5fdd68f4 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -2257,6 +2257,8 @@ static int do_pick_commit(struct repository *r,
*/
if (command == TODO_REVERT) {
+ const char *orig_subject;
+
base = commit;
base_label = msg.label;
next = parent;
@@ -2264,6 +2266,15 @@ static int do_pick_commit(struct repository *r,
if (opts->commit_use_reference) {
strbuf_addstr(&msgbuf,
"# *** SAY WHY WE ARE REVERTING ON THE TITLE LINE ***");
+ } else if (skip_prefix(msg.subject, "Revert \"", &orig_subject) &&
+ /*
+ * We don't touch pre-existing repeated reverts, because
+ * theoretically these can be nested arbitrarily deeply,
+ * thus requiring excessive complexity to deal with.
+ */
+ !starts_with(orig_subject, "Revert \"")) {
+ strbuf_addstr(&msgbuf, "Reapply \"");
+ strbuf_addstr(&msgbuf, orig_subject);
} else {
strbuf_addstr(&msgbuf, "Revert \"");
strbuf_addstr(&msgbuf, msg.subject);