fast-import: allow to tag newly created objects
[gitweb.git] / fast-import.c
index ca21458612a68c26b610a31ca009259c05cd08e1..4f56f772a33c353b296223123e7e0d5307ec0a48 100644 (file)
@@ -2688,9 +2688,13 @@ static void parse_new_tag(void)
                type = oe->type;
                hashcpy(sha1, oe->idx.sha1);
        } else if (!get_sha1(from, sha1)) {
-               type = sha1_object_info(sha1, NULL);
-               if (type < 0)
-                       die("Not a valid object: %s", from);
+               struct object_entry *oe = find_object(sha1);
+               if (!oe) {
+                       type = sha1_object_info(sha1, NULL);
+                       if (type < 0)
+                               die("Not a valid object: %s", from);
+               } else
+                       type = oe->type;
        } else
                die("Invalid ref name or SHA1 expression: %s", from);
        read_next_command();