diff --git a/fast-import.c b/fast-import.c index f5107df74d..17554f6849 100644 --- a/fast-import.c +++ b/fast-import.c @@ -1709,14 +1709,16 @@ static void cmd_from(struct branch *b) } else if (*from == ':') { uintmax_t idnum = strtoumax(from + 1, NULL, 10); struct object_entry *oe = find_mark(idnum); - unsigned long size; - char *buf; if (oe->type != OBJ_COMMIT) die("Mark :%" PRIuMAX " not a commit", idnum); hashcpy(b->sha1, oe->sha1); - buf = gfi_unpack_entry(oe, &size); - cmd_from_commit(b, buf, size); - free(buf); + if (oe->pack_id != MAX_PACK_ID) { + unsigned long size; + char *buf = gfi_unpack_entry(oe, &size); + cmd_from_commit(b, buf, size); + free(buf); + } else + cmd_from_existing(b); } else if (!get_sha1(from, b->sha1)) cmd_from_existing(b); else diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh index 8e958da536..72e49f5d3b 100755 --- a/t/t9300-fast-import.sh +++ b/t/t9300-fast-import.sh @@ -119,6 +119,35 @@ test_expect_success \ input < $GIT_COMMITTER_DATE +data <expect <actual +test_expect_success \ + 'A: verify diff' \ + 'compare_diff_raw expect actual && + test `git-rev-parse --verify master:file2` \ + = `git-rev-parse --verify verify--import-marks:copy-of-file2`' + ### ### series B ###