summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1187d75)
raw | patch | inline | side by side (parent: 1187d75)
author | Alexandre Julliard <julliard@winehq.org> | |
Sat, 10 Feb 2007 14:36:47 +0000 (15:36 +0100) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sun, 11 Feb 2007 20:47:22 +0000 (12:47 -0800) |
This avoids some code duplication, and yields more readable results
for directory renames.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
for directory renames.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
diff.c | patch | blob | history |
index 22be3f77b549899b31f622feb51b58541c34a422..acd689643cd625cbaa6589b82ac4117971f45211 100644 (file)
--- a/diff.c
+++ b/diff.c
static void show_rename_copy(const char *renamecopy, struct diff_filepair *p)
{
- const char *old, *new;
+ char *names = pprint_rename(p->one->path, p->two->path);
- /* Find common prefix */
- old = p->one->path;
- new = p->two->path;
- while (1) {
- const char *slash_old, *slash_new;
- slash_old = strchr(old, '/');
- slash_new = strchr(new, '/');
- if (!slash_old ||
- !slash_new ||
- slash_old - old != slash_new - new ||
- memcmp(old, new, slash_new - new))
- break;
- old = slash_old + 1;
- new = slash_new + 1;
- }
- /* p->one->path thru old is the common prefix, and old and new
- * through the end of names are renames
- */
- if (old != p->one->path)
- printf(" %s %.*s{%s => %s} (%d%%)\n", renamecopy,
- (int)(old - p->one->path), p->one->path,
- old, new, (int)(0.5 + p->score * 100.0/MAX_SCORE));
- else
- printf(" %s %s => %s (%d%%)\n", renamecopy,
- p->one->path, p->two->path,
- (int)(0.5 + p->score * 100.0/MAX_SCORE));
+ printf(" %s %s (%d%%)\n", renamecopy, names,
+ (int)(0.5 + p->score * 100.0/MAX_SCORE));
+ free(names);
show_mode_change(p, 0);
}