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
23
third_party/git/ls-refs.c
vendored
23
third_party/git/ls-refs.c
vendored
|
|
@ -2,7 +2,7 @@
|
|||
#include "repository.h"
|
||||
#include "refs.h"
|
||||
#include "remote.h"
|
||||
#include "argv-array.h"
|
||||
#include "strvec.h"
|
||||
#include "ls-refs.h"
|
||||
#include "pkt-line.h"
|
||||
#include "config.h"
|
||||
|
|
@ -11,15 +11,15 @@
|
|||
* Check if one of the prefixes is a prefix of the ref.
|
||||
* If no prefixes were provided, all refs match.
|
||||
*/
|
||||
static int ref_match(const struct argv_array *prefixes, const char *refname)
|
||||
static int ref_match(const struct strvec *prefixes, const char *refname)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!prefixes->argc)
|
||||
if (!prefixes->nr)
|
||||
return 1; /* no restriction */
|
||||
|
||||
for (i = 0; i < prefixes->argc; i++) {
|
||||
const char *prefix = prefixes->argv[i];
|
||||
for (i = 0; i < prefixes->nr; i++) {
|
||||
const char *prefix = prefixes->v[i];
|
||||
|
||||
if (starts_with(refname, prefix))
|
||||
return 1;
|
||||
|
|
@ -31,7 +31,7 @@ static int ref_match(const struct argv_array *prefixes, const char *refname)
|
|||
struct ls_refs_data {
|
||||
unsigned peel;
|
||||
unsigned symrefs;
|
||||
struct argv_array prefixes;
|
||||
struct strvec prefixes;
|
||||
};
|
||||
|
||||
static int send_ref(const char *refname, const struct object_id *oid,
|
||||
|
|
@ -84,7 +84,7 @@ static int ls_refs_config(const char *var, const char *value, void *data)
|
|||
return parse_hide_refs_config(var, value, "uploadpack");
|
||||
}
|
||||
|
||||
int ls_refs(struct repository *r, struct argv_array *keys,
|
||||
int ls_refs(struct repository *r, struct strvec *keys,
|
||||
struct packet_reader *request)
|
||||
{
|
||||
struct ls_refs_data data;
|
||||
|
|
@ -93,7 +93,7 @@ int ls_refs(struct repository *r, struct argv_array *keys,
|
|||
|
||||
git_config(ls_refs_config, NULL);
|
||||
|
||||
while (packet_reader_read(request) != PACKET_READ_FLUSH) {
|
||||
while (packet_reader_read(request) == PACKET_READ_NORMAL) {
|
||||
const char *arg = request->line;
|
||||
const char *out;
|
||||
|
||||
|
|
@ -102,12 +102,15 @@ int ls_refs(struct repository *r, struct argv_array *keys,
|
|||
else if (!strcmp("symrefs", arg))
|
||||
data.symrefs = 1;
|
||||
else if (skip_prefix(arg, "ref-prefix ", &out))
|
||||
argv_array_push(&data.prefixes, out);
|
||||
strvec_push(&data.prefixes, out);
|
||||
}
|
||||
|
||||
if (request->status != PACKET_READ_FLUSH)
|
||||
die(_("expected flush after ls-refs arguments"));
|
||||
|
||||
head_ref_namespaced(send_ref, &data);
|
||||
for_each_namespaced_ref(send_ref, &data);
|
||||
packet_flush(1);
|
||||
argv_array_clear(&data.prefixes);
|
||||
strvec_clear(&data.prefixes);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue