diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2008-07-27 00:52:54 +0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-07-29 23:57:51 -0700 |
commit | ae7c5dcef92d46cfc8987fde2c264614fe475bd1 (patch) | |
tree | 0db309e33c6b47264c68a0e7685b88bb4bd668a7 /builtin-fast-export.c | |
parent | 6b2fbaaffc5ec762eae5d23b58b1dc0a88e2275e (diff) | |
download | git-ae7c5dcef92d46cfc8987fde2c264614fe475bd1.tar.gz |
Support copy and rename detection in fast-export.
Although it does not matter for Git itself, tools that
export to systems that explicitly track copies and
renames can benefit from such information.
This patch makes fast-export output correct action
logs when -M or -C are enabled.
Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-fast-export.c')
-rw-r--r-- | builtin-fast-export.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/builtin-fast-export.c b/builtin-fast-export.c index e508ced6ba..070971616d 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"); } } } |