зеркало из https://github.com/microsoft/git.git
Merge branch 'zh/cat-file-batch-fix' into zh/ref-filter-raw-data
* zh/cat-file-batch-fix: cat-file: merge two block into one cat-file: handle trivial --batch format with --batch-all-objects
This commit is contained in:
Коммит
bff9703f0a
|
@ -512,12 +512,6 @@ static int batch_objects(struct batch_options *opt)
|
|||
if (opt->cmdmode)
|
||||
data.split_on_whitespace = 1;
|
||||
|
||||
if (opt->all_objects) {
|
||||
struct object_info empty = OBJECT_INFO_INIT;
|
||||
if (!memcmp(&data.info, &empty, sizeof(empty)))
|
||||
data.skip_object_info = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* If we are printing out the object, then always fill in the type,
|
||||
* since we will want to decide whether or not to stream.
|
||||
|
@ -527,6 +521,10 @@ static int batch_objects(struct batch_options *opt)
|
|||
|
||||
if (opt->all_objects) {
|
||||
struct object_cb_data cb;
|
||||
struct object_info empty = OBJECT_INFO_INIT;
|
||||
|
||||
if (!memcmp(&data.info, &empty, sizeof(empty)))
|
||||
data.skip_object_info = 1;
|
||||
|
||||
if (has_promisor_remote())
|
||||
warning("This repository uses promisor remotes. Some objects may not be loaded.");
|
||||
|
|
|
@ -586,4 +586,26 @@ test_expect_success 'cat-file --unordered works' '
|
|||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'set up object list for --batch-all-objects tests' '
|
||||
git -C all-two cat-file --batch-all-objects --batch-check="%(objectname)" >objects
|
||||
'
|
||||
|
||||
test_expect_success 'cat-file --batch="%(objectname)" with --batch-all-objects will work' '
|
||||
git -C all-two cat-file --batch="%(objectname)" <objects >expect &&
|
||||
git -C all-two cat-file --batch-all-objects --batch="%(objectname)" >actual &&
|
||||
cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'cat-file --batch="%(rest)" with --batch-all-objects will work' '
|
||||
git -C all-two cat-file --batch="%(rest)" <objects >expect &&
|
||||
git -C all-two cat-file --batch-all-objects --batch="%(rest)" >actual &&
|
||||
cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'cat-file --batch="batman" with --batch-all-objects will work' '
|
||||
git -C all-two cat-file --batch="batman" <objects >expect &&
|
||||
git -C all-two cat-file --batch-all-objects --batch="batman" >actual &&
|
||||
cmp expect actual
|
||||
'
|
||||
|
||||
test_done
|
||||
|
|
Загрузка…
Ссылка в новой задаче