ls-remote: pass ref prefixes when requesting a remote's refs
Construct an argv_array of ref prefixes based on the patterns supplied via the command line and pass them to 'transport_get_remote_refs()' to be used when communicating protocol v2 so that the server can limit the ref advertisement based on those prefixes. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
1af8ae1cfa
commit
b4be74105f
14
refs.c
14
refs.c
@ -13,6 +13,7 @@
|
||||
#include "tag.h"
|
||||
#include "submodule.h"
|
||||
#include "worktree.h"
|
||||
#include "argv-array.h"
|
||||
|
||||
/*
|
||||
* List of all available backends
|
||||
@ -501,6 +502,19 @@ int refname_match(const char *abbrev_name, const char *full_name)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Given a 'prefix' expand it by the rules in 'ref_rev_parse_rules' and add
|
||||
* the results to 'prefixes'
|
||||
*/
|
||||
void expand_ref_prefix(struct argv_array *prefixes, const char *prefix)
|
||||
{
|
||||
const char **p;
|
||||
int len = strlen(prefix);
|
||||
|
||||
for (p = ref_rev_parse_rules; *p; p++)
|
||||
argv_array_pushf(prefixes, *p, len, prefix);
|
||||
}
|
||||
|
||||
/*
|
||||
* *string and *len will only be substituted, and *string returned (for
|
||||
* later free()ing) if the string passed in is a magic short-hand form
|
||||
|
Reference in New Issue
Block a user