diff options
author | Michael J Gruber <git@drmicha.warpmail.net> | 2010-05-14 23:42:07 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-05-19 23:57:18 -0700 |
commit | a9f2adff802308481f2e638bae0c5b6e205251a3 (patch) | |
tree | d07556227fcb7ff083ab7032751b247052c6a9d2 /t/t3306-notes-prune.sh | |
parent | 0e4607c09d72ada4942ea49298dba83ec4145892 (diff) | |
download | git-a9f2adff802308481f2e638bae0c5b6e205251a3.tar.gz |
notes: dry-run and verbose options for prune
Introduce -n and -v options for "git notes prune" in complete analogy to
"git prune" so that one can check for dangling notes easily.
The output is a list of names of objects whose notes would be resp.
are removed so that one can check the object ("git show sha1") as well as
the note ("git notes show sha1").
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Acked-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3306-notes-prune.sh')
-rwxr-xr-x | t/t3306-notes-prune.sh | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/t/t3306-notes-prune.sh b/t/t3306-notes-prune.sh index a0ed0353e6..b4554041b4 100755 --- a/t/t3306-notes-prune.sh +++ b/t/t3306-notes-prune.sh @@ -60,7 +60,7 @@ test_expect_success 'verify commits and notes' ' test_expect_success 'remove some commits' ' - git reset --hard HEAD~2 && + git reset --hard HEAD~1 && git reflog expire --expire=now HEAD && git gc --prune=now ' @@ -68,7 +68,7 @@ test_expect_success 'remove some commits' ' test_expect_success 'verify that commits are gone' ' ! git cat-file -p 5ee1c35e83ea47cd3cc4f8cbee0568915fbbbd29 && - ! git cat-file -p 08341ad9e94faa089d60fd3f523affb25c6da189 && + git cat-file -p 08341ad9e94faa089d60fd3f523affb25c6da189 && git cat-file -p ab5f302035f2e7aaf04265f08b42034c23256e1f ' @@ -79,6 +79,26 @@ test_expect_success 'verify that notes are still present' ' git notes show ab5f302035f2e7aaf04265f08b42034c23256e1f ' +test_expect_success 'prune -n does not remove notes' ' + + git notes list > expect && + git notes prune -n && + git notes list > actual && + test_cmp expect actual +' + +cat > expect <<EOF +5ee1c35e83ea47cd3cc4f8cbee0568915fbbbd29 +EOF + +test_expect_success 'prune -n lists prunable notes' ' + + + git notes prune -n > actual && + test_cmp expect actual +' + + test_expect_success 'prune notes' ' git notes prune @@ -87,6 +107,30 @@ test_expect_success 'prune notes' ' test_expect_success 'verify that notes are gone' ' ! git notes show 5ee1c35e83ea47cd3cc4f8cbee0568915fbbbd29 && + git notes show 08341ad9e94faa089d60fd3f523affb25c6da189 && + git notes show ab5f302035f2e7aaf04265f08b42034c23256e1f +' + +test_expect_success 'remove some commits' ' + + git reset --hard HEAD~1 && + git reflog expire --expire=now HEAD && + git gc --prune=now +' + +cat > expect <<EOF +08341ad9e94faa089d60fd3f523affb25c6da189 +EOF + +test_expect_success 'prune -v notes' ' + + git notes prune -v > actual && + test_cmp expect actual +' + +test_expect_success 'verify that notes are gone' ' + + ! git notes show 5ee1c35e83ea47cd3cc4f8cbee0568915fbbbd29 && ! git notes show 08341ad9e94faa089d60fd3f523affb25c6da189 && git notes show ab5f302035f2e7aaf04265f08b42034c23256e1f ' |