File tree Expand file tree Collapse file tree 5 files changed +50
-1
lines changed Expand file tree Collapse file tree 5 files changed +50
-1
lines changed Original file line number Diff line number Diff line change 780
780
go_next
781
781
done
782
782
783
- if test -s " $dotest " /rewritten && test -x " $GIT_DIR " /hooks/post-rewrite; then
783
+ if test -s " $dotest " /rewritten; then
784
+ git notes copy --for-rewrite=rebase < " $dotest " /rewritten
785
+ if test -x " $GIT_DIR " /hooks/post-rewrite; then
784
786
" $GIT_DIR " /hooks/post-rewrite rebase < " $dotest " /rewritten
787
+ fi
785
788
fi
786
789
787
790
git gc --auto
Original file line number Diff line number Diff line change @@ -570,6 +570,10 @@ do_next () {
570
570
test ! -f " $DOTEST " /verbose ||
571
571
git diff-tree --stat $( cat " $DOTEST " /head) ..HEAD
572
572
} &&
573
+ {
574
+ git notes copy --for-rewrite=rebase < " $REWRITTEN_LIST " ||
575
+ true # we don't care if this copying failed
576
+ } &&
573
577
if test -x " $GIT_DIR " /hooks/post-rewrite &&
574
578
test -s " $REWRITTEN_LIST " ; then
575
579
" $GIT_DIR " /hooks/post-rewrite rebase < " $REWRITTEN_LIST "
Original file line number Diff line number Diff line change @@ -154,6 +154,7 @@ move_to_original_branch () {
154
154
155
155
finish_rb_merge () {
156
156
move_to_original_branch
157
+ git notes copy --for-rewrite=rebase < " $dotest " /rewritten
157
158
if test -x " $GIT_DIR " /hooks/post-rewrite &&
158
159
test -s " $dotest " /rewritten; then
159
160
" $GIT_DIR " /hooks/post-rewrite rebase < " $dotest " /rewritten
Original file line number Diff line number Diff line change @@ -155,4 +155,21 @@ test_expect_success 'Rebase a commit that sprinkles CRs in' '
155
155
git diff --exit-code file-with-cr:CR HEAD:CR
156
156
'
157
157
158
+ test_expect_success ' rebase can copy notes' '
159
+ git config notes.rewrite.rebase true &&
160
+ git config notes.rewriteRef "refs/notes/*" &&
161
+ test_commit n1 &&
162
+ test_commit n2 &&
163
+ test_commit n3 &&
164
+ git notes add -m"a note" n3 &&
165
+ git rebase --onto n1 n2 &&
166
+ test "a note" = "$(git notes show HEAD)"
167
+ '
168
+
169
+ test_expect_success ' rebase -m can copy notes' '
170
+ git reset --hard n3 &&
171
+ git rebase -m --onto n1 n2 &&
172
+ test "a note" = "$(git notes show HEAD)"
173
+ '
174
+
158
175
test_done
Original file line number Diff line number Diff line change @@ -553,4 +553,28 @@ test_expect_success 'reword' '
553
553
git show HEAD~2 | grep "C changed"
554
554
'
555
555
556
+ test_expect_success ' rebase -i can copy notes' '
557
+ git config notes.rewrite.rebase true &&
558
+ git config notes.rewriteRef "refs/notes/*" &&
559
+ test_commit n1 &&
560
+ test_commit n2 &&
561
+ test_commit n3 &&
562
+ git notes add -m"a note" n3 &&
563
+ git rebase --onto n1 n2 &&
564
+ test "a note" = "$(git notes show HEAD)"
565
+ '
566
+
567
+ cat > expect << EOF
568
+ an earlier note
569
+ a note
570
+ EOF
571
+
572
+ test_expect_success ' rebase -i can copy notes over a fixup' '
573
+ git reset --hard n3 &&
574
+ git notes add -m"an earlier note" n2 &&
575
+ GIT_NOTES_REWRITE_MODE=concatenate FAKE_LINES="1 fixup 2" git rebase -i n1 &&
576
+ git notes show > output &&
577
+ test_cmp expect output
578
+ '
579
+
556
580
test_done
You can’t perform that action at this time.
0 commit comments