git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Glen Choo <chooglen@google.com>
To: Glen Choo via GitGitGadget <gitgitgadget@gmail.com>, git@vger.kernel.org
Cc: "Jonathan Tan" <jonathantanmy@google.com>,
	"Emily Shaffer" <nasamuffin@google.com>,
	"Calvin Wan" <calvinwan@google.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: Re: [PATCH v3 0/8] config.c: use struct for config reading state
Date: Tue, 28 Mar 2023 11:00:53 -0700	[thread overview]
Message-ID: <kl6llejgdacq.fsf@chooglen-macbookpro.roam.corp.google.com> (raw)
In-Reply-To: <pull.1463.v3.git.git.1680025914.gitgitgadget@gmail.com>

"Glen Choo via GitGitGadget" <gitgitgadget@gmail.com> writes:

> Note to Junio: 8/8 (which renames "cs" -> "set") conflicts with
> ab/config-multi-and-nonbool. I previously said that I'd rebase this, but
> presumably a remerge-diff is more ergonomic + flexible (let me know if I'm
> mistaken), so I'll send a remerge-diff in a reply (I don't trust GGG not to
> mangle the patch :/).


  diff --git a/config.c b/config.c
  remerge CONFLICT (content): Merge conflict in config.c
  index b17658e1ba..159c404d0c 100644
  --- a/config.c
  +++ b/config.c
  @@ -2351,15 +2351,9 @@ void read_very_early_config(config_fn_t cb, void *data)
    config_with_options(cb, data, NULL, &opts);
  }

  -<<<<<<< HEAD
  -static struct config_set_element *configset_find_element(struct config_set *set, const char *key)
  -||||||| c000d91638
  -static struct config_set_element *configset_find_element(struct config_set *cs, const char *key)
  -=======
  RESULT_MUST_BE_USED
  -static int configset_find_element(struct config_set *cs, const char *key,
  +static int configset_find_element(struct config_set *set, const char *key,
            struct config_set_element **dest)
  ->>>>>>> gitster/ab/config-multi-and-nonbool
  {
    struct config_set_element k;
    struct config_set_element *found_entry;
  @@ -2392,15 +2386,9 @@ static int configset_add_value(struct config_reader *reader,
    struct key_value_info *kv_info = xmalloc(sizeof(*kv_info));
    int ret;

  -<<<<<<< HEAD
  -	e = configset_find_element(set, key);
  -||||||| c000d91638
  -	e = configset_find_element(cs, key);
  -=======
  -	ret = configset_find_element(cs, key, &e);
  +	ret = configset_find_element(set, key, &e);
    if (ret)
      return ret;
  ->>>>>>> gitster/ab/config-multi-and-nonbool
    /*
    * Since the keys are being fed by git_config*() callback mechanism, they
    * are already normalized. So simply add them without any further munging.
  @@ -2510,40 +2498,21 @@ int git_configset_get_value(struct config_set *set, const char *key, const char
    * queried key in the files of the configset, the value returned will be the last
    * value in the value list for that key.
    */
  -<<<<<<< HEAD
  -	values = git_configset_get_value_multi(set, key);
  -||||||| c000d91638
  -	values = git_configset_get_value_multi(cs, key);
  -=======
  -	if ((ret = git_configset_get_value_multi(cs, key, &values)))
  +	if ((ret = git_configset_get_value_multi(set, key, &values)))
      return ret;
  ->>>>>>> gitster/ab/config-multi-and-nonbool

    assert(values->nr > 0);
    *value = values->items[values->nr - 1].string;
    return 0;
  }

  -<<<<<<< HEAD
  -const struct string_list *git_configset_get_value_multi(struct config_set *set, const char *key)
  -||||||| c000d91638
  -const struct string_list *git_configset_get_value_multi(struct config_set *cs, const char *key)
  -=======
  -int git_configset_get_value_multi(struct config_set *cs, const char *key,
  +int git_configset_get_value_multi(struct config_set *set, const char *key,
            const struct string_list **dest)
  ->>>>>>> gitster/ab/config-multi-and-nonbool
  -{
  -<<<<<<< HEAD
  -	struct config_set_element *e = configset_find_element(set, key);
  -	return e ? &e->value_list : NULL;
  -||||||| c000d91638
  -	struct config_set_element *e = configset_find_element(cs, key);
  -	return e ? &e->value_list : NULL;
  -=======
  +{
    struct config_set_element *e;
    int ret;

  -	if ((ret = configset_find_element(cs, key, &e)))
  +	if ((ret = configset_find_element(set, key, &e)))
      return ret;
    else if (!e)
      return 1;
  @@ -2557,12 +2526,12 @@ static int check_multi_string(struct string_list_item *item, void *util)
    return item->string ? 0 : config_error_nonbool(util);
  }

  -int git_configset_get_string_multi(struct config_set *cs, const char *key,
  +int git_configset_get_string_multi(struct config_set *set, const char *key,
            const struct string_list **dest)
  {
    int ret;

  -	if ((ret = git_configset_get_value_multi(cs, key, dest)))
  +	if ((ret = git_configset_get_value_multi(set, key, dest)))
      return ret;
    if ((ret = for_each_string_list((struct string_list *)*dest,
            check_multi_string, (void *)key)))
  @@ -2571,17 +2540,16 @@ int git_configset_get_string_multi(struct config_set *cs, const char *key,
    return 0;
  }

  -int git_configset_get(struct config_set *cs, const char *key)
  +int git_configset_get(struct config_set *set, const char *key)
  {
    struct config_set_element *e;
    int ret;

  -	if ((ret = configset_find_element(cs, key, &e)))
  +	if ((ret = configset_find_element(set, key, &e)))
      return ret;
    else if (!e)
      return 1;
    return 0;
  ->>>>>>> gitster/ab/config-multi-and-nonbool
  }

  int git_configset_get_string(struct config_set *set, const char *key, char **dest)

  parent reply	other threads:[~2023-03-28 18:01 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-01  0:38 [PATCH 0/6] [RFC] config.c: use struct for config reading state Glen Choo via GitGitGadget
2023-03-01  0:38 ` [PATCH 1/6] config.c: plumb config_source through static fns Glen Choo via GitGitGadget
2023-03-03 18:02   ` Junio C Hamano
2023-03-01  0:38 ` [PATCH 2/6] config.c: don't assign to "cf" directly Glen Choo via GitGitGadget
2023-03-01  0:38 ` [PATCH 3/6] config.c: create config_reader and the_reader Glen Choo via GitGitGadget
2023-03-03 18:05   ` Junio C Hamano
2023-03-01  0:38 ` [PATCH 4/6] config.c: plumb the_reader through callbacks Glen Choo via GitGitGadget
2023-03-08  9:54   ` Ævar Arnfjörð Bjarmason
2023-03-08 18:00     ` Glen Choo
2023-03-08 18:07       ` Junio C Hamano
2023-03-01  0:38 ` [PATCH 5/6] config.c: remove current_config_kvi Glen Choo via GitGitGadget
2023-03-06 20:12   ` Calvin Wan
2023-03-01  0:38 ` [PATCH 6/6] config.c: remove current_parsing_scope Glen Choo via GitGitGadget
2023-03-06 19:57 ` [PATCH 0/6] [RFC] config.c: use struct for config reading state Jonathan Tan
2023-03-06 21:45   ` Glen Choo
2023-03-06 22:38     ` Jonathan Tan
2023-03-08 10:32       ` Ævar Arnfjörð Bjarmason
2023-03-08 23:09         ` Glen Choo
2023-03-07 11:57 ` Ævar Arnfjörð Bjarmason
2023-03-07 18:22   ` Glen Choo
2023-03-07 18:36     ` Ævar Arnfjörð Bjarmason
2023-03-07 19:36     ` Junio C Hamano
2023-03-07 22:53       ` Glen Choo
2023-03-08  9:17         ` Ævar Arnfjörð Bjarmason
2023-03-08 23:18           ` Glen Choo
2023-03-16  0:11 ` [PATCH v2 0/8] " Glen Choo via GitGitGadget
2023-03-16  0:11   ` [PATCH v2 1/8] config.c: plumb config_source through static fns Glen Choo via GitGitGadget
2023-03-16 21:16     ` Jonathan Tan
2023-03-16  0:11   ` [PATCH v2 2/8] config.c: don't assign to "cf_global" directly Glen Choo via GitGitGadget
2023-03-16 21:18     ` Jonathan Tan
2023-03-16 21:31       ` Junio C Hamano
2023-03-16 22:56       ` Glen Choo
2023-03-16  0:11   ` [PATCH v2 3/8] config.c: create config_reader and the_reader Glen Choo via GitGitGadget
2023-03-16 21:22     ` Jonathan Tan
2023-03-16  0:11   ` [PATCH v2 4/8] config.c: plumb the_reader through callbacks Glen Choo via GitGitGadget
2023-03-16  0:11   ` [PATCH v2 5/8] config.c: remove current_config_kvi Glen Choo via GitGitGadget
2023-03-16  0:11   ` [PATCH v2 6/8] config.c: remove current_parsing_scope Glen Choo via GitGitGadget
2023-03-16  0:11   ` [PATCH v2 7/8] config: report cached filenames in die_bad_number() Glen Choo via GitGitGadget
2023-03-16 22:22     ` Jonathan Tan
2023-03-16 23:05       ` Glen Choo
2023-03-16  0:11   ` [PATCH v2 8/8] config.c: rename "struct config_source cf" Glen Choo via GitGitGadget
2023-03-16  0:15   ` [PATCH v2 0/8] config.c: use struct for config reading state Glen Choo
2023-03-16 22:29   ` Jonathan Tan
2023-03-17  5:01   ` [RFC PATCH 0/5] bypass config.c global state with configset Ævar Arnfjörð Bjarmason
2023-03-17  5:01     ` [RFC PATCH 1/5] config.h: move up "struct key_value_info" Ævar Arnfjörð Bjarmason
2023-03-17  5:01     ` [RFC PATCH 2/5] config.c: use "enum config_origin_type", not "int" Ævar Arnfjörð Bjarmason
2023-03-17  5:01     ` [RFC PATCH 3/5] config API: add a config_origin_type_name() helper Ævar Arnfjörð Bjarmason
2023-03-17  5:01     ` [RFC PATCH 4/5] config.c: refactor configset_iter() Ævar Arnfjörð Bjarmason
2023-03-17  5:01     ` [RFC PATCH 5/5] config API: add and use a repo_config_kvi() Ævar Arnfjörð Bjarmason
2023-03-17 17:17       ` Junio C Hamano
2023-03-17 20:59       ` Jonathan Tan
2023-03-17 16:21     ` [RFC PATCH 0/5] bypass config.c global state with configset Junio C Hamano
2023-03-17 16:28     ` Glen Choo
2023-03-17 19:20     ` Glen Choo
2023-03-17 23:32       ` Glen Choo
2023-03-29 11:53       ` Ævar Arnfjörð Bjarmason
2023-03-28 17:51   ` [PATCH v3 0/8] config.c: use struct for config reading state Glen Choo via GitGitGadget
2023-03-28 17:51     ` [PATCH v3 1/8] config.c: plumb config_source through static fns Glen Choo via GitGitGadget
2023-03-28 17:51     ` [PATCH v3 2/8] config.c: don't assign to "cf_global" directly Glen Choo via GitGitGadget
2023-03-28 17:51     ` [PATCH v3 3/8] config.c: create config_reader and the_reader Glen Choo via GitGitGadget
2023-03-29 10:41       ` Ævar Arnfjörð Bjarmason
2023-03-29 18:57         ` Junio C Hamano
2023-03-29 20:02           ` Glen Choo
2023-03-30 17:51         ` Glen Choo
2023-03-28 17:51     ` [PATCH v3 4/8] config.c: plumb the_reader through callbacks Glen Choo via GitGitGadget
2023-03-28 17:51     ` [PATCH v3 5/8] config.c: remove current_config_kvi Glen Choo via GitGitGadget
2023-03-28 17:51     ` [PATCH v3 6/8] config.c: remove current_parsing_scope Glen Choo via GitGitGadget
2023-03-28 17:51     ` [PATCH v3 7/8] config: report cached filenames in die_bad_number() Glen Choo via GitGitGadget
2023-03-28 17:51     ` [PATCH v3 8/8] config.c: rename "struct config_source cf" Glen Choo via GitGitGadget
2023-03-28 18:00     ` Glen Choo [this message]
2023-03-28 20:14       ` [PATCH v3 0/8] config.c: use struct for config reading state Junio C Hamano
2023-03-28 21:24         ` Glen Choo

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=kl6llejgdacq.fsf@chooglen-macbookpro.roam.corp.google.com \
    --to=chooglen@google.com \
    --cc=avarab@gmail.com \
    --cc=calvinwan@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=jonathantanmy@google.com \
    --cc=nasamuffin@google.com \
    /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).