diff options
author | Junio C Hamano <gitster@pobox.com> | 2009-10-30 20:16:26 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-10-30 20:16:26 -0700 |
commit | d39d667169fda640065d48b70288c3342bd3195d (patch) | |
tree | fda6348bfc52ac132837c3f6816addb8bf85c20e /diff.c | |
parent | e3de372e135e765749426a0165e893283192e38c (diff) | |
parent | 86140d56c150aa17e6c98dde4ba669516f3c302a (diff) | |
download | git-d39d667169fda640065d48b70288c3342bd3195d.tar.gz |
Merge branch 'js/diff-verbose-submodule'
* js/diff-verbose-submodule:
add tests for git diff --submodule
Add the --submodule option to the diff option family
Diffstat (limited to 'diff.c')
-rw-r--r-- | diff.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -13,6 +13,7 @@ #include "utf8.h" #include "userdiff.h" #include "sigchain.h" +#include "submodule.h" #ifdef NO_FAST_WORKING_DIRECTORY #define FAST_WORKING_DIRECTORY 0 @@ -1557,6 +1558,17 @@ static void builtin_diff(const char *name_a, const char *a_prefix, *b_prefix; const char *textconv_one = NULL, *textconv_two = NULL; + if (DIFF_OPT_TST(o, SUBMODULE_LOG) && + (!one->mode || S_ISGITLINK(one->mode)) && + (!two->mode || S_ISGITLINK(two->mode))) { + const char *del = diff_get_color_opt(o, DIFF_FILE_OLD); + const char *add = diff_get_color_opt(o, DIFF_FILE_NEW); + show_submodule_summary(o->file, one ? one->path : two->path, + one->sha1, two->sha1, + del, add, reset); + return; + } + if (DIFF_OPT_TST(o, ALLOW_TEXTCONV)) { textconv_one = get_textconv(one); textconv_two = get_textconv(two); @@ -2757,6 +2769,12 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac) DIFF_OPT_CLR(options, ALLOW_TEXTCONV); else if (!strcmp(arg, "--ignore-submodules")) DIFF_OPT_SET(options, IGNORE_SUBMODULES); + else if (!strcmp(arg, "--submodule")) + DIFF_OPT_SET(options, SUBMODULE_LOG); + else if (!prefixcmp(arg, "--submodule=")) { + if (!strcmp(arg + 12, "log")) + DIFF_OPT_SET(options, SUBMODULE_LOG); + } /* misc options */ else if (!strcmp(arg, "-z")) |