summaryrefslogtreecommitdiff
path: root/fast-import.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-10-13 19:03:19 -0700
committerJunio C Hamano <gitster@pobox.com>2011-10-13 19:03:19 -0700
commitc13975e7fd19a6939de264233eed20f93c6d1f46 (patch)
tree08e1cd1cb6b34922eee84ea129fe05229512ad13 /fast-import.c
parent0fd8cb3fec7abb36505a150fe5cfa9b1d8b85496 (diff)
parent0bc69881a611c582f3b89a475882161d83c56494 (diff)
downloadgit-c13975e7fd19a6939de264233eed20f93c6d1f46.tar.gz
Merge branch 'di/fast-import-empty-tag-note-fix'
* di/fast-import-empty-tag-note-fix: fast-import: don't allow to note on empty branch fast-import: don't allow to tag empty branch
Diffstat (limited to 'fast-import.c')
-rw-r--r--fast-import.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fast-import.c b/fast-import.c
index f9347f55ba..8d8ea3c45c 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -2411,6 +2411,8 @@ static void note_change_n(struct branch *b, unsigned char old_fanout)
/* <committish> */
s = lookup_branch(p);
if (s) {
+ if (is_null_sha1(s->sha1))
+ die("Can't add a note on empty branch.");
hashcpy(commit_sha1, s->sha1);
} else if (*p == ':') {
uintmax_t commit_mark = strtoumax(p + 1, NULL, 10);
@@ -2712,6 +2714,8 @@ static void parse_new_tag(void)
from = strchr(command_buf.buf, ' ') + 1;
s = lookup_branch(from);
if (s) {
+ if (is_null_sha1(s->sha1))
+ die("Can't tag an empty branch.");
hashcpy(sha1, s->sha1);
type = OBJ_COMMIT;
} else if (*from == ':') {