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;
}
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;
}
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;
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)
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