summaryrefslogtreecommitdiff
path: root/show-diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-04-17 04:29:45 (GMT)
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-17 04:29:45 (GMT)
commit9fec8b26eff58e1f595e8619abf1e42c07645ff8 (patch)
tree0776ebe16d603a16a3540ae78504abe6b0920ac0 /show-diff.c
parentd2522a6528a1212933e71c592950097bcfe64e7d (diff)
downloadgit-9fec8b26eff58e1f595e8619abf1e42c07645ff8.zip
git-9fec8b26eff58e1f595e8619abf1e42c07645ff8.tar.gz
git-9fec8b26eff58e1f595e8619abf1e42c07645ff8.tar.bz2
[PATCH] Do not run useless show-diff on unmerged paths repeatedly.
When run on unmerged dircache, show-diff compares the working file with each non-empty stage for that path. Two out of three times, this is not very helpful. This patch makes it report the unmergedness only once per each path and avoids running the actual diff. Upper layer SCMs like Cogito are expected to find out mode/SHA1 for each stage by using "show-files --stage" and run the diff itself. This would result in more sensible diffs. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'show-diff.c')
-rw-r--r--show-diff.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/show-diff.c b/show-diff.c
index 1f903af..0af2f10 100644
--- a/show-diff.c
+++ b/show-diff.c
@@ -167,6 +167,19 @@ int main(int argc, char **argv)
! matches_pathspec(ce, argv+1, argc-1))
continue;
+ if (ce_stage(ce)) {
+ if (machine_readable)
+ printf("U %s%c", ce->name, 0);
+ else
+ printf("%s: Unmerged\n",
+ ce->name);
+ while (i < entries &&
+ !strcmp(ce->name, active_cache[i]->name))
+ i++;
+ i--; /* compensate for loop control increments */
+ continue;
+ }
+
if (stat(ce->name, &st) < 0) {
if (errno == ENOENT && silent_on_nonexisting_files)
continue;