From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/5] diff_filespec: reorder dirty_submodule macro definitions
Date: Fri, 17 Jan 2014 10:46:59 -0800 [thread overview]
Message-ID: <xmqqha92xx7g.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <20140117011945.GA7249@sigill.intra.peff.net> (Jeff King's message of "Thu, 16 Jan 2014 20:19:46 -0500")
Jeff King <peff@peff.net> writes:
> diff_filespec has a 2-bit "dirty_submodule" field and
> defines two flags as macros. Originally these were right
> next to each other, but a new field was accidentally added
> in between in commit 4682d85.
Interesting.
- 4682d852 (diff-index.c: "git diff" has no need to read blob from
the standard input, 2012-06-27) wants to use this rule: all the
bitfield definitions first, and then whatever macro constants
next.
- 25e5e2bf (combine-diff: support format_callback, 2011-08-19),
wants to use a different rule: a run of (one bitfield definition
and zero-or-more macro constants to be used in that bitfield).
When they were merged together at d7afe648 (Merge branch
'jc/refactor-diff-stdin', 2012-07-13), these two conflicting
philosophies crashed.
That is the commit to be blamed for this mess ;-)
I am of course fine with the end result this patch gives us.
Thanks.
> This patch puts the field and
> its flags back together.
>
> Using an enum like:
>
> enum {
> DIRTY_SUBMODULE_UNTRACKED = 1,
> DIRTY_SUBMODULE_MODIFIED = 2
> } dirty_submodule;
>
> would be more obvious, but it bloats the structure. Limiting
> the enum size like:
>
> } dirty_submodule : 2;
>
> might work, but it is not portable.
>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
> diffcore.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/diffcore.h b/diffcore.h
> index 1c16c85..f822f9e 100644
> --- a/diffcore.h
> +++ b/diffcore.h
> @@ -43,9 +43,9 @@ struct diff_filespec {
> unsigned should_free : 1; /* data should be free()'ed */
> unsigned should_munmap : 1; /* data should be munmap()'ed */
> unsigned dirty_submodule : 2; /* For submodules: its work tree is dirty */
> - unsigned is_stdin : 1;
> #define DIRTY_SUBMODULE_UNTRACKED 1
> #define DIRTY_SUBMODULE_MODIFIED 2
> + unsigned is_stdin : 1;
> unsigned has_more_entries : 1; /* only appear in combined diff */
> struct userdiff_driver *driver;
> /* data should be considered "binary"; -1 means "don't know yet" */
next prev parent reply other threads:[~2014-01-17 18:47 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-17 1:18 [PATCH 0/5] diff_filespec cleanups and optimizations Jeff King
2014-01-17 1:19 ` [PATCH 1/5] diff_filespec: reorder dirty_submodule macro definitions Jeff King
2014-01-17 18:46 ` Junio C Hamano [this message]
2014-01-17 19:47 ` Jeff King
2014-01-17 23:50 ` Junio C Hamano
2014-01-17 1:20 ` [PATCH 2/5] diff_filespec: drop funcname_pattern_ident field Jeff King
2014-01-17 1:21 ` [PATCH 3/5] diff_filespec: drop xfrm_flags field Jeff King
2014-01-17 1:22 ` [PATCH 4/5] diff_filespec: reorder is_binary field Jeff King
2014-01-17 1:25 ` [PATCH 5/5] diff_filespec: use only 2 bits for is_binary flag Jeff King
2014-01-17 18:49 ` [PATCH 0/5] diff_filespec cleanups and optimizations Junio C Hamano
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=xmqqha92xx7g.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
/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.