I wanted to check if any patches that update builtin/fsck.c also update 't' directory and git seemed not support this case (true?). With this I can do git log --patch --full-diff="'builtin/fsck.c' 't'" -- builtin/fsck.c I guess this may be something people find useful. This patch is a bit inconvenient though because <pathspec> is parsed with sq_dequote_to_argv() and all arguments must be wrapped by ''. Also "full-diff" name does not make much sense when it comes with pathspec. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> --- revision.c | 19 +++++++++++++++++++ revision.h | 1 + 2 files changed, 20 insertions(+), 0 deletions(-) diff --git a/revision.c b/revision.c index 8764dde..f508953 100644 --- a/revision.c +++ b/revision.c @@ -13,6 +13,7 @@ #include "decorate.h" #include "log-tree.h" #include "string-list.h" +#include "quote.h" volatile show_early_output_fn_t show_early_output; @@ -1531,6 +1532,10 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg } else if (!strcmp(arg, "--full-diff")) { revs->diff = 1; revs->full_diff = 1; + } else if (!prefixcmp(arg, "--full-diff=")) { + revs->diff = 1; + revs->full_diff = 1; + revs->full_diff_opt = arg + strlen("--full-diff="); } else if (!strcmp(arg, "--full-history")) { revs->simplify_history = 0; } else if (!strcmp(arg, "--relative-date")) { @@ -1819,6 +1824,20 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s revs->prune = 1; if (!revs->full_diff) diff_tree_setup_paths(revs->prune_data.raw, &revs->diffopt); + else if (revs->full_diff_opt) { + const char **argv = NULL; + int alloc = 0, nr = 0; + char *arg; + + arg = xstrdup(revs->full_diff_opt); + sq_dequote_to_argv(arg, &argv, &nr, &alloc); + + ALLOC_GROW(argv, nr + 1, alloc); + argv[nr] = NULL; + argv = get_pathspec(revs->prefix, argv); + + diff_tree_setup_paths(argv, &revs->diffopt); + } } if (revs->combine_merges) revs->ignore_merges = 0; diff --git a/revision.h b/revision.h index 6aa53d1..baa709c 100644 --- a/revision.h +++ b/revision.h @@ -137,6 +137,7 @@ struct rev_info { const char *subject_prefix; int no_inline; int show_log_size; + const char *full_diff_opt; /* Filter by commit log message */ struct grep_opt grep_filter; -- 1.7.3.1.256.g2539c.dirty -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html