merge(3p/git): Merge git subtree at v2.29.2

This also bumps the stable nixpkgs to 20.09 as of 2020-11-21, because
there is some breakage in the git build related to the netrc
credentials helper which someone has taken care of in nixpkgs.

The stable channel is not used for anything other than git, so this
should be fine.

Change-Id: I3575a19dab09e1e9556cf8231d717de9890484fb
This commit is contained in:
Vincent Ambo 2020-11-21 19:20:35 +01:00
parent 082c006c04
commit f4609b896f
1485 changed files with 241535 additions and 109418 deletions

View file

@ -4,8 +4,8 @@
#include "commit.h"
#include "color.h"
#include "string-list.h"
#include "argv-array.h"
#include "sha1-array.h"
#include "strvec.h"
#include "oid-array.h"
/*----- some often used options -----*/
@ -105,6 +105,8 @@ int parse_opt_commit(const struct option *opt, const char *arg, int unset)
struct commit *commit;
struct commit **target = opt->value;
BUG_ON_OPT_NEG(unset);
if (!arg)
return -1;
if (get_oid(arg, &oid))
@ -159,39 +161,32 @@ int parse_opt_tertiary(const struct option *opt, const char *arg, int unset)
return 0;
}
struct option *parse_options_dup(const struct option *o)
static size_t parse_options_count(const struct option *opt)
{
struct option *opts;
int nr = 0;
size_t n = 0;
while (o && o->type != OPTION_END) {
nr++;
o++;
}
ALLOC_ARRAY(opts, nr + 1);
memcpy(opts, o - nr, sizeof(*o) * nr);
memset(opts + nr, 0, sizeof(*opts));
opts[nr].type = OPTION_END;
return opts;
for (; opt && opt->type != OPTION_END; opt++)
n++;
return n;
}
struct option *parse_options_concat(struct option *a, struct option *b)
struct option *parse_options_dup(const struct option *o)
{
struct option no_options[] = { OPT_END() };
return parse_options_concat(o, no_options);
}
struct option *parse_options_concat(const struct option *a,
const struct option *b)
{
struct option *ret;
size_t i, a_len = 0, b_len = 0;
for (i = 0; a[i].type != OPTION_END; i++)
a_len++;
for (i = 0; b[i].type != OPTION_END; i++)
b_len++;
size_t a_len = parse_options_count(a);
size_t b_len = parse_options_count(b);
ALLOC_ARRAY(ret, st_add3(a_len, b_len, 1));
for (i = 0; i < a_len; i++)
ret[i] = a[i];
for (i = 0; i < b_len; i++)
ret[a_len + i] = b[i];
ret[a_len + b_len] = b[b_len]; /* final OPTION_END */
COPY_ARRAY(ret, a, a_len);
COPY_ARRAY(ret + a_len, b, b_len + 1); /* + 1 for final OPTION_END */
return ret;
}
@ -282,19 +277,19 @@ int parse_opt_passthru(const struct option *opt, const char *arg, int unset)
/**
* For an option opt, recreate the command-line option, appending it to
* opt->value which must be a argv_array. This is useful when we need to pass
* opt->value which must be a strvec. This is useful when we need to pass
* the command-line option, which can be specified multiple times, to another
* command.
*/
int parse_opt_passthru_argv(const struct option *opt, const char *arg, int unset)
{
static struct strbuf sb = STRBUF_INIT;
struct argv_array *opt_value = opt->value;
struct strvec *opt_value = opt->value;
if (recreate_opt(&sb, opt, arg, unset) < 0)
return -1;
argv_array_push(opt_value, sb.buf);
strvec_push(opt_value, sb.buf);
return 0;
}