Code

fast-import: don't allow to tag empty branch
[git.git] / fast-import.c
index 742e7da6b8b58dd0803d89c6ad6c59589274a31b..c44cc11fd7994fd4591bc7e445777da376d481d1 100644 (file)
@@ -2717,6 +2717,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 == ':') {