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:
parent
082c006c04
commit
f4609b896f
1485 changed files with 241535 additions and 109418 deletions
40
third_party/git/trailer.c
vendored
40
third_party/git/trailer.c
vendored
|
|
@ -221,15 +221,13 @@ static char *apply_command(const char *command, const char *arg)
|
|||
struct strbuf cmd = STRBUF_INIT;
|
||||
struct strbuf buf = STRBUF_INIT;
|
||||
struct child_process cp = CHILD_PROCESS_INIT;
|
||||
const char *argv[] = {NULL, NULL};
|
||||
char *result;
|
||||
|
||||
strbuf_addstr(&cmd, command);
|
||||
if (arg)
|
||||
strbuf_replace(&cmd, TRAILER_ARG_STRING, arg);
|
||||
|
||||
argv[0] = cmd.buf;
|
||||
cp.argv = argv;
|
||||
strvec_push(&cp.args, cmd.buf);
|
||||
cp.env = local_repo_env;
|
||||
cp.no_stdin = 1;
|
||||
cp.use_shell = 1;
|
||||
|
|
@ -1185,3 +1183,39 @@ void format_trailers_from_commit(struct strbuf *out, const char *msg,
|
|||
format_trailer_info(out, &info, opts);
|
||||
trailer_info_release(&info);
|
||||
}
|
||||
|
||||
void trailer_iterator_init(struct trailer_iterator *iter, const char *msg)
|
||||
{
|
||||
struct process_trailer_options opts = PROCESS_TRAILER_OPTIONS_INIT;
|
||||
strbuf_init(&iter->key, 0);
|
||||
strbuf_init(&iter->val, 0);
|
||||
opts.no_divider = 1;
|
||||
trailer_info_get(&iter->info, msg, &opts);
|
||||
iter->cur = 0;
|
||||
}
|
||||
|
||||
int trailer_iterator_advance(struct trailer_iterator *iter)
|
||||
{
|
||||
while (iter->cur < iter->info.trailer_nr) {
|
||||
char *trailer = iter->info.trailers[iter->cur++];
|
||||
int separator_pos = find_separator(trailer, separators);
|
||||
|
||||
if (separator_pos < 1)
|
||||
continue; /* not a real trailer */
|
||||
|
||||
strbuf_reset(&iter->key);
|
||||
strbuf_reset(&iter->val);
|
||||
parse_trailer(&iter->key, &iter->val, NULL,
|
||||
trailer, separator_pos);
|
||||
unfold_value(&iter->val);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void trailer_iterator_release(struct trailer_iterator *iter)
|
||||
{
|
||||
trailer_info_release(&iter->info);
|
||||
strbuf_release(&iter->val);
|
||||
strbuf_release(&iter->key);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue