aboutsummaryrefslogtreecommitdiffstats
path: root/diff-files.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2005-07-14 16:55:06 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2005-07-14 16:55:06 -0700
commitc0fd1f517efeb67df32b8d4ffa209afab14be436 (patch)
tree007728a4e0c2572196e5b118761bf69fdea5bfd8 /diff-files.c
parentfdee7d07ba6c79b3e5125e96adbe1d9c3e75ce1d (diff)
downloadgit-c0fd1f517efeb67df32b8d4ffa209afab14be436.tar.gz
Make "ce_match_path()" a generic helper function
... and make git-diff-files use it too. This all _should_ make the diffcore-pathspec.c phase unnecessary, since the diff'ers now all do the path matching early interally.
Diffstat (limited to 'diff-files.c')
-rw-r--r--diff-files.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/diff-files.c b/diff-files.c
index ebaf235c52..4e7d9673ce 100644
--- a/diff-files.c
+++ b/diff-files.c
@@ -43,6 +43,7 @@ static void show_modified(int oldmode, int mode,
int main(int argc, const char **argv)
{
static const unsigned char null_sha1[20] = { 0, };
+ const char **pathspec;
int entries = read_cache();
int i;
@@ -95,6 +96,9 @@ int main(int argc, const char **argv)
argv++; argc--;
}
+ /* Do we have a pathspec? */
+ pathspec = (argc > 1) ? argv + 1 : NULL;
+
if (find_copies_harder && detect_rename != DIFF_DETECT_COPY)
usage(diff_files_usage);
@@ -114,6 +118,9 @@ int main(int argc, const char **argv)
struct cache_entry *ce = active_cache[i];
int changed;
+ if (!ce_path_match(ce, pathspec))
+ continue;
+
if (ce_stage(ce)) {
show_unmerge(ce->name);
while (i < entries &&
@@ -141,7 +148,7 @@ int main(int argc, const char **argv)
ce->sha1, (changed ? null_sha1 : ce->sha1),
ce->name);
}
- diffcore_std((1 < argc) ? argv + 1 : NULL,
+ diffcore_std(pathspec,
detect_rename, diff_score_opt,
pickaxe, pickaxe_opts,
diff_break_opt,