@@ -864,6 +864,24 @@ test_expect_success 'append to note from other note with "git notes append -c"'
864
864
'
865
865
866
866
test_expect_success ' copy note with "git notes copy"' '
867
+ commit=$(git rev-parse 4th) &&
868
+ cat >expect <<-EOF &&
869
+ commit $commit
870
+ Author: A U Thor <[email protected] >
871
+ Date: Thu Apr 7 15:16:13 2005 -0700
872
+
873
+ ${indent}4th
874
+
875
+ Notes:
876
+ ${indent}This is a blob object
877
+ EOF
878
+ git notes copy 8th 4th &&
879
+ git log 3rd..4th >actual &&
880
+ test_cmp expect actual &&
881
+ test "$(git note list 4th)" = "$(git note list 8th)"
882
+ '
883
+
884
+ test_expect_success ' copy note with "git notes copy" with default' '
867
885
test_commit 11th &&
868
886
commit=$(git rev-parse HEAD) &&
869
887
cat >expect <<-EOF &&
@@ -878,7 +896,7 @@ test_expect_success 'copy note with "git notes copy"' '
878
896
${indent}
879
897
${indent}yet another note
880
898
EOF
881
- git notes copy HEAD^ HEAD &&
899
+ git notes copy HEAD^ &&
882
900
git log -1 >actual &&
883
901
test_cmp expect actual &&
884
902
test "$(git notes list HEAD)" = "$(git notes list HEAD^)"
@@ -892,6 +910,24 @@ test_expect_success 'prevent overwrite with "git notes copy"' '
892
910
'
893
911
894
912
test_expect_success ' allow overwrite with "git notes copy -f"' '
913
+ commit=$(git rev-parse HEAD) &&
914
+ cat >expect <<-EOF &&
915
+ commit $commit
916
+ Author: A U Thor <[email protected] >
917
+ Date: Thu Apr 7 15:23:13 2005 -0700
918
+
919
+ ${indent}11th
920
+
921
+ Notes:
922
+ ${indent}This is a blob object
923
+ EOF
924
+ git notes copy -f HEAD~3 HEAD &&
925
+ git log -1 >actual &&
926
+ test_cmp expect actual &&
927
+ test "$(git notes list HEAD)" = "$(git notes list HEAD~3)"
928
+ '
929
+
930
+ test_expect_success ' allow overwrite with "git notes copy -f" with default' '
895
931
commit=$(git rev-parse HEAD) &&
896
932
cat >expect <<-EOF &&
897
933
commit $commit
@@ -905,7 +941,7 @@ test_expect_success 'allow overwrite with "git notes copy -f"' '
905
941
${indent}
906
942
${indent}yet another note
907
943
EOF
908
- git notes copy -f HEAD~2 HEAD &&
944
+ git notes copy -f HEAD~2 &&
909
945
git log -1 >actual &&
910
946
test_cmp expect actual &&
911
947
test "$(git notes list HEAD)" = "$(git notes list HEAD~2)"
@@ -1167,8 +1203,10 @@ test_expect_success 'GIT_NOTES_REWRITE_REF overrides config' '
1167
1203
'
1168
1204
1169
1205
test_expect_success ' git notes copy diagnoses too many or too few parameters' '
1170
- test_must_fail git notes copy &&
1171
- test_must_fail git notes copy one two three
1206
+ test_must_fail git notes copy 2>error &&
1207
+ test_i18ngrep "too few parameters" error &&
1208
+ test_must_fail git notes copy one two three 2>error &&
1209
+ test_i18ngrep "too many parameters" error
1172
1210
'
1173
1211
1174
1212
test_expect_success ' git notes get-ref expands refs/heads/master to refs/notes/refs/heads/master' '
0 commit comments