-
Notifications
You must be signed in to change notification settings - Fork 25.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'ds/maintenance-prefetch-fix' into seen
The prefetch task in "git maintenance" assumed that "git fetch" from any remote would fetch all its local branches, which would fetch too much if the user is interested in only a subset of branches there. * ds/maintenance-prefetch-fix: maintenance: allow custom refspecs during prefetch test-tool: test refspec input/output refspec: output a refspec item test-lib: use exact match for test_subcommand maintenance: simplify prefetch logic
- Loading branch information
Showing
11 changed files
with
195 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#include "cache.h" | ||
#include "parse-options.h" | ||
#include "refspec.h" | ||
#include "strbuf.h" | ||
#include "test-tool.h" | ||
|
||
static const char * const refspec_usage[] = { | ||
N_("test-tool refspec [--fetch]"), | ||
NULL | ||
}; | ||
|
||
int cmd__refspec(int argc, const char **argv) | ||
{ | ||
struct strbuf line = STRBUF_INIT; | ||
int fetch = 0; | ||
|
||
struct option refspec_options [] = { | ||
OPT_BOOL(0, "fetch", &fetch, | ||
N_("enable the 'fetch' option for parsing refpecs")), | ||
OPT_END() | ||
}; | ||
|
||
argc = parse_options(argc, argv, NULL, refspec_options, | ||
refspec_usage, 0); | ||
|
||
while (strbuf_getline(&line, stdin) != EOF) { | ||
struct refspec_item rsi; | ||
char *buf; | ||
|
||
if (!refspec_item_init(&rsi, line.buf, fetch)) { | ||
printf("failed to parse %s\n", line.buf); | ||
continue; | ||
} | ||
|
||
buf = refspec_item_format(&rsi); | ||
printf("%s\n", buf); | ||
free(buf); | ||
|
||
refspec_item_clear(&rsi); | ||
} | ||
|
||
strbuf_release(&line); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters