From 8db751a8f953bf1a571e1fd825d1a4219e65b501 Mon Sep 17 00:00:00 2001 From: Dmitry Potapov Date: Thu, 14 Jan 2010 07:44:19 +0300 Subject: [PATCH 1/3] fast-import: tag may point to any object type 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 Acked-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- fast-import.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fast-import.c b/fast-import.c index 6faaaacb6..36c5a8ebd 100644 --- a/fast-import.c +++ b/fast-import.c @@ -2225,6 +2225,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; @@ -2245,19 +2246,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); @@ -2282,7 +2282,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); From 34f3999206e8ea41b9e4cf48e30ab1149e01d8a5 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Mon, 18 Jan 2010 22:55:07 +0100 Subject: [PATCH 2/3] grep: NUL terminate input from a file Internally "git grep" runs regexec(3) that expects its input string to be NUL terminated. When searching inside blob data, read_sha1_file() automatically gives such a buffer, but builtin-grep.c forgot to put the NUL at the end, even though it allocated enough space for it. Signed-off-by: Jim Meyering Signed-off-by: Junio C Hamano --- builtin-grep.c | 1 + 1 file changed, 1 insertion(+) diff --git a/builtin-grep.c b/builtin-grep.c index d79a6260a..63dc31c45 100644 --- a/builtin-grep.c +++ b/builtin-grep.c @@ -207,6 +207,7 @@ static int grep_file(struct grep_opt *opt, const char *filename) return 0; } close(i); + data[sz] = 0; if (opt->relative && opt->prefix_length) filename = quote_path_relative(filename, -1, &buf, opt->prefix); i = grep_buffer(opt, filename, data, sz); From 6f9752d2e29ecbd5d9489e57bfcd28fb030cba97 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 18 Jan 2010 18:16:15 -0800 Subject: [PATCH 3/3] Update draft release notes to 1.6.6.1 Signed-off-by: Junio C Hamano --- Documentation/RelNotes-1.6.6.1.txt | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Documentation/RelNotes-1.6.6.1.txt b/Documentation/RelNotes-1.6.6.1.txt index 4c88bebb9..406fbc4e0 100644 --- a/Documentation/RelNotes-1.6.6.1.txt +++ b/Documentation/RelNotes-1.6.6.1.txt @@ -4,12 +4,27 @@ Git v1.6.6.1 Release Notes Fixes since v1.6.6 ------------------ + * "git branch -a name" wasn't diagnosed as an error. + + * "git fast-import" choked when fed a tag that do not point at a + commit. + + * "git grep" finding from work tree files could have fed garbage to + the underlying regexec(3). + + * "git grep -L" didn't show empty files (they should never match, and + they should always appear in -L output as unmatching). + * http-backend was not listed in the command list in the documentation. + * Building on FreeBSD (both 7 and 8) needs OLD_ICONV set in the Makefile + + * "git checkout -m some-branch" while on an unborn branch crashed. + Other minor documentation updates are included. -- exec >/var/tmp/1 -O=v1.6.6-4-gd828fdb +O=v1.6.6-39-g6304c40 echo O=$(git describe maint) git shortlog --no-merges $O..maint