From: Antoine Pelisse <apelisse@gmail.com>
To: git@vger.kernel.org
Cc: Antoine Pelisse <apelisse@gmail.com>
Subject: [PATCH] fast-export: Allow pruned-references in mark file
Date: Sat, 24 Nov 2012 10:47:12 +0100 [thread overview]
Message-ID: <1353750432-17373-1-git-send-email-apelisse@gmail.com> (raw)
fast-export can fail because of some pruned-reference when importing a
mark file.
The problem happens in the following scenario:
$ git fast-export --export-marks=MARKS master
(rewrite master)
$ git prune
$ git fast-export --import-marks=MARKS master
This might fail if some references have been removed by prune
because some marks will refer to non-existing commits.
Let's warn when we have a mark for a commit we don't know.
Also, increment the last_idnum before, so we don't override
the mark.
Signed-off-by: Antoine Pelisse <apelisse@gmail.com>
---
builtin/fast-export.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/builtin/fast-export.c b/builtin/fast-export.c
index 12220ad..141b245 100644
--- a/builtin/fast-export.c
+++ b/builtin/fast-export.c
@@ -607,16 +607,19 @@ static void import_marks(char *input_file)
|| *mark_end != ' ' || get_sha1(mark_end + 1, sha1))
die("corrupt mark line: %s", line);
+ if (last_idnum < mark)
+ last_idnum = mark;
+
object = parse_object(sha1);
- if (!object)
- die ("Could not read blob %s", sha1_to_hex(sha1));
+ if (!object) {
+ warning("Could not read blob %s", sha1_to_hex(sha1));
+ continue;
+ }
if (object->flags & SHOWN)
error("Object %s already has a mark", sha1_to_hex(sha1));
mark_object(object, mark);
- if (last_idnum < mark)
- last_idnum = mark;
object->flags |= SHOWN;
}
--
1.7.9.5
next reply other threads:[~2012-11-24 9:47 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-24 9:47 Antoine Pelisse [this message]
2012-11-26 4:03 ` [PATCH] fast-export: Allow pruned-references in mark file Junio C Hamano
2012-11-26 11:37 ` Felipe Contreras
2012-11-26 13:23 ` Antoine Pelisse
2012-11-26 14:04 ` Felipe Contreras
2012-11-26 14:14 ` Antoine Pelisse
2012-11-26 17:41 ` Junio C Hamano
2012-11-26 20:04 ` Antoine Pelisse
2012-11-26 20:39 ` Felipe Contreras
2012-11-26 20:44 ` Junio C Hamano
2012-12-01 10:10 ` Antoine Pelisse
2013-04-06 17:04 ` Antoine Pelisse
2013-04-06 17:33 ` Felipe Contreras
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=1353750432-17373-1-git-send-email-apelisse@gmail.com \
--to=apelisse@gmail.com \
--cc=git@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).