aboutsummaryrefslogtreecommitdiff
path: root/diff-files.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-05-21 02:40:01 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-21 09:58:03 -0700
commit52e9578985fb636ec1d3f6cf794fdadd5ec896fc (patch)
treebb22f522116f5d8e6ae677b7a4660e959c052fc2 /diff-files.c
parent427dcb4bca49117664d9428fd4e86483f516d703 (diff)
downloadgit-52e9578985fb636ec1d3f6cf794fdadd5ec896fc.tar.gz
git-52e9578985fb636ec1d3f6cf794fdadd5ec896fc.tar.xz
[PATCH] Introducing software archaeologist's tool "pickaxe".
This steals the "pickaxe" feature from JIT and make it available to the bare Plumbing layer. From the command line, the user gives a string he is intersted in. Using the diff-core infrastructure previously introduced, it filters the differences to limit the output only to the diffs between <src> and <dst> where the string appears only in one but not in the other. For example: $ ./git-rev-list HEAD | ./git-diff-tree -Sdiff-tree-helper --stdin -M would show the diffs that touch the string "diff-tree-helper". In real software-archaeologist application, you would typically look for a few to several lines of code and see where that code came from. The "pickaxe" module runs after "rename/copy detection" module, so it even crosses the file rename boundary, as the above example demonstrates. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'diff-files.c')
-rw-r--r--diff-files.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/diff-files.c b/diff-files.c
index d02025492..d3b80a072 100644
--- a/diff-files.c
+++ b/diff-files.c
@@ -7,13 +7,14 @@
#include "diff.h"
static const char *diff_files_usage =
-"git-diff-files [-p] [-q] [-r] [-z] [-M] [-C] [-R] [paths...]";
+"git-diff-files [-p] [-q] [-r] [-z] [-M] [-C] [-R] [-S<string>] [paths...]";
static int generate_patch = 0;
static int line_termination = '\n';
static int detect_rename = 0;
static int reverse_diff = 0;
static int diff_score_opt = 0;
+static char *pickaxe = 0;
static int silent = 0;
static int matches_pathspec(struct cache_entry *ce, char **spec, int cnt)
@@ -67,6 +68,8 @@ int main(int argc, char **argv)
line_termination = 0;
else if (!strcmp(argv[1], "-R"))
reverse_diff = 1;
+ else if (!strcmp(argv[1], "-S"))
+ pickaxe = argv[1] + 2;
else if (!strncmp(argv[1], "-M", 2)) {
diff_score_opt = diff_scoreopt_parse(argv[1]);
detect_rename = generate_patch = 1;
@@ -89,8 +92,8 @@ int main(int argc, char **argv)
exit(1);
}
- diff_setup(detect_rename, diff_score_opt, reverse_diff,
- (generate_patch ? -1 : line_termination),
+ diff_setup(detect_rename, diff_score_opt, pickaxe,
+ reverse_diff, (generate_patch ? -1 : line_termination),
NULL, 0);
for (i = 0; i < entries; i++) {