зеркало из https://github.com/microsoft/git.git
test-mergesort: add sort subcommand
Give the code for sorting a text file its own sub-command. This allows extending the helper, which we'll do in the following patches. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
2e6701017e
Коммит
d536a71169
|
@ -23,7 +23,7 @@ static int compare_strings(const void *a, const void *b)
|
|||
return strcmp(x->text, y->text);
|
||||
}
|
||||
|
||||
int cmd__mergesort(int argc, const char **argv)
|
||||
static int sort_stdin(void)
|
||||
{
|
||||
struct line *line, *p = NULL, *lines = NULL;
|
||||
struct strbuf sb = STRBUF_INIT;
|
||||
|
@ -49,3 +49,10 @@ int cmd__mergesort(int argc, const char **argv)
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cmd__mergesort(int argc, const char **argv)
|
||||
{
|
||||
if (argc == 2 && !strcmp(argv[1], "sort"))
|
||||
return sort_stdin();
|
||||
usage("test-tool mergesort sort");
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче