From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Rast Subject: [PATCH v7 09/13] rebase: support automatic notes copying Date: Fri, 12 Mar 2010 18:04:33 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Cc: Johannes Sixt , Johan Herland , Junio C Hamano To: X-From: git-owner@vger.kernel.org Fri Mar 12 18:06:27 2010 Return-path: Envelope-to: gcvg-git-2@lo.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Nq8JQ-00018m-Mb for gcvg-git-2@lo.gmane.org; Fri, 12 Mar 2010 18:06:13 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758638Ab0CLRFY (ORCPT ); Fri, 12 Mar 2010 12:05:24 -0500 Received: from gwse.ethz.ch ([129.132.178.238]:18753 "EHLO gwse.ethz.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758620Ab0CLRFV (ORCPT ); Fri, 12 Mar 2010 12:05:21 -0500 Received: from CAS00.d.ethz.ch (129.132.178.234) by gws01.d.ethz.ch (129.132.178.238) with Microsoft SMTP Server (TLS) id 8.2.234.1; Fri, 12 Mar 2010 18:05:02 +0100 Received: from localhost.localdomain (213.55.131.184) by mail.ethz.ch (129.132.178.227) with Microsoft SMTP Server (TLS) id 8.2.234.1; Fri, 12 Mar 2010 18:05:01 +0100 X-Mailer: git-send-email 1.7.0.2.417.gbc354 In-Reply-To: Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: Luckily, all the support already happens to be there. Signed-off-by: Thomas Rast --- git-am.sh | 5 ++++- git-rebase--interactive.sh | 4 ++++ git-rebase.sh | 1 + t/t3400-rebase.sh | 17 +++++++++++++++++ t/t3404-rebase-interactive.sh | 24 ++++++++++++++++++++++++ 5 files changed, 50 insertions(+), 1 deletions(-) diff --git a/git-am.sh b/git-am.sh index 9b73e0b..1056075 100755 --- a/git-am.sh +++ b/git-am.sh @@ -797,8 +797,11 @@ do go_next done -if test -s "$dotest"/rewritten && test -x "$GIT_DIR"/hooks/post-rewrite; then +if test -s "$dotest"/rewritten; then + git notes copy --for-rewrite=rebase < "$dotest"/rewritten + if test -x "$GIT_DIR"/hooks/post-rewrite; then "$GIT_DIR"/hooks/post-rewrite rebase < "$dotest"/rewritten + fi fi rm -fr "$dotest" diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh index f18a118..a57f043 100755 --- a/git-rebase--interactive.sh +++ b/git-rebase--interactive.sh @@ -561,6 +561,10 @@ do_next () { test ! -f "$DOTEST"/verbose || git diff-tree --stat $(cat "$DOTEST"/head)..HEAD } && + { + git notes copy --for-rewrite=rebase < "$REWRITTEN_LIST" || + true # we don't care if this copying failed + } && if test -x "$GIT_DIR"/hooks/post-rewrite && test -s "$REWRITTEN_LIST"; then "$GIT_DIR"/hooks/post-rewrite rebase < "$REWRITTEN_LIST" diff --git a/git-rebase.sh b/git-rebase.sh index 52f8b9b..e0eb956 100755 --- a/git-rebase.sh +++ b/git-rebase.sh @@ -152,6 +152,7 @@ move_to_original_branch () { finish_rb_merge () { move_to_original_branch + git notes copy --for-rewrite=rebase < "$dotest"/rewritten if test -x "$GIT_DIR"/hooks/post-rewrite && test -s "$dotest"/rewritten; then "$GIT_DIR"/hooks/post-rewrite rebase < "$dotest"/rewritten diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh index 4314ad2..dbf7dfb 100755 --- a/t/t3400-rebase.sh +++ b/t/t3400-rebase.sh @@ -151,4 +151,21 @@ test_expect_success 'Rebase a commit that sprinkles CRs in' ' git diff --exit-code file-with-cr:CR HEAD:CR ' +test_expect_success 'rebase can copy notes' ' + git config notes.rewrite.rebase true && + git config notes.rewriteRef "refs/notes/*" && + test_commit n1 && + test_commit n2 && + test_commit n3 && + git notes add -m"a note" n3 && + git rebase --onto n1 n2 && + test "a note" = "$(git notes show HEAD)" +' + +test_expect_success 'rebase -m can copy notes' ' + git reset --hard n3 && + git rebase -m --onto n1 n2 && + test "a note" = "$(git notes show HEAD)" +' + test_done diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index 4e35137..19668c2 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -553,4 +553,28 @@ test_expect_success 'reword' ' git show HEAD~2 | grep "C changed" ' +test_expect_success 'rebase -i can copy notes' ' + git config notes.rewrite.rebase true && + git config notes.rewriteRef "refs/notes/*" && + test_commit n1 && + test_commit n2 && + test_commit n3 && + git notes add -m"a note" n3 && + git rebase --onto n1 n2 && + test "a note" = "$(git notes show HEAD)" +' + +cat >expect < output && + test_cmp expect output +' + test_done -- 1.7.0.2.417.gbc354