From: Dmitry Potapov <dpotapov@gmail.com>
To: "Shawn O. Pearce" <spearce@spearce.org>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: [PATCH v3] fast-import: tag may point to any object type
Date: Thu, 14 Jan 2010 07:44:19 +0300 [thread overview]
Message-ID: <20100114044419.GE10586@dpotapov.dyndns.org> (raw)
In-Reply-To: <20100113172456.GB18625@spearce.org>
If you tried to export the official git repository, and then to import it
back then git-fast-import would die complaining that "Mark :1 not a commit".
Accordingly to a generated crash file, Mark 1 is not a commit but a blob,
which is pointed by junio-gpg-pub tag. Because git-tag allows to create such
tags, git-fast-import should import them.
Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
---
On Wed, Jan 13, 2010 at 09:24:56AM -0800, Shawn O. Pearce wrote:
> Dmitry Potapov <dpotapov@gmail.com> wrote:
> >
> > + type = sha1_object_info(sha1, NULL);
> > buf = read_object_with_reference(sha1,
> > - commit_type, &size, sha1);
> > + typename(type), &size, sha1);
>
> This is better spelled as:
>
> buf = read_sha1_file(sha1, &type, &size);
Thank you for correction.
>
> But otherwise the patch looks correct now, thanks.
>
> If you could make this one change, add my
>
> Acked-by: Shawn O. Pearce <spearce@spearce.org>
>
> and resend so Junio can apply, thanks.
fast-import.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/fast-import.c b/fast-import.c
index cd87049..60d0aa2 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -2305,6 +2305,7 @@ static void parse_new_tag(void)
struct tag *t;
uintmax_t from_mark = 0;
unsigned char sha1[20];
+ enum object_type type;
/* Obtain the new tag name from the rest of our command */
sp = strchr(command_buf.buf, ' ') + 1;
@@ -2325,19 +2326,18 @@ static void parse_new_tag(void)
s = lookup_branch(from);
if (s) {
hashcpy(sha1, s->sha1);
+ type = OBJ_COMMIT;
} else if (*from == ':') {
struct object_entry *oe;
from_mark = strtoumax(from + 1, NULL, 10);
oe = find_mark(from_mark);
- if (oe->type != OBJ_COMMIT)
- die("Mark :%" PRIuMAX " not a commit", from_mark);
+ type = oe->type;
hashcpy(sha1, oe->sha1);
} else if (!get_sha1(from, sha1)) {
unsigned long size;
char *buf;
- buf = read_object_with_reference(sha1,
- commit_type, &size, sha1);
+ buf = read_sha1_file(sha1, &type, &size);
if (!buf || size < 46)
die("Not a valid commit: %s", from);
free(buf);
@@ -2362,7 +2362,7 @@ static void parse_new_tag(void)
"object %s\n"
"type %s\n"
"tag %s\n",
- sha1_to_hex(sha1), commit_type, t->name);
+ sha1_to_hex(sha1), typename(type), t->name);
if (tagger)
strbuf_addf(&new_data,
"tagger %s\n", tagger);
--
1.6.6.137.g1acb
prev parent reply other threads:[~2010-01-14 4:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-11 5:02 [PATCH] fast-import: tag may point to any object type Dmitry Potapov
2010-01-11 17:14 ` Shawn O. Pearce
2010-01-13 12:35 ` [PATCH v2] " Dmitry Potapov
2010-01-13 17:24 ` Shawn O. Pearce
2010-01-14 4:44 ` Dmitry Potapov [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=20100114044419.GE10586@dpotapov.dyndns.org \
--to=dpotapov@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=spearce@spearce.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).