From: Jens Lehmann <Jens.Lehmann@web.de>
To: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: Git List <git@vger.kernel.org>
Subject: Re: [PATCH 3/5] diff: acknowledge --submodule=short command-line option
Date: Tue, 02 Oct 2012 21:24:36 +0200 [thread overview]
Message-ID: <506B3F74.3020208@web.de> (raw)
In-Reply-To: <1349196670-2844-4-git-send-email-artagnon@gmail.com>
Am 02.10.2012 18:51, schrieb Ramkumar Ramachandra:
> Currently, the diff code does not differentiate between an explicit
> '--submodule=short' being passed, and no submodule option being passed
> on the command line. Making this differentiation will be important
> when the command-line option can be used to override a
> "diff.submoduleFormat" configuration variable introduced in the next
> patch.
Wouldn't it be sufficient here to simply reset the log flag by using
"DIFF_OPT_CLR(options, SUBMODULE_LOG)"? This would avoid having to
use the last bit of the diffopt flags. And if I read the code correctly,
diff_opt_parse() is called by setup_revisions() which is called after
git_config(), so that should be safe. (And "textconv" uses the same
approach)
> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
> ---
> diff.c | 4 +++-
> diff.h | 17 +++++++++--------
> 2 files changed, 12 insertions(+), 9 deletions(-)
>
> diff --git a/diff.c b/diff.c
> index 35d3f07..8ea40f9 100644
> --- a/diff.c
> +++ b/diff.c
> @@ -3647,7 +3647,9 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
> } else if (!strcmp(arg, "--submodule"))
> DIFF_OPT_SET(options, SUBMODULE_LOG);
> else if (!prefixcmp(arg, "--submodule=")) {
> - if (!strcmp(arg + 12, "log"))
> + if (!strcmp(arg + 12, "short"))
> + DIFF_OPT_SET(options, SUBMODULE_SHORT);
> + else if (!strcmp(arg + 12, "log"))
> DIFF_OPT_SET(options, SUBMODULE_LOG);
> }
>
> diff --git a/diff.h b/diff.h
> index a658f85..4115b49 100644
> --- a/diff.h
> +++ b/diff.h
> @@ -77,14 +77,15 @@ typedef struct strbuf *(*diff_prefix_fn_t)(struct diff_options *opt, void *data)
> #define DIFF_OPT_DIRSTAT_BY_FILE (1 << 20)
> #define DIFF_OPT_ALLOW_TEXTCONV (1 << 21)
> #define DIFF_OPT_DIFF_FROM_CONTENTS (1 << 22)
> -#define DIFF_OPT_SUBMODULE_LOG (1 << 23)
> -#define DIFF_OPT_DIRTY_SUBMODULES (1 << 24)
> -#define DIFF_OPT_IGNORE_UNTRACKED_IN_SUBMODULES (1 << 25)
> -#define DIFF_OPT_IGNORE_DIRTY_SUBMODULES (1 << 26)
> -#define DIFF_OPT_OVERRIDE_SUBMODULE_CONFIG (1 << 27)
> -#define DIFF_OPT_DIRSTAT_BY_LINE (1 << 28)
> -#define DIFF_OPT_FUNCCONTEXT (1 << 29)
> -#define DIFF_OPT_PICKAXE_IGNORE_CASE (1 << 30)
> +#define DIFF_OPT_SUBMODULE_SHORT (1 << 23)
> +#define DIFF_OPT_SUBMODULE_LOG (1 << 24)
> +#define DIFF_OPT_DIRTY_SUBMODULES (1 << 25)
> +#define DIFF_OPT_IGNORE_UNTRACKED_IN_SUBMODULES (1 << 26)
> +#define DIFF_OPT_IGNORE_DIRTY_SUBMODULES (1 << 27)
> +#define DIFF_OPT_OVERRIDE_SUBMODULE_CONFIG (1 << 28)
> +#define DIFF_OPT_DIRSTAT_BY_LINE (1 << 29)
> +#define DIFF_OPT_FUNCCONTEXT (1 << 30)
> +#define DIFF_OPT_PICKAXE_IGNORE_CASE (1 << 31)
>
> #define DIFF_OPT_TST(opts, flag) ((opts)->flags & DIFF_OPT_##flag)
> #define DIFF_OPT_SET(opts, flag) ((opts)->flags |= DIFF_OPT_##flag)
>
next prev parent reply other threads:[~2012-10-02 19:24 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-02 16:51 [PATCH 0/5] submodule: introduce diff.submoduleFormat Ramkumar Ramachandra
2012-10-02 16:51 ` [PATCH 1/5] Documentation: move diff.wordRegex from config.txt to diff-config.txt Ramkumar Ramachandra
2012-10-02 16:51 ` [PATCH 2/5] Documentation: sort diff-config.txt alphabetically Ramkumar Ramachandra
2012-10-02 16:51 ` [PATCH 3/5] diff: acknowledge --submodule=short command-line option Ramkumar Ramachandra
2012-10-02 19:24 ` Jens Lehmann [this message]
2012-10-07 15:22 ` Ramkumar Ramachandra
2012-10-07 19:49 ` Jens Lehmann
2012-10-07 19:55 ` Jens Lehmann
2012-10-02 16:51 ` [PATCH 4/5] diff: introduce diff.submoduleFormat configuration variable Ramkumar Ramachandra
2012-10-02 19:44 ` Jens Lehmann
2012-10-03 13:45 ` Jens Lehmann
2012-10-29 10:30 ` Ramkumar Ramachandra
2012-10-30 21:26 ` Jens Lehmann
2012-10-02 16:51 ` [PATCH 5/5] submodule: display summary header in bold Ramkumar Ramachandra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=506B3F74.3020208@web.de \
--to=jens.lehmann@web.de \
--cc=artagnon@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.