summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-05-22 02:40:36 (GMT)
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-22 05:49:19 (GMT)
commit38c6f78059c3060db6f94b24f4a90063a91090d2 (patch)
tree18d06f832da6e27f4b600b64b3dc27c393c71ea1 /diff.c
parent58b103f55d5b95dc24cce2fb4f64e697958fd204 (diff)
downloadgit-38c6f78059c3060db6f94b24f4a90063a91090d2.zip
git-38c6f78059c3060db6f94b24f4a90063a91090d2.tar.gz
git-38c6f78059c3060db6f94b24f4a90063a91090d2.tar.bz2
[PATCH] Prepare diffcore interface for diff-tree header supression.
This does not actually supress the extra headers when pickaxe is used, but prepares enough support for diff-tree to implement it. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c43
1 files changed, 22 insertions, 21 deletions
diff --git a/diff.c b/diff.c
index f7d4bc4..85505fa 100644
--- a/diff.c
+++ b/diff.c
@@ -12,13 +12,10 @@
static const char *diff_opts = "-pu";
static unsigned char null_sha1[20] = { 0, };
-static int detect_rename;
static int reverse_diff;
static int diff_raw_output = -1;
static const char **pathspec;
static int speccnt;
-static const char *pickaxe;
-static int minimum_score;
static const char *external_diff(void)
{
@@ -512,21 +509,13 @@ int diff_scoreopt_parse(const char *opt)
return MAX_SCORE * num / scale;
}
-void diff_setup(int detect_rename_, int minimum_score_,
- const char *pickaxe_,
- int reverse_diff_, int diff_raw_output_,
- const char **pathspec_, int speccnt_)
+void diff_setup(int reverse_diff_, int diff_raw_output_)
{
- detect_rename = detect_rename_;
reverse_diff = reverse_diff_;
- pathspec = pathspec_;
diff_raw_output = diff_raw_output_;
- speccnt = speccnt_;
- minimum_score = minimum_score_ ? : DEFAULT_MINIMUM_SCORE;
- pickaxe = pickaxe_;
}
-static struct diff_queue_struct queued_diff;
+struct diff_queue_struct diff_queued_diff;
struct diff_filepair *diff_queue(struct diff_queue_struct *queue,
struct diff_filespec *one,
@@ -636,15 +625,27 @@ static void diff_flush_one(struct diff_filepair *p)
diff_flush_patch(p);
}
-void diff_flush(void)
+int diff_queue_is_empty(void)
{
- struct diff_queue_struct *q = &queued_diff;
+ struct diff_queue_struct *q = &diff_queued_diff;
int i;
- if (detect_rename)
- diff_detect_rename(q, detect_rename, minimum_score);
- if (pickaxe)
- diff_pickaxe(q, pickaxe);
+ for (i = 0; i < q->nr; i++) {
+ struct diff_filepair *p = q->queue[i];
+ if (!identical(p->one, p->two))
+ return 0;
+ }
+ return 1;
+}
+
+void diff_flush(const char **pathspec_, int speccnt_)
+{
+ struct diff_queue_struct *q = &diff_queued_diff;
+ int i;
+
+ pathspec = pathspec_;
+ speccnt = speccnt_;
+
for (i = 0; i < q->nr; i++)
diff_flush_one(q->queue[i]);
@@ -693,7 +694,7 @@ void diff_addremove(int addremove, unsigned mode,
if (addremove != '-')
fill_filespec(two, sha1, mode);
- diff_queue(&queued_diff, one, two);
+ diff_queue(&diff_queued_diff, one, two);
}
void diff_change(unsigned old_mode, unsigned new_mode,
@@ -716,7 +717,7 @@ void diff_change(unsigned old_mode, unsigned new_mode,
fill_filespec(one, old_sha1, old_mode);
fill_filespec(two, new_sha1, new_mode);
- diff_queue(&queued_diff, one, two);
+ diff_queue(&diff_queued_diff, one, two);
}
void diff_unmerge(const char *path)