Add more header dependencies.
[git.git] / show-diff.c
index 1f903af..36afb3c 100644 (file)
@@ -4,7 +4,6 @@
  * Copyright (C) Linus Torvalds, 2005
  */
 #include "cache.h"
-#include <ctype.h>
 
 static char *diff_cmd = "diff -L '%s' -u -N  - '%s'";
 
@@ -28,8 +27,8 @@ static char *sq_expand(char *src)
        int cnt, c;
        char *cp;
 
-       /* count single quote characters */ 
-       for (cnt = 0, cp = src; *cp; cnt++, cp++)
+       /* count bytes needed to store the quoted string. */ 
+       for (cnt = 1, cp = src; *cp; cnt++, cp++)
                if (*cp == '\'')
                        cnt += 3;
 
@@ -167,6 +166,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;