3 test_description='Test git notes prune'
7 test_expect_success 'setup: create a few commits with notes' '
13 git notes add -m "Note #1" &&
18 git notes add -m "Note #2" &&
23 git notes add -m "Note #3"
26 cat > expect <<END_OF_LOG
27 commit 5ee1c35e83ea47cd3cc4f8cbee0568915fbbbd29
28 Author: A U Thor <author@example.com>
29 Date: Thu Apr 7 15:15:13 2005 -0700
36 commit 08341ad9e94faa089d60fd3f523affb25c6da189
37 Author: A U Thor <author@example.com>
38 Date: Thu Apr 7 15:14:13 2005 -0700
45 commit ab5f302035f2e7aaf04265f08b42034c23256e1f
46 Author: A U Thor <author@example.com>
47 Date: Thu Apr 7 15:13:13 2005 -0700
55 test_expect_success 'verify commits and notes' '
58 test_cmp expect actual
61 test_expect_success 'remove some commits' '
63 git reset --hard HEAD~1 &&
64 git reflog expire --expire=now HEAD &&
68 test_expect_success 'verify that commits are gone' '
70 test_must_fail git cat-file -p 5ee1c35e83ea47cd3cc4f8cbee0568915fbbbd29 &&
71 git cat-file -p 08341ad9e94faa089d60fd3f523affb25c6da189 &&
72 git cat-file -p ab5f302035f2e7aaf04265f08b42034c23256e1f
75 test_expect_success 'verify that notes are still present' '
77 git notes show 5ee1c35e83ea47cd3cc4f8cbee0568915fbbbd29 &&
78 git notes show 08341ad9e94faa089d60fd3f523affb25c6da189 &&
79 git notes show ab5f302035f2e7aaf04265f08b42034c23256e1f
82 test_expect_success 'prune -n does not remove notes' '
84 git notes list > expect &&
86 git notes list > actual &&
87 test_cmp expect actual
91 5ee1c35e83ea47cd3cc4f8cbee0568915fbbbd29
94 test_expect_success 'prune -n lists prunable notes' '
97 git notes prune -n > actual &&
98 test_cmp expect actual
102 test_expect_success 'prune notes' '
107 test_expect_success 'verify that notes are gone' '
109 test_must_fail git notes show 5ee1c35e83ea47cd3cc4f8cbee0568915fbbbd29 &&
110 git notes show 08341ad9e94faa089d60fd3f523affb25c6da189 &&
111 git notes show ab5f302035f2e7aaf04265f08b42034c23256e1f
114 test_expect_success 'remove some commits' '
116 git reset --hard HEAD~1 &&
117 git reflog expire --expire=now HEAD &&
122 08341ad9e94faa089d60fd3f523affb25c6da189
125 test_expect_success 'prune -v notes' '
127 git notes prune -v > actual &&
128 test_cmp expect actual
131 test_expect_success 'verify that notes are gone' '
133 test_must_fail git notes show 5ee1c35e83ea47cd3cc4f8cbee0568915fbbbd29 &&
134 test_must_fail git notes show 08341ad9e94faa089d60fd3f523affb25c6da189 &&
135 git notes show ab5f302035f2e7aaf04265f08b42034c23256e1f