projects
/
git.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix git-log-script when HEAD is invalid.
[git.git]
/
diff-cache.c
diff --git
a/diff-cache.c
b/diff-cache.c
index
e3c4c81
..
400a4cb
100644
(file)
--- a/
diff-cache.c
+++ b/
diff-cache.c
@@
-163,15
+163,16
@@
static void mark_merge_entries(void)
}
}
}
}
-static c
har *diff_cache_usage
=
+static c
onst char diff_cache_usage[]
=
"git-diff-cache [-m] [--cached] "
"[<common diff options>] <tree-ish> [<path>...]"
COMMON_DIFF_OPTIONS_HELP;
"git-diff-cache [-m] [--cached] "
"[<common diff options>] <tree-ish> [<path>...]"
COMMON_DIFF_OPTIONS_HELP;
-int main(int argc, c
onst c
har **argv)
+int main(int argc, char **argv)
{
const char *tree_name = NULL;
unsigned char sha1[20];
{
const char *tree_name = NULL;
unsigned char sha1[20];
+ const char *prefix = setup_git_directory();
const char **pathspec = NULL;
void *tree;
unsigned long size;
const char **pathspec = NULL;
void *tree;
unsigned long size;
@@
-179,15
+180,12
@@
int main(int argc, const char **argv)
int allow_options = 1;
int i;
int allow_options = 1;
int i;
- read_cache();
for (i = 1; i < argc; i++) {
const char *arg = argv[i];
if (!allow_options || *arg != '-') {
for (i = 1; i < argc; i++) {
const char *arg = argv[i];
if (!allow_options || *arg != '-') {
- if (tree_name) {
- pathspec = argv + i;
+ if (tree_name)
break;
break;
- }
tree_name = arg;
continue;
}
tree_name = arg;
continue;
}
@@
-265,12
+263,16
@@
int main(int argc, const char **argv)
usage(diff_cache_usage);
}
usage(diff_cache_usage);
}
+ pathspec = get_pathspec(prefix, argv + i);
+
if (find_copies_harder && detect_rename != DIFF_DETECT_COPY)
usage(diff_cache_usage);
if (!tree_name || get_sha1(tree_name, sha1))
usage(diff_cache_usage);
if (find_copies_harder && detect_rename != DIFF_DETECT_COPY)
usage(diff_cache_usage);
if (!tree_name || get_sha1(tree_name, sha1))
usage(diff_cache_usage);
+ read_cache();
+
/* The rest is for paths restriction. */
diff_setup(diff_setup_opt);
/* The rest is for paths restriction. */
diff_setup(diff_setup_opt);