mirror of
git://git.9front.org/plan9front/plan9front
synced 2025-01-12 11:10:06 +00:00
git/query: allow arbitrary length queries
This commit is contained in:
parent
eacf9fbbee
commit
9b144a94e2
1 changed files with 11 additions and 10 deletions
|
@ -152,8 +152,8 @@ usage(void)
|
|||
void
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
char query[2048], repo[512];
|
||||
char *p, *e, *s, *objpfx;
|
||||
char *query, repo[512];
|
||||
char *p, *e, *objpfx;
|
||||
int i, j, n, nrel;
|
||||
Hash *h;
|
||||
|
||||
|
@ -176,15 +176,16 @@ main(int argc, char **argv)
|
|||
sysfatal("chdir: %r");
|
||||
if((objpfx = smprint("%s/.git/fs/object/", repo)) == nil)
|
||||
sysfatal("smprint: %r");
|
||||
s = "";
|
||||
for(i = 0, n = 0; i < argc; i++)
|
||||
n += strlen(argv[i]) + 1;
|
||||
query = emalloc(n+1);
|
||||
p = query;
|
||||
e = query + nelem(query);
|
||||
for(i = 0; i < argc; i++){
|
||||
if((p = seprint(p, e, "%s%s", s, argv[i])) == nil)
|
||||
sysfatal("query too long");
|
||||
s = " ";
|
||||
}
|
||||
if((n = resolverefs(&h, query)) == -1)
|
||||
e = query + n;
|
||||
for(i = 0; i < argc; i++)
|
||||
p = seprint(p, e, "%s ", argv[i]);
|
||||
n = resolverefs(&h, query);
|
||||
free(query);
|
||||
if(n == -1)
|
||||
sysfatal("resolve: %r");
|
||||
if(changes){
|
||||
for(i = 1; i < n; i++)
|
||||
|
|
Loading…
Reference in a new issue