Re: [PATCH v3 0/8] config.c: use struct for config reading state

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Glen Choo via GitGitGadget" <gitgitgadget@xxxxxxxxx> 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)



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux