Merge remote-tracking branch 'ko/maint' into jc/diff-index-quick-exit-early
authorJunio C Hamano <gitster@pobox.com>
Tue, 31 May 2011 17:57:32 +0000 (10:57 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 31 May 2011 17:57:32 +0000 (10:57 -0700)
* ko/maint: (4352 commits)
  git-submodule.sh: separate parens by a space to avoid confusing some shells
  Documentation/technical/api-diff.txt: correct name of diff_unmerge()
  read_gitfile_gently: use ssize_t to hold read result
  remove tests of always-false condition
  rerere.c: diagnose a corrupt MERGE_RR when hitting EOF between TAB and '\0'
  Git 1.7.5.3
  init/clone: remove short option -L and document --separate-git-dir
  do not read beyond end of malloc'd buffer
  git-svn: Fix git svn log --show-commit
  Git 1.7.5.2
  provide a copy of the LGPLv2.1
  test core.gitproxy configuration
  copy_gecos: fix not adding nlen to len when processing "&"
  Update draft release notes to 1.7.5.2
  Documentation/git-fsck.txt: fix typo: unreadable -> unreachable
  send-pack: avoid deadlock on git:// push with failed pack-objects
  connect: let callers know if connection is a socket
  connect: treat generic proxy processes like ssh processes
  sideband_demux(): fix decl-after-stmt
  t3503: test cherry picking and reverting root commits
  ...

Conflicts:
diff.c

diff-lib.c
diff.c
diff.h
t/t4040-whitespace-status.sh
tree-diff.c

index 3b5f2242a597ff1b44a3af6be72cb14e6e0d5455..9c29293bbc05d175ba13338813e8532c7ad677cf 100644 (file)
@@ -102,9 +102,7 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
                int changed;
                unsigned dirty_submodule = 0;
 
-               if (DIFF_OPT_TST(&revs->diffopt, QUICK) &&
-                   !revs->diffopt.filter &&
-                   DIFF_OPT_TST(&revs->diffopt, HAS_CHANGES))
+               if (diff_can_quit_early(&revs->diffopt))
                        break;
 
                if (!ce_path_match(ce, &revs->prune_data))
diff --git a/diff.c b/diff.c
index 9a8012e362fe2bc08d4ecce21e68972579c3693b..7d1cdea310b95a93e63ab834475951d8c082c6c2 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -4288,6 +4288,13 @@ int diff_result_code(struct diff_options *opt, int status)
        return result;
 }
 
+int diff_can_quit_early(struct diff_options *opt)
+{
+       return (DIFF_OPT_TST(opt, QUICK) &&
+               !opt->filter &&
+               DIFF_OPT_TST(opt, HAS_CHANGES));
+}
+
 /*
  * Shall changes to this submodule be ignored?
  *
diff --git a/diff.h b/diff.h
index 42b49d8f228fd2cc680ab9a2e332819d46f2f875..394765dd381fb3056252c4cba3a44c911ea5f108 100644 (file)
--- a/diff.h
+++ b/diff.h
@@ -195,6 +195,8 @@ extern void diff_tree_combined_merge(const unsigned char *sha1, int, struct rev_
 
 void diff_set_mnemonic_prefix(struct diff_options *options, const char *a, const char *b);
 
+extern int diff_can_quit_early(struct diff_options *);
+
 extern void diff_addremove(struct diff_options *,
                           int addremove,
                           unsigned mode,
index abc49348b196cf0fec232b6f2399356e4fe324d5..3c728a3ebf9ce52e5c24c81525d5cb749cfb2957 100755 (executable)
@@ -67,4 +67,9 @@ test_expect_success 'diff-files --diff-filter --quiet' '
        test_must_fail git diff-files --diff-filter=M --quiet
 '
 
+test_expect_success 'diff-tree --diff-filter --quiet' '
+       git commit -a -m "worktree state" &&
+       test_must_fail git diff-tree --diff-filter=M --quiet HEAD^ HEAD
+'
+
 test_done
index 76f83fcc27e50b12ddbc8f72badd8d29f5b4230d..072c441601d2268c3036518d7704b1122271600e 100644 (file)
@@ -153,8 +153,7 @@ int diff_tree(struct tree_desc *t1, struct tree_desc *t2,
        strbuf_add(&base, base_str, baselen);
 
        for (;;) {
-               if (DIFF_OPT_TST(opt, QUICK) &&
-                   DIFF_OPT_TST(opt, HAS_CHANGES))
+               if (diff_can_quit_early(opt))
                        break;
                if (opt->pathspec.nr) {
                        if (!all_t1_interesting)