summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3d8c7a5)
raw | patch | inline | side by side (parent: 3d8c7a5)
author | Petr Baudis <xpasky@machine> | |
Wed, 13 Apr 2005 08:40:09 +0000 (01:40 -0700) | ||
committer | Petr Baudis <xpasky@machine> | |
Wed, 13 Apr 2005 08:40:09 +0000 (01:40 -0700) |
This patch adds a -s flag for show-diff, which will surpress the
actual diffing. This is useful for my scripts when they just want
to see what needs to be updated in the cache.
Signed-off-by: Petr Baudis <pasky@ucw.cz>
actual diffing. This is useful for my scripts when they just want
to see what needs to be updated in the cache.
Signed-off-by: Petr Baudis <pasky@ucw.cz>
show-diff.c | patch | blob | history |
diff --git a/show-diff.c b/show-diff.c
index 9f82c05602b6a94218d50b62a2481cf8a4ece749..bc3791aaaab22f345bcf2478fdced16cd5e1bdce 100644 (file)
--- a/show-diff.c
+++ b/show-diff.c
int main(int argc, char **argv)
{
+ int silent = 0;
int entries = read_cache();
int i;
+ while (argc-- > 1) {
+ if (!strcmp(argv[1], "-s")) {
+ silent = 1;
+ continue;
+ }
+ usage("show-diff [-s]");
+ }
+
if (entries < 0) {
perror("read_cache");
exit(1);
if (stat(ce->name, &st) < 0) {
printf("%s: %s\n", ce->name, strerror(errno));
- if (errno == ENOENT)
+ if (errno == ENOENT && !silent)
show_diff_empty(ce);
continue;
}
printf("%02x", ce->sha1[n]);
printf("\n");
fflush(stdout);
+ if (silent)
+ continue;
+
new = read_sha1_file(ce->sha1, type, &size);
show_differences(ce->name, new, size);
free(new);