summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ddafa7e)
raw | patch | inline | side by side (parent: ddafa7e)
author | Junio C Hamano <junkio@cox.net> | |
Sun, 29 May 2005 23:56:13 +0000 (16:56 -0700) | ||
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | |
Mon, 30 May 2005 17:35:49 +0000 (10:35 -0700) |
The three diff-* brothers had a sequence of calls into diffcore
that were almost identical. Introduce a new diffcore_std()
function that takes all the necessary arguments to consolidate
it. This will make later enhancements and changing the order of
diffcore application simpler.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
that were almost identical. Introduce a new diffcore_std()
function that takes all the necessary arguments to consolidate
it. This will make later enhancements and changing the order of
diffcore application simpler.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
diff-cache.c | patch | blob | history | |
diff-files.c | patch | blob | history | |
diff-tree.c | patch | blob | history | |
diff.c | patch | blob | history | |
diff.h | patch | blob | history |
diff --git a/diff-cache.c b/diff-cache.c
index 1e0fda52993f76afc0ee866f3e29a43469fcfd7c..c097826719e4007122276a569db9f3732ee64f07 100644 (file)
--- a/diff-cache.c
+++ b/diff-cache.c
die("unable to read tree object %s", tree_name);
ret = diff_cache(active_cache, active_nr);
- if (pathspec)
- diffcore_pathspec(pathspec);
- if (detect_rename)
- diffcore_rename(detect_rename, diff_score_opt);
- if (pickaxe)
- diffcore_pickaxe(pickaxe, pickaxe_opts);
+ diffcore_std(pathspec,
+ detect_rename, diff_score_opt,
+ pickaxe, pickaxe_opts);
diff_flush(diff_output_format, 1);
return ret;
}
diff --git a/diff-files.c b/diff-files.c
index 8ab7915977dc2a97fa49ad813a89c676c7208915..3f20e7eee31d4ed90a7e281a68735409e012e77d 100644 (file)
--- a/diff-files.c
+++ b/diff-files.c
show_modified(oldmode, mode, ce->sha1, null_sha1,
ce->name);
}
- if (1 < argc)
- diffcore_pathspec(argv + 1);
- if (detect_rename)
- diffcore_rename(detect_rename, diff_score_opt);
- if (pickaxe)
- diffcore_pickaxe(pickaxe, pickaxe_opts);
+ diffcore_std(argv + 1,
+ detect_rename, diff_score_opt,
+ pickaxe, pickaxe_opts);
diff_flush(diff_output_format, 1);
return 0;
}
diff --git a/diff-tree.c b/diff-tree.c
index 8bdb1dba59f9b36a9660273eb17577c1fc76cdbe..d634cb19e43bed03e6236b7c2e68df219b86cd6d 100644 (file)
--- a/diff-tree.c
+++ b/diff-tree.c
static int call_diff_flush(void)
{
- if (detect_rename)
- diffcore_rename(detect_rename, diff_score_opt);
- if (pickaxe)
- diffcore_pickaxe(pickaxe, pickaxe_opts);
+ diffcore_std(0,
+ detect_rename, diff_score_opt,
+ pickaxe, pickaxe_opts);
if (diff_queue_is_empty()) {
diff_flush(DIFF_FORMAT_NO_OUTPUT, 0);
return 0;
index 357c4efce1c76a42a56421ce90f35bc1555349dd..68e7db8667acda93fb9f12bb74199530f9b5bbbc 100644 (file)
--- a/diff.c
+++ b/diff.c
q->nr = q->alloc = 0;
}
+void diffcore_std(const char **paths,
+ int detect_rename, int rename_score,
+ const char *pickaxe, int pickaxe_opts)
+{
+ if (paths && paths[0])
+ diffcore_pathspec(paths);
+ if (detect_rename)
+ diffcore_rename(detect_rename, rename_score);
+ if (pickaxe)
+ diffcore_pickaxe(pickaxe, pickaxe_opts);
+}
+
void diff_addremove(int addremove, unsigned mode,
const unsigned char *sha1,
const char *base, const char *path)
index a07ee9f36751eac537d789d36fd4e3ce5826f757..00e46b544d166b026f8765d926636a4e4e1002bf 100644 (file)
--- a/diff.h
+++ b/diff.h
extern void diffcore_pathspec(const char **pathspec);
+extern void diffcore_std(const char **paths,
+ int detect_rename, int rename_score,
+ const char *pickaxe, int pickaxe_opts);
+
extern int diff_queue_is_empty(void);
#define DIFF_FORMAT_HUMAN 0