summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8ae0a8c)
raw | patch | inline | side by side (parent: 8ae0a8c)
author | Linus Torvalds <torvalds@ppc970.osdl.org> | |
Thu, 5 May 2005 16:31:09 +0000 (09:31 -0700) | ||
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | |
Thu, 5 May 2005 16:31:09 +0000 (09:31 -0700) |
This allows you to work with a directory tree that isn't fully populated,
without making diff-cache say that all the files are gone.
without making diff-cache say that all the files are gone.
diff-cache.c | patch | blob | history |
diff --git a/diff-cache.c b/diff-cache.c
index 94c5f6654bdee04cf56adeb77b22ae998fdce678..ef522cd23387aa0f4264f08e346ffdd1616c4f59 100644 (file)
--- a/diff-cache.c
+++ b/diff-cache.c
static int cached_only = 0;
static int generate_patch = 0;
+static int match_nonexisting = 0;
static int line_termination = '\n';
/* A file entry went away or appeared */
static unsigned char no_sha1[20];
int changed;
struct stat st;
- if (lstat(ce->name, &st) < 0)
+ if (lstat(ce->name, &st) < 0) {
+ if (errno == ENOENT && match_nonexisting) {
+ *sha1p = sha1;
+ *modep = mode;
+ return 0;
+ }
return -1;
+ }
changed = cache_match_stat(ce, &st);
if (changed) {
mode = create_ce_mode(st.st_mode);
}
static char *diff_cache_usage =
-"diff-cache [-r] [-z] [-p] [--cached] <tree sha1>";
+"diff-cache [-r] [-z] [-p] [-i] [--cached] <tree sha1>";
int main(int argc, char **argv)
{
line_termination = '\0';
continue;
}
+ if (!strcmp(arg, "-m")) {
+ match_nonexisting = 1;
+ continue;
+ }
if (!strcmp(arg, "--cached")) {
cached_only = 1;
continue;