Merge branch 'tg/diff-no-index-refactor'
authorJunio C Hamano <gitster@pobox.com>
Fri, 27 Dec 2013 22:58:17 +0000 (14:58 -0800)
committerJunio C Hamano <gitster@pobox.com>
Fri, 27 Dec 2013 22:58:17 +0000 (14:58 -0800)
"git diff ../else/where/A ../else/where/B" when ../else/where is
clearly outside the repository, and "git diff --no-index A B", do
not have to look at the index at all, but we used to read the index
unconditionally.

* tg/diff-no-index-refactor:
diff: avoid some nesting
diff: add test for --no-index executed outside repo
diff: don't read index when --no-index is given
diff: move no-index detection to builtin/diff.c

1  2 
builtin/diff.c
diff.h
diff --cc builtin/diff.c
index fe0cc7f1b5b1451f267b1d9e24a6e40cd6e55325,24d6271625d02b5aba877ac17b13daf36f5db0aa..0f247d24008a4dc7ba5958e716c13f7582a820f1
@@@ -258,8 -258,9 +261,8 @@@ int cmd_diff(int argc, const char **arg
        struct rev_info rev;
        struct object_array ent = OBJECT_ARRAY_INIT;
        int blobs = 0, paths = 0;
 -      const char *path = NULL;
        struct blobinfo blob[2];
-       int nongit;
+       int nongit = 0, no_index = 0;
        int result = 0;
  
        /*
diff --cc diff.h
Simple merge