Git development
 help / color / mirror / Atom feed
From: Yann Dirson <ydirson@altern.org>
To: junkio@cox.net
Cc: git@vger.kernel.org
Subject: [PATCH] [BUG] Add a test to check git-prune does not throw away revs hidden by a graft.
Date: Thu, 18 May 2006 23:35:20 +0200	[thread overview]
Message-ID: <20060518213519.14577.67309.stgit@gandelf.nowhere.earth> (raw)


This test fails with 1.3.x and HEAD.  This is a very serious bug, since it
causes data loss.

I am not sure whether it is normal that git-fsck-objects does not retun an
error code, while we can see it reports the inconsistency in --verbose
mode.  At least trying to directly access the dropped commit triggers an
error anyway.

Signed-off-by: Yann Dirson <ydirson@altern.org>
---

 t/t6200-prune-grafts.sh |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/t/t6200-prune-grafts.sh b/t/t6200-prune-grafts.sh
new file mode 100755
index 0000000..80d0d59
--- /dev/null
+++ b/t/t6200-prune-grafts.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+#
+# Copyright (c) 2006 Yann Dirson
+#
+set -e
+
+test_description='Test that git-prune does not nuke revs hidden by a graft'
+
+. ./test-lib.sh
+
+echo First > A && git-add A && git-commit -m "Add A."
+echo First > B && git-add B && git-commit -m "Add B."
+echo Second >> A && git-update-index A && git-commit -m "Append to A."
+
+test_expect_success 'initial state is valid' 'git-fsck-objects'
+
+echo $(git-rev-parse HEAD) $(git-rev-parse HEAD^^) > .git/info/grafts
+
+test_expect_success 'grafted state is valid' 'git-fsck-objects'
+test_expect_success 'prune with the graft in effect' 'git-prune'
+test_expect_success 'grafted state is valid' 'git-fsck-objects'
+
+rm .git/info/grafts
+
+test_expect_success 'grafted state is still valid' 'git-fsck-objects'
+test_expect_success 'previously-hidden rev is still there' 'git-cat-file commit HEAD^'
+
+test_done

             reply	other threads:[~2006-05-18 21:31 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-18 21:35 Yann Dirson [this message]
2006-05-18 21:37 ` [PATCH] [BUG] Add a test to check git-prune does not throw away revs hidden by a graft Linus Torvalds
2006-05-18 21:46   ` Junio C Hamano
2006-05-18 22:01     ` Linus Torvalds
2006-05-18 22:25       ` Junio C Hamano
2006-05-18 22:20     ` Yann Dirson
2006-05-18 22:36       ` Junio C Hamano
2006-05-18 22:52       ` Yann Dirson
2006-05-18 22:53         ` Junio C Hamano
2006-05-19 18:55           ` Yann Dirson
2006-05-19 19:00             ` Jakub Narebski
2006-05-19 19:02             ` Linus Torvalds
2006-05-19 20:25               ` Yann Dirson
2006-05-19 20:45                 ` Linus Torvalds
2006-05-19 22:22               ` Junio C Hamano
2006-05-19 22:26               ` [PATCH] [BUG] Add a test to check git-prune does not throw awayrevs " David Lang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060518213519.14577.67309.stgit@gandelf.nowhere.earth \
    --to=ydirson@altern.org \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox