/* Create a label from the commit message */
strbuf_reset(&label_from_message);
- if (skip_prefix(oneline.buf, "Merge ", &p1) &&
+ if (skip_prefix(oneline.buf, "# Merge ", &p1) &&
(p1 = strchr(p1, '\'')) &&
(p2 = strchr(++p1, '\'')))
strbuf_add(&label_from_message, p1, p2 - p1);
- else if (skip_prefix(oneline.buf, "Merge pull request ",
+ else if (skip_prefix(oneline.buf, "# Merge pull request ",
&p1) &&
(p1 = strstr(p1, " from ")))
strbuf_addstr(&label_from_message, p1 + strlen(" from "));
strbuf_addstr(&buf, label_oid(oid, label, &state));
}
- strbuf_addf(&buf, " # %s", oneline.buf);
+ strbuf_addf(&buf, " %s", oneline.buf);
FLEX_ALLOC_STR(entry, string, buf.buf);
oidcpy(&entry->entry.oid, &commit->object.oid);
else {
strbuf_reset(&oneline);
pretty_print_commit(pp, commit, &oneline);
- strbuf_addf(out, "%s %s # %s\n",
+ strbuf_addf(out, "%s %s %s\n",
cmd_reset, to, oneline.buf);
}
}
git_config_get_string("rebase.instructionFormat", &format);
if (!format || !*format) {
free(format);
- format = xstrdup("%s");
+ format = xstrdup("# %s");
}
+ if (*format != '#') {
+ char *temp = format;
+ format = xstrfmt("# %s", temp);
+ free(temp);
+ }
+
get_commit_format(format, &revs);
free(format);
pp.fmt = revs.commit_format;
cat >expect <<-EOF &&
Warning: some commits may have been dropped accidentally.
Dropped commits (newer to older):
- - $(git rev-list --pretty=oneline --abbrev-commit -1 primary)
+ - $(git log --format="%h # %s" -1 primary)
To avoid this message, use "drop" to explicitly remove a commit.
EOF
test_config rebase.missingCommitsCheck warn &&
cat >expect <<-EOF &&
Warning: some commits may have been dropped accidentally.
Dropped commits (newer to older):
- - $(git rev-list --pretty=oneline --abbrev-commit -1 primary)
- - $(git rev-list --pretty=oneline --abbrev-commit -1 primary~2)
+ - $(git log --format="%h # %s" -1 primary)
+ - $(git log --format="%h # %s" -1 primary~2)
To avoid this message, use "drop" to explicitly remove a commit.
Use '\''git config rebase.missingCommitsCheck'\'' to change the level of warnings.
test_expect_success 'rebase --edit-todo respects rebase.missingCommitsCheck = warn' '
cat >expect <<-EOF &&
error: invalid command '\''pickled'\''
- error: invalid line 1: pickled $(git rev-list --pretty=oneline --abbrev-commit -1 primary~4)
+ error: invalid line 1: pickled $(git log --format="%h # %s" -1 primary~4)
Warning: some commits may have been dropped accidentally.
Dropped commits (newer to older):
- - $(git rev-list --pretty=oneline --abbrev-commit -1 primary)
- - $(git rev-list --pretty=oneline --abbrev-commit -1 primary~4)
+ - $(git log --format="%h # %s" -1 primary)
+ - $(git log --format="%h # %s" -1 primary~4)
To avoid this message, use "drop" to explicitly remove a commit.
EOF
head -n5 expect >expect.2 &&
test_expect_success 'rebase --edit-todo respects rebase.missingCommitsCheck = error' '
cat >expect <<-EOF &&
error: invalid command '\''pickled'\''
- error: invalid line 1: pickled $(git rev-list --pretty=oneline --abbrev-commit -1 primary~4)
+ error: invalid line 1: pickled $(git log --format="%h # %s" -1 primary~4)
Warning: some commits may have been dropped accidentally.
Dropped commits (newer to older):
- - $(git rev-list --pretty=oneline --abbrev-commit -1 primary)
- - $(git rev-list --pretty=oneline --abbrev-commit -1 primary~4)
+ - $(git log --format="%h # %s" -1 primary)
+ - $(git log --format="%h # %s" -1 primary~4)
To avoid this message, use "drop" to explicitly remove a commit.
Use '\''git config rebase.missingCommitsCheck'\'' to change the level of warnings.
test_commit "fixup! first" file2.txt "first line again" first_fixup &&
test_commit "squash! second" file1.txt "another line here" second_squash &&
cat >expected <<-EOF &&
- p $(git rev-list --abbrev-commit -1 first) first
- f $(git rev-list --abbrev-commit -1 first_fixup) fixup! first
+ p $(git rev-list --abbrev-commit -1 first) # first
+ f $(git rev-list --abbrev-commit -1 first_fixup) # fixup! first
x git show HEAD
- p $(git rev-list --abbrev-commit -1 second) second
- s $(git rev-list --abbrev-commit -1 second_squash) squash! second
+ p $(git rev-list --abbrev-commit -1 second) # second
+ s $(git rev-list --abbrev-commit -1 second_squash) # squash! second
x git show HEAD
EOF
git checkout abbrevcmd &&
set_fake_editor &&
test_must_fail env FAKE_LINES="1 2 3 bad 4 5" \
git rebase -i --root 2>actual &&
- test_grep "pickled $(git rev-list --oneline -1 primary~1)" \
+ test_grep "pickled $(git log --format="%h # %s" -1 primary~1)" \
actual &&
test_grep "You can fix this with .git rebase --edit-todo.." \
actual &&
set_cat_todo_editor &&
cat >expect <<-EOF &&
- pick $(git log -1 --format=%h J) J
- fixup $(git log -1 --format=%h update-refs) fixup! J # empty
+ pick $(git log -1 --format=%h J) # J
+ fixup $(git log -1 --format=%h update-refs) # fixup! J # empty
update-ref refs/heads/second
update-ref refs/heads/first
- pick $(git log -1 --format=%h K) K
- pick $(git log -1 --format=%h L) L
- fixup $(git log -1 --format=%h is-not-reordered) fixup! L # empty
+ pick $(git log -1 --format=%h K) # K
+ pick $(git log -1 --format=%h L) # L
+ fixup $(git log -1 --format=%h is-not-reordered) # fixup! L # empty
update-ref refs/heads/third
- pick $(git log -1 --format=%h M) M
+ pick $(git log -1 --format=%h M) # M
update-ref refs/heads/no-conflict-branch
update-ref refs/heads/is-not-reordered
update-ref refs/heads/shared-tip
cat >expect <<-EOF &&
label onto
reset onto
- pick $(git log -1 --format=%h branch2~1) F
- pick $(git log -1 --format=%h branch2) I
+ pick $(git log -1 --format=%h branch2~1) # F
+ pick $(git log -1 --format=%h branch2) # I
update-ref refs/heads/branch2
label branch2
reset onto
- pick $(git log -1 --format=%h refs/heads/second) J
+ pick $(git log -1 --format=%h refs/heads/second) # J
update-ref refs/heads/second
update-ref refs/heads/first
- pick $(git log -1 --format=%h refs/heads/third~1) K
- pick $(git log -1 --format=%h refs/heads/third) L
- fixup $(git log -1 --format=%h update-refs-with-merge) fixup! L # empty
+ pick $(git log -1 --format=%h refs/heads/third~1) # K
+ pick $(git log -1 --format=%h refs/heads/third) # L
+ fixup $(git log -1 --format=%h update-refs-with-merge) # fixup! L # empty
update-ref refs/heads/third
- pick $(git log -1 --format=%h HEAD~2) M
+ pick $(git log -1 --format=%h HEAD~2) # M
update-ref refs/heads/no-conflict-branch
merge -C $(git log -1 --format=%h HEAD~1) branch2 # merge
update-ref refs/heads/merge-branch
cat >expected <<EOF &&
interactive rebase in progress; onto $ONTO
Last command done (1 command done):
- pick $LAST_COMMIT one_second
+ pick $LAST_COMMIT # one_second
No commands remaining.
You are currently rebasing branch '\''rebase_i_conflicts_second'\'' on '\''$ONTO'\''.
(fix conflicts and then run "git rebase --continue")
cat >expected <<EOF &&
interactive rebase in progress; onto $ONTO
Last command done (1 command done):
- pick $LAST_COMMIT one_second
+ pick $LAST_COMMIT # one_second
No commands remaining.
You are currently rebasing branch '\''rebase_i_conflicts_second'\'' on '\''$ONTO'\''.
(all conflicts fixed: run "git rebase --continue")
cat >expected <<EOF &&
interactive rebase in progress; onto $ONTO
Last commands done (2 commands done):
- pick $COMMIT2 two_rebase_i
- edit $COMMIT3 three_rebase_i
+ pick $COMMIT2 # two_rebase_i
+ edit $COMMIT3 # three_rebase_i
No commands remaining.
You are currently editing a commit while rebasing branch '\''rebase_i_edit'\'' on '\''$ONTO'\''.
(use "git commit --amend" to amend the current commit)
cat >expected <<EOF &&
interactive rebase in progress; onto $ONTO
Last commands done (2 commands done):
- pick $COMMIT2 two_split
- edit $COMMIT3 three_split
+ pick $COMMIT2 # two_split
+ edit $COMMIT3 # three_split
Next command to do (1 remaining command):
- pick $COMMIT4 four_split
+ pick $COMMIT4 # four_split
(use "git rebase --edit-todo" to view and edit)
You are currently splitting a commit while rebasing branch '\''split_commit'\'' on '\''$ONTO'\''.
(Once your working directory is clean, run "git rebase --continue")
cat >expected <<EOF &&
interactive rebase in progress; onto $ONTO
Last commands done (3 commands done):
- pick $COMMIT3 three_amend
- edit $COMMIT4 four_amend
+ pick $COMMIT3 # three_amend
+ edit $COMMIT4 # four_amend
(see more in file .git/rebase-merge/done)
No commands remaining.
You are currently editing a commit while rebasing branch '\''amend_last'\'' on '\''$ONTO'\''.
cat >expected <<EOF &&
interactive rebase in progress; onto $ONTO
Last commands done (2 commands done):
- edit $COMMIT2 two_edits
- edit $COMMIT3 three_edits
+ edit $COMMIT2 # two_edits
+ edit $COMMIT3 # three_edits
Next command to do (1 remaining command):
- pick $COMMIT4 four_edits
+ pick $COMMIT4 # four_edits
(use "git rebase --edit-todo" to view and edit)
You are currently editing a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''.
(use "git commit --amend" to amend the current commit)
cat >expected <<EOF &&
interactive rebase in progress; onto $ONTO
Last commands done (2 commands done):
- edit $COMMIT2 two_edits
- edit $COMMIT3 three_edits
+ edit $COMMIT2 # two_edits
+ edit $COMMIT3 # three_edits
Next command to do (1 remaining command):
- pick $COMMIT4 four_edits
+ pick $COMMIT4 # four_edits
(use "git rebase --edit-todo" to view and edit)
You are currently splitting a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''.
(Once your working directory is clean, run "git rebase --continue")
cat >expected <<EOF &&
interactive rebase in progress; onto $ONTO
Last commands done (2 commands done):
- edit $COMMIT2 two_edits
- edit $COMMIT3 three_edits
+ edit $COMMIT2 # two_edits
+ edit $COMMIT3 # three_edits
Next command to do (1 remaining command):
- pick $COMMIT4 four_edits
+ pick $COMMIT4 # four_edits
(use "git rebase --edit-todo" to view and edit)
You are currently editing a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''.
(use "git commit --amend" to amend the current commit)
cat >expected <<EOF &&
interactive rebase in progress; onto $ONTO
Last commands done (2 commands done):
- edit $COMMIT2 two_edits
- edit $COMMIT3 three_edits
+ edit $COMMIT2 # two_edits
+ edit $COMMIT3 # three_edits
Next command to do (1 remaining command):
- pick $COMMIT4 four_edits
+ pick $COMMIT4 # four_edits
(use "git rebase --edit-todo" to view and edit)
You are currently editing a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''.
(use "git commit --amend" to amend the current commit)
cat >expected <<EOF &&
interactive rebase in progress; onto $ONTO
Last commands done (2 commands done):
- edit $COMMIT2 two_edits
- edit $COMMIT3 three_edits
+ edit $COMMIT2 # two_edits
+ edit $COMMIT3 # three_edits
Next command to do (1 remaining command):
- pick $COMMIT4 four_edits
+ pick $COMMIT4 # four_edits
(use "git rebase --edit-todo" to view and edit)
You are currently splitting a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''.
(Once your working directory is clean, run "git rebase --continue")
cat >expected <<EOF &&
interactive rebase in progress; onto $ONTO
Last commands done (2 commands done):
- edit $COMMIT2 two_edits
- edit $COMMIT3 three_edits
+ edit $COMMIT2 # two_edits
+ edit $COMMIT3 # three_edits
Next command to do (1 remaining command):
- pick $COMMIT4 four_edits
+ pick $COMMIT4 # four_edits
(use "git rebase --edit-todo" to view and edit)
You are currently editing a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''.
(use "git commit --amend" to amend the current commit)
cat >expected <<EOF &&
interactive rebase in progress; onto $ONTO
Last commands done (2 commands done):
- edit $COMMIT2 two_edits
- edit $COMMIT3 three_edits
+ edit $COMMIT2 # two_edits
+ edit $COMMIT3 # three_edits
Next command to do (1 remaining command):
- pick $COMMIT4 four_edits
+ pick $COMMIT4 # four_edits
(use "git rebase --edit-todo" to view and edit)
You are currently editing a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''.
(use "git commit --amend" to amend the current commit)
cat >expected <<EOF &&
interactive rebase in progress; onto $ONTO
Last commands done (2 commands done):
- edit $COMMIT2 two_edits
- edit $COMMIT3 three_edits
+ edit $COMMIT2 # two_edits
+ edit $COMMIT3 # three_edits
Next command to do (1 remaining command):
- pick $COMMIT4 four_edits
+ pick $COMMIT4 # four_edits
(use "git rebase --edit-todo" to view and edit)
You are currently splitting a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''.
(Once your working directory is clean, run "git rebase --continue")
cat >expected <<EOF &&
interactive rebase in progress; onto $ONTO
Last commands done (2 commands done):
- edit $COMMIT2 two_edits
- edit $COMMIT3 three_edits
+ edit $COMMIT2 # two_edits
+ edit $COMMIT3 # three_edits
Next command to do (1 remaining command):
- pick $COMMIT4 four_edits
+ pick $COMMIT4 # four_edits
(use "git rebase --edit-todo" to view and edit)
You are currently editing a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''.
(use "git commit --amend" to amend the current commit)
cat >expected <<EOF &&
interactive rebase in progress; onto $ONTO
Last commands done (2 commands done):
- pick $COMMIT2 two_commit
+ pick $COMMIT2 # two_commit
exec exit 15
Next commands to do (2 remaining commands):
- pick $COMMIT3 three_commit
- pick $COMMIT4 four_commit
+ pick $COMMIT3 # three_commit
+ pick $COMMIT4 # four_commit
(use "git rebase --edit-todo" to view and edit)
You are currently editing a commit while rebasing branch '\''several_commits'\'' on '\''$ONTO'\''.
(use "git commit --amend" to amend the current commit)
cat >expected <<EOF &&
interactive rebase in progress; onto $ONTO
Last commands done (3 commands done):
- pick $COMMIT2 two_commit
+ pick $COMMIT2 # two_commit
exec exit 15
(see more in file .git/rebase-merge/done)
Next commands to do (2 remaining commands):
- pick $COMMIT3 three_commit
- pick $COMMIT4 four_commit
+ pick $COMMIT3 # three_commit
+ pick $COMMIT4 # four_commit
(use "git rebase --edit-todo" to view and edit)
You are currently editing a commit while rebasing branch '\''several_commits'\'' on '\''$ONTO'\''.
(use "git commit --amend" to amend the current commit)
On branch several_commits
No commands done.
Next command to do (1 remaining command):
- pick $COMMIT four_commit
+ pick $COMMIT # four_commit
(use "git rebase --edit-todo" to view and edit)
You are currently editing a commit while rebasing branch '\''several_commits'\'' on '\''$ONTO'\''.
(use "git commit --amend" to amend the current commit)