summaryrefslogtreecommitdiff
path: root/builtin-diff-index.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2010-01-30 16:03:10 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2010-01-30 16:03:10 -0800
commit00d3278c8534a8244ae3447189401111e017fd5d (patch)
treef1c19903bc10ffe4816642040080fb6cfd5da376 /builtin-diff-index.c
parentt6000lib: Fix permission (diff)
parentAdd a small patch-mode testing library (diff)
downloadtgif-00d3278c8534a8244ae3447189401111e017fd5d.tar.xz
Merge commit 'b319ef7' into jc/maint-fix-test-perm
* commit 'b319ef7': (8132 commits) Add a small patch-mode testing library git-apply--interactive: Refactor patch mode code t8005: Nobody writes Russian in shift_jis Fix severe breakage in "git-apply --whitespace=fix" Update release notes for 1.6.4 After renaming a section, print any trailing variable definitions Make section_name_match start on '[', and return the length on success send-email: detect cycles in alias expansion Show the presence of untracked files in the bash prompt. SunOS grep does not understand -C<n> nor -e Fix export_marks() error handling. git repack: keep commits hidden by a graft Add a test showing that 'git repack' throws away grafted-away parents git branch: clean up detached branch handling git branch: avoid unnecessary object lookups git branch: fix performance problem git svn: fix shallow clone when upstream revision is too new do_one_ref(): null_sha1 check is not about broken ref configure.ac: properly unset NEEDS_SSL_WITH_CRYPTO when sha1 func is missing janitor: useless checks before free ...
Diffstat (limited to 'builtin-diff-index.c')
-rw-r--r--builtin-diff-index.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/builtin-diff-index.c b/builtin-diff-index.c
index d90eba95a6..04837494fe 100644
--- a/builtin-diff-index.c
+++ b/builtin-diff-index.c
@@ -5,7 +5,7 @@
#include "builtin.h"
static const char diff_cache_usage[] =
-"git-diff-index [-m] [--cached] "
+"git diff-index [-m] [--cached] "
"[<common diff options>] <tree-ish> [<path>...]"
COMMON_DIFF_OPTIONS_HELP;
@@ -17,13 +17,13 @@ int cmd_diff_index(int argc, const char **argv, const char *prefix)
int result;
init_revisions(&rev, prefix);
- git_config(git_default_config); /* no "diff" UI options */
+ git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
rev.abbrev = 0;
argc = setup_revisions(argc, argv, &rev, NULL);
for (i = 1; i < argc; i++) {
const char *arg = argv[i];
-
+
if (!strcmp(arg, "--cached"))
cached = 1;
else
@@ -39,10 +39,12 @@ int cmd_diff_index(int argc, const char **argv, const char *prefix)
if (rev.pending.nr != 1 ||
rev.max_count != -1 || rev.min_age != -1 || rev.max_age != -1)
usage(diff_cache_usage);
+ if (!cached)
+ setup_work_tree();
if (read_cache() < 0) {
perror("read_cache");
return -1;
}
result = run_diff_index(&rev, cached);
- return rev.diffopt.exit_with_status ? rev.diffopt.has_changes: result;
+ return diff_result_code(&rev.diffopt, result);
}