зеркало из https://github.com/microsoft/git.git
multi-pack-index: add 'write' verb
In anticipation of writing multi-pack-indexes, add a skeleton 'git multi-pack-index write' subcommand and send the options to a write_midx_file() method. Also create a skeleton test script that tests the 'write' subcommand. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
6a257f03ba
Коммит
a340773026
|
@ -9,7 +9,7 @@ git-multi-pack-index - Write and verify multi-pack-indexes
|
|||
SYNOPSIS
|
||||
--------
|
||||
[verse]
|
||||
'git multi-pack-index' [--object-dir=<dir>]
|
||||
'git multi-pack-index' [--object-dir=<dir>] <verb>
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
@ -23,6 +23,26 @@ OPTIONS
|
|||
`<dir>/packs/multi-pack-index` for the current MIDX file, and
|
||||
`<dir>/packs` for the pack-files to index.
|
||||
|
||||
write::
|
||||
When given as the verb, write a new MIDX file to
|
||||
`<dir>/packs/multi-pack-index`.
|
||||
|
||||
|
||||
EXAMPLES
|
||||
--------
|
||||
|
||||
* Write a MIDX file for the packfiles in the current .git folder.
|
||||
+
|
||||
-----------------------------------------------
|
||||
$ git multi-pack-index write
|
||||
-----------------------------------------------
|
||||
|
||||
* Write a MIDX file for the packfiles in an alternate object store.
|
||||
+
|
||||
-----------------------------------------------
|
||||
$ git multi-pack-index --object-dir <alt> write
|
||||
-----------------------------------------------
|
||||
|
||||
|
||||
SEE ALSO
|
||||
--------
|
||||
|
|
1
Makefile
1
Makefile
|
@ -890,6 +890,7 @@ LIB_OBJS += merge.o
|
|||
LIB_OBJS += merge-blobs.o
|
||||
LIB_OBJS += merge-recursive.o
|
||||
LIB_OBJS += mergesort.o
|
||||
LIB_OBJS += midx.o
|
||||
LIB_OBJS += name-hash.o
|
||||
LIB_OBJS += notes.o
|
||||
LIB_OBJS += notes-cache.o
|
||||
|
|
|
@ -2,9 +2,10 @@
|
|||
#include "cache.h"
|
||||
#include "config.h"
|
||||
#include "parse-options.h"
|
||||
#include "midx.h"
|
||||
|
||||
static char const * const builtin_multi_pack_index_usage[] = {
|
||||
N_("git multi-pack-index [--object-dir=<dir>]"),
|
||||
N_("git multi-pack-index [--object-dir=<dir>] write"),
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@ -30,5 +31,17 @@ int cmd_multi_pack_index(int argc, const char **argv,
|
|||
if (!opts.object_dir)
|
||||
opts.object_dir = get_object_directory();
|
||||
|
||||
return 0;
|
||||
if (argc == 0)
|
||||
goto usage;
|
||||
|
||||
if (!strcmp(argv[0], "write")) {
|
||||
if (argc > 1)
|
||||
goto usage;
|
||||
|
||||
return write_midx_file(opts.object_dir);
|
||||
}
|
||||
|
||||
usage:
|
||||
usage_with_options(builtin_multi_pack_index_usage,
|
||||
builtin_multi_pack_index_options);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
#include "cache.h"
|
||||
#include "midx.h"
|
||||
|
||||
int write_midx_file(const char *object_dir)
|
||||
{
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
#ifndef __MIDX_H__
|
||||
#define __MIDX_H__
|
||||
|
||||
int write_midx_file(const char *object_dir);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,10 @@
|
|||
#!/bin/sh
|
||||
|
||||
test_description='multi-pack-indexes'
|
||||
. ./test-lib.sh
|
||||
|
||||
test_expect_success 'write midx with no packs' '
|
||||
git multi-pack-index --object-dir=. write
|
||||
'
|
||||
|
||||
test_done
|
Загрузка…
Ссылка в новой задаче