Git development
 help / color / mirror / Atom feed
From: Yann Dirson <ydirson@altern.org>
To: Petr Baudis <pasky@suse.cz>
Cc: git@vger.kernel.org
Subject: [PATCH 2/2] Catch history inconsistency in cg-admin-rewritehist.
Date: Wed, 10 May 2006 00:32:35 +0200	[thread overview]
Message-ID: <20060509223235.20814.475.stgit@gandelf.nowhere.earth> (raw)
In-Reply-To: <20060509222738.20814.57282.stgit@gandelf.nowhere.earth>


This assertion is triggered by a bug in "cg-object-id -p", which
ignores grafts, when we attempt to rewrite a grafted commit whose
original parent does not get rewritten.

Dying here prevents to leave the user with a corrupted rewriten history.

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

 cg-admin-rewritehist |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/cg-admin-rewritehist b/cg-admin-rewritehist
index 958a8ab..8dd33f2 100755
--- a/cg-admin-rewritehist
+++ b/cg-admin-rewritehist
@@ -218,9 +218,13 @@ while read commit; do
 
 	parentstr=
 	for parent in $(cg-object-id -p $commit); do
-		for reparent in $(cat ../map/$parent); do
-			parentstr="$parentstr -p $reparent"
-		done
+		if [ -r "../map/$parent" ]; then
+			for reparent in $(cat "../map/$parent"); do
+				parentstr="$parentstr -p $reparent"
+			done
+		else
+			die "assertion failed: parent $parent for commit $commit not found in rewritten ones"
+		fi
 	done
 	if [ "$filter_parent" ]; then
 		parentstr="$(echo "$parentstr" | eval "$filter_parent")"

      parent reply	other threads:[~2006-05-09 22:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-09 22:27 [PATCH 0/2] Support for "set -e" in cogito script, and assertion in rewritehist Yann Dirson
2006-05-09 22:32 ` [PATCH 1/2] Suppress use of unsafe idiomatic use of && in cg-Xlib Yann Dirson
2006-05-09 22:32 ` Yann Dirson [this message]

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=20060509223235.20814.475.stgit@gandelf.nowhere.earth \
    --to=ydirson@altern.org \
    --cc=git@vger.kernel.org \
    --cc=pasky@suse.cz \
    /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