diff options
author | Thomas Rast <trast@student.ethz.ch> | 2010-03-12 20:04:31 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-03-13 08:55:39 +0300 |
commit | 160baa0d9cbdfcdb6251aa5ede77c59c0d53edfd (patch) | |
tree | 278241bc0737a69c78be1a15655ff05c66261a46 /t/t3301-notes.sh | |
parent | b079feed64238558fa24ba8ade892d84628a05ac (diff) |
notes: implement 'git notes copy --stdin'
This implements a mass-copy command that takes a sequence of lines in
the format
<from-sha1> SP <to-sha1> [ SP <rest> ] LF
on stdin, and copies each <from-sha1>'s notes to the <to-sha1>. The
<rest> is ignored. The intent, of course, is that this can read the
same input that the 'post-rewrite' hook gets.
The copy_note() function is exposed for everyone's and in particular
the next commit's use.
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Acked-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3301-notes.sh')
-rwxr-xr-x | t/t3301-notes.sh | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/t/t3301-notes.sh b/t/t3301-notes.sh index cb7166f6ec..60ad6a1675 100755 --- a/t/t3301-notes.sh +++ b/t/t3301-notes.sh @@ -776,4 +776,38 @@ test_expect_success 'cannot copy note from object without notes' ' test_must_fail git notes copy HEAD^ HEAD ' +cat > expect << EOF +commit e5d4fb5698d564ab8c73551538ecaf2b0c666185 +Author: A U Thor <author@example.com> +Date: Thu Apr 7 15:25:13 2005 -0700 + + 13th + +Notes (other): + yet another note +$whitespace + yet another note + +commit 7038787dfe22a14c3867ce816dbba39845359719 +Author: A U Thor <author@example.com> +Date: Thu Apr 7 15:24:13 2005 -0700 + + 12th + +Notes (other): + other note +$whitespace + yet another note +EOF + +test_expect_success 'git notes copy --stdin' ' + (echo $(git rev-parse HEAD~3) $(git rev-parse HEAD^); \ + echo $(git rev-parse HEAD~2) $(git rev-parse HEAD)) | + git notes copy --stdin && + git log -2 > output && + test_cmp expect output && + test "$(git notes list HEAD)" = "$(git notes list HEAD~2)" && + test "$(git notes list HEAD^)" = "$(git notes list HEAD~3)" +' + test_done |