X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=builtin-fast-export.c;h=070971616dbb12d005c5c9a1f82cc5b0c5391f62;hb=847d10f56d7853cd0e139a7c2e6ad0ad2de5c464;hp=e508ced6ba13954580632da50d789f221a132224;hpb=c455c87c5cd42bbbe586b31cea1143132f3a39e4;p=git.git diff --git a/builtin-fast-export.c b/builtin-fast-export.c index e508ced6b..070971616 100644 --- a/builtin-fast-export.c +++ b/builtin-fast-export.c @@ -132,10 +132,27 @@ static void show_filemodify(struct diff_queue_struct *q, { int i; for (i = 0; i < q->nr; i++) { + struct diff_filespec *ospec = q->queue[i]->one; struct diff_filespec *spec = q->queue[i]->two; - if (is_null_sha1(spec->sha1)) + + switch (q->queue[i]->status) { + case DIFF_STATUS_DELETED: printf("D %s\n", spec->path); - else { + break; + + case DIFF_STATUS_COPIED: + case DIFF_STATUS_RENAMED: + printf("%c \"%s\" \"%s\"\n", q->queue[i]->status, + ospec->path, spec->path); + + if (!hashcmp(ospec->sha1, spec->sha1) && + ospec->mode == spec->mode) + break; + /* fallthrough */ + + case DIFF_STATUS_TYPE_CHANGED: + case DIFF_STATUS_MODIFIED: + case DIFF_STATUS_ADDED: /* * Links refer to objects in another repositories; * output the SHA-1 verbatim. @@ -148,6 +165,13 @@ static void show_filemodify(struct diff_queue_struct *q, printf("M %06o :%d %s\n", spec->mode, get_object_mark(object), spec->path); } + break; + + default: + die("Unexpected comparison status '%c' for %s, %s", + q->queue[i]->status, + ospec->path ? ospec->path : "none", + spec->path ? spec->path : "none"); } } }