git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: <stefan.naewe@atlas-elektronik.com>
To: <pclouds@gmail.com>, <git@vger.kernel.org>
Cc: <thomas.braun@virtuell-zuhause.de>
Subject: Re: [PATCH 1/4] diff.h: extend "flags" field to 64 bits because we're out of bits
Date: Tue, 7 Jun 2016 06:40:41 +0000	[thread overview]
Message-ID: <40fabe80-7e68-bb9a-4b3d-c88c598cc5b8@atlas-elektronik.com> (raw)
In-Reply-To: <20160606111643.7122-2-pclouds@gmail.com>

Am 06.06.2016 um 13:16 schrieb Nguyễn Thái Ngọc Duy:
> Current flags field is 32-bits, all used except one bit and we need one
> more bit is needed for to toggle i-t-a behavior. The 9th bit could be

Something's wrong here. Either drop the "is needed" or the "we need".

> reused for this, but we could just extend it to 64 bits now to give room
> for more future flags.
> 
> gcc -Wconversion is used to catch assignments that truncate bits. No new
> warning was introduced (in fact one in index_differs_from() was
> eliminated),
> 
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
>  builtin/commit.c | 2 +-
>  diff-lib.c       | 4 ++--
>  diff.c           | 2 +-
>  diff.h           | 6 +++---
>  4 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/builtin/commit.c b/builtin/commit.c
> index 443ff91..fcfaa2b 100644
> --- a/builtin/commit.c
> +++ b/builtin/commit.c
> @@ -906,7 +906,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
>  			 * submodules which were manually staged, which would
>  			 * be really confusing.
>  			 */
> -			int diff_flags = DIFF_OPT_OVERRIDE_SUBMODULE_CONFIG;
> +			uint64_t diff_flags = DIFF_OPT_OVERRIDE_SUBMODULE_CONFIG;
>  			if (ignore_submodule_arg &&
>  			    !strcmp(ignore_submodule_arg, "all"))
>  				diff_flags |= DIFF_OPT_IGNORE_SUBMODULES;
> diff --git a/diff-lib.c b/diff-lib.c
> index bc49c70..27887d0 100644
> --- a/diff-lib.c
> +++ b/diff-lib.c
> @@ -71,7 +71,7 @@ static int match_stat_with_submodule(struct diff_options *diffopt,
>  {
>  	int changed = ce_match_stat(ce, st, ce_option);
>  	if (S_ISGITLINK(ce->ce_mode)) {
> -		unsigned orig_flags = diffopt->flags;
> +		uint64_t orig_flags = diffopt->flags;
>  		if (!DIFF_OPT_TST(diffopt, OVERRIDE_SUBMODULE_CONFIG))
>  			set_diffopt_flags_from_submodule_config(diffopt, ce->name);
>  		if (DIFF_OPT_TST(diffopt, IGNORE_SUBMODULES))
> @@ -516,7 +516,7 @@ int do_diff_cache(const unsigned char *tree_sha1, struct diff_options *opt)
>  	return 0;
>  }
>  
> -int index_differs_from(const char *def, int diff_flags)
> +int index_differs_from(const char *def, uint64_t diff_flags)
>  {
>  	struct rev_info rev;
>  	struct setup_revision_opt opt;
> diff --git a/diff.c b/diff.c
> index d3734d3..f70425f 100644
> --- a/diff.c
> +++ b/diff.c
> @@ -4936,7 +4936,7 @@ int diff_can_quit_early(struct diff_options *opt)
>  static int is_submodule_ignored(const char *path, struct diff_options *options)
>  {
>  	int ignored = 0;
> -	unsigned orig_flags = options->flags;
> +	uint64_t orig_flags = options->flags;
>  	if (!DIFF_OPT_TST(options, OVERRIDE_SUBMODULE_CONFIG))
>  		set_diffopt_flags_from_submodule_config(options, path);
>  	if (DIFF_OPT_TST(options, IGNORE_SUBMODULES))
> diff --git a/diff.h b/diff.h
> index 125447b..b497078 100644
> --- a/diff.h
> +++ b/diff.h
> @@ -115,8 +115,8 @@ struct diff_options {
>  	const char *pickaxe;
>  	const char *single_follow;
>  	const char *a_prefix, *b_prefix;
> -	unsigned flags;
> -	unsigned touched_flags;
> +	uint64_t flags;
> +	uint64_t touched_flags;
>  
>  	/* diff-filter bits */
>  	unsigned int filter;
> @@ -348,7 +348,7 @@ extern int diff_result_code(struct diff_options *, int);
>  
>  extern void diff_no_index(struct rev_info *, int, const char **);
>  
> -extern int index_differs_from(const char *def, int diff_flags);
> +extern int index_differs_from(const char *def, uint64_t diff_flags);
>  
>  /*
>   * Fill the contents of the filespec "df", respecting any textconv defined by
> 

Stefan
-- 
----------------------------------------------------------------
/dev/random says: Make Headlines..use a corduroy pillow....
python -c "print '73746566616e2e6e616577654061746c61732d656c656b74726f6e696b2e636f6d'.decode('hex')" 
GPG Key fingerprint = 2DF5 E01B 09C3 7501 BCA9  9666 829B 49C5 9221 27AF

  parent reply	other threads:[~2016-06-07  6:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-06 11:16 [PATCH/RFC 0/4] i-t-a entries again Nguyễn Thái Ngọc Duy
2016-06-06 11:16 ` [PATCH 1/4] diff.h: extend "flags" field to 64 bits because we're out of bits Nguyễn Thái Ngọc Duy
2016-06-06 19:45   ` Junio C Hamano
2016-06-07  0:40     ` Duy Nguyen
2016-06-07  6:40   ` stefan.naewe [this message]
2016-06-06 11:16 ` [PATCH 2/4] Resurrect "diff-lib.c: adjust position of i-t-a entries in diff" Nguyễn Thái Ngọc Duy
2016-06-06 20:42   ` Junio C Hamano
2016-06-07 12:04     ` Duy Nguyen
2016-06-09 16:18   ` Johannes Schindelin
2016-09-27 10:58     ` Duy Nguyen
2016-09-27 12:27       ` Duy Nguyen
2016-06-06 11:16 ` [PATCH 3/4] commit: don't count i-t-a entries when checking if the new commit is empty Nguyễn Thái Ngọc Duy
2016-06-06 19:58   ` Junio C Hamano
2016-06-06 20:28     ` Junio C Hamano
2016-06-06 11:16 ` [PATCH/RFC 4/4] commit: reinstate commit behavior before 3f6d56d via a config option Nguyễn Thái Ngọc Duy

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=40fabe80-7e68-bb9a-4b3d-c88c598cc5b8@atlas-elektronik.com \
    --to=stefan.naewe@atlas-elektronik.com \
    --cc=git@vger.kernel.org \
    --cc=pclouds@gmail.com \
    --cc=thomas.braun@virtuell-zuhause.de \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).