With -u diff-cache shows unchanged files, instead of files that changed. This is useful to implement a "git clean" command that throws away all checked out files that have not changed (yes, I really would like to have that). One could also do show-files and then substract the diff-cache output from it, but thats slow and clumsy. Signed-off-by: Andreas Gal <gal@uci.edu> --- b407d753e520fa0b1523d770d98b3015af197275/diff-cache.c +++ diff-cache.c @@ -2,6 +2,7 @@ static int cached_only = 0; static int line_termination = '\n'; +static int show_unchanged = 0; /* A file entry went away or appeared */ static void show_file(const char *prefix, struct cache_entry *ce) @@ -32,7 +33,7 @@ } oldmode = ntohl(old->ce_mode); - if (mode == oldmode && !memcmp(sha1, old->sha1, 20)) + if ((mode == oldmode && !memcmp(sha1, old->sha1, 20)) != show_unchanged) return 0; strcpy(old_sha1_hex, sha1_to_hex(old->sha1)); @@ -85,7 +86,7 @@ } } -static char *diff_cache_usage = "diff-cache [-r] [-z] [--cached] <tree sha1>"; +static char *diff_cache_usage = "diff-cache [-r] [-u] [-z] [--cached] <tree sha1>"; int main(int argc, char **argv) { @@ -102,6 +103,10 @@ /* We accept the -r flag just to look like diff-tree */ continue; } + if (!strcmp(arg, "-u")) { + show_unchanged = 1; + continue; + } if (!strcmp(arg, "-z")) { line_termination = '\0'; continue; - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.htmlReceived on Sun Apr 24 13:28:32 2005
This archive was generated by hypermail 2.1.8 : 2005-04-24 13:28:33 EST