[PATCH v2 12/13] Teach rebase interactive the tag command
From: Jörg Sommer <hidden>
Date: 2016-06-15 22:44:28
Subsystem:
the rest · Maintainer:
Linus Torvalds
The intent of the tag command is to (re)set tags for commits in the TODO list. This way it's possible to rebase a commit together with its tag. Signed-off-by: Jörg Sommer <redacted> --- git-rebase--interactive.sh | 7 +++++++ t/t3404-rebase-interactive.sh | 13 +++++++++++++ 2 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index ea67942..c601655 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh@@ -323,6 +323,12 @@ do_next () { mark_action_done output git reset --hard $tmp ;; + tag|t) + comment_for_reflog tag + + mark_action_done + output git tag -f "$sha1" + ;; *) warn "Unknown command: $command $sha1 $rest" die_with_patch $sha1 "Please fix this in the file $TODO."
@@ -655,6 +661,7 @@ do # reset commit = reset HEAD to the commit # merge commit-M commit-P ... = redo merge commit-M with the # current HEAD and the parents commit-P +# tag = reset tag to the current HEAD # # If you remove a line here THAT COMMIT WILL BE LOST. # However, if you remove everything, the rebase will be aborted.
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index 8da7829..9901555 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh@@ -91,6 +91,9 @@ for line in $FAKE_LINES; do merge*) echo "merge ${line#merge}" | tr / ' ' echo "merge ${line#merge}" | tr / ' ' >> "$1";; + tag*) + echo "tag ${line#tag}" + echo "tag ${line#tag}" >> "$1";; *) sed -n "${line}{s/^pick/$action/; p;}" < "$1".tmp sed -n "${line}{s/^pick/$action/; p;}" < "$1".tmp >> "$1"
@@ -306,6 +309,16 @@ test_expect_success 'interactive --first-parent gives a linear list' ' test "$head" = "$(git rev-parse HEAD)" ' +test_expect_success 'tag sets tags' ' + head=$(git rev-parse HEAD) && + FAKE_LINES="1 2 3 4 5 tagbb-tag1 6 7 8 9 10 11 12 13 14 15 \ + tagbb-tag2 16 tagbb-tag3a tagbb-tag3b 17 18 19 20 21 22" \ + EXPECT_COUNT=22 git rebase -i -p master && + test "$head" = "$(git rev-parse HEAD)" && + test "$(git rev-parse bb-tag1 bb-tag2 bb-tag3a bb-tag3b)" = \ + "$(git rev-parse HEAD^2~2 HEAD~2 HEAD~1 HEAD~1)" +' + test_expect_success '--continue tries to commit' ' git checkout to-be-rebased && test_tick &&
--
1.5.5