3 test_description='Test notes trees that also contain non-notes'
12 commit refs/notes/commits
13 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
18 from refs/notes/commits^0
25 git log | grep "^ " > output &&
26 i=$number_of_commits &&
27 while [ $i -gt 0 ]; do
29 echo " note for commit #$i" &&
32 test_cmp expect output
35 test_expect_success "setup: create a couple of commits" '
38 cat <<INPUT_END >input &&
39 commit refs/heads/master
40 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
53 cat <<INPUT_END >>input &&
54 commit refs/heads/master
55 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
66 git fast-import --quiet <input
69 test_expect_success "create a notes tree with both notes and non-notes" '
71 commit1=$(git rev-parse refs/heads/master^) &&
72 commit2=$(git rev-parse refs/heads/master) &&
74 cat <<INPUT_END >input &&
75 commit refs/notes/commits
76 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
93 cat <<INPUT_END >>input &&
94 commit refs/notes/commits
95 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
100 M 644 inline foobar/non-note.txt
102 A non-note in a notes tree
107 edited note for commit #2
112 cat <<INPUT_END >>input &&
113 commit refs/notes/commits
114 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
121 edited note for commit #1
124 M 644 inline deadbeef
126 non-note with SHA1-like name
129 M 644 inline de/adbeef
131 another non-note with SHA1-like name
135 git fast-import --quiet <input &&
136 git config core.notesRef refs/notes/commits
139 cat >expect <<EXPECT_END
141 edited note for commit #2
143 edited note for commit #1
146 test_expect_success "verify contents of notes" '
148 git log | grep "^ " > actual &&
149 test_cmp expect actual
152 cat >expect_nn1 <<EXPECT_END
153 A non-note in a notes tree
155 cat >expect_nn2 <<EXPECT_END
156 non-note with SHA1-like name
158 cat >expect_nn3 <<EXPECT_END
159 another non-note with SHA1-like name
162 test_expect_success "verify contents of non-notes" '
164 git cat-file -p refs/notes/commits:foobar/non-note.txt > actual_nn1 &&
165 test_cmp expect_nn1 actual_nn1 &&
166 git cat-file -p refs/notes/commits:deadbeef > actual_nn2 &&
167 test_cmp expect_nn2 actual_nn2 &&
168 git cat-file -p refs/notes/commits:de/adbeef > actual_nn3 &&
169 test_cmp expect_nn3 actual_nn3