Make git-unpack-objects a builtin
Signed-off-by: Matthias Kestenholz <matthias@spinlock.ch> Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:

committed by
Junio C Hamano

parent
5d4a600335
commit
6441363079
7
Makefile
7
Makefile
@ -182,7 +182,7 @@ PROGRAMS = \
|
|||||||
git-send-pack$X git-shell$X \
|
git-send-pack$X git-shell$X \
|
||||||
git-show-index$X git-ssh-fetch$X \
|
git-show-index$X git-ssh-fetch$X \
|
||||||
git-ssh-upload$X git-unpack-file$X \
|
git-ssh-upload$X git-unpack-file$X \
|
||||||
git-unpack-objects$X git-update-server-info$X \
|
git-update-server-info$X \
|
||||||
git-upload-pack$X git-verify-pack$X \
|
git-upload-pack$X git-verify-pack$X \
|
||||||
git-symbolic-ref$X \
|
git-symbolic-ref$X \
|
||||||
git-pack-redundant$X git-var$X \
|
git-pack-redundant$X git-var$X \
|
||||||
@ -198,7 +198,8 @@ BUILT_INS = git-log$X git-whatchanged$X git-show$X git-update-ref$X \
|
|||||||
git-apply$X git-show-branch$X git-diff-files$X git-update-index$X \
|
git-apply$X git-show-branch$X git-diff-files$X git-update-index$X \
|
||||||
git-diff-index$X git-diff-stages$X git-diff-tree$X git-cat-file$X \
|
git-diff-index$X git-diff-stages$X git-diff-tree$X git-cat-file$X \
|
||||||
git-fmt-merge-msg$X git-prune$X git-mv$X git-prune-packed$X \
|
git-fmt-merge-msg$X git-prune$X git-mv$X git-prune-packed$X \
|
||||||
git-repo-config$X git-name-rev$X git-pack-objects$X
|
git-repo-config$X git-name-rev$X git-pack-objects$X \
|
||||||
|
git-unpack-objects$X
|
||||||
|
|
||||||
# what 'all' will build and 'install' will install, in gitexecdir
|
# what 'all' will build and 'install' will install, in gitexecdir
|
||||||
ALL_PROGRAMS = $(PROGRAMS) $(SIMPLE_PROGRAMS) $(SCRIPTS)
|
ALL_PROGRAMS = $(PROGRAMS) $(SIMPLE_PROGRAMS) $(SCRIPTS)
|
||||||
@ -256,7 +257,7 @@ BUILTIN_OBJS = \
|
|||||||
builtin-cat-file.o builtin-mailsplit.o builtin-stripspace.o \
|
builtin-cat-file.o builtin-mailsplit.o builtin-stripspace.o \
|
||||||
builtin-update-ref.o builtin-fmt-merge-msg.o builtin-prune.o \
|
builtin-update-ref.o builtin-fmt-merge-msg.o builtin-prune.o \
|
||||||
builtin-mv.o builtin-prune-packed.o builtin-repo-config.o \
|
builtin-mv.o builtin-prune-packed.o builtin-repo-config.o \
|
||||||
builtin-name-rev.o builtin-pack-objects.o
|
builtin-name-rev.o builtin-pack-objects.o builtin-unpack-objects.o
|
||||||
|
|
||||||
GITLIBS = $(LIB_FILE) $(XDIFF_LIB)
|
GITLIBS = $(LIB_FILE) $(XDIFF_LIB)
|
||||||
LIBS = $(GITLIBS) -lz
|
LIBS = $(GITLIBS) -lz
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#include "builtin.h"
|
||||||
#include "cache.h"
|
#include "cache.h"
|
||||||
#include "object.h"
|
#include "object.h"
|
||||||
#include "delta.h"
|
#include "delta.h"
|
||||||
@ -112,7 +113,7 @@ static void write_object(void *buf, unsigned long size, const char *type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int resolve_delta(const char *type,
|
static int resolve_delta(const char *type,
|
||||||
void *base, unsigned long base_size,
|
void *base, unsigned long base_size,
|
||||||
void *delta, unsigned long delta_size)
|
void *delta, unsigned long delta_size)
|
||||||
{
|
{
|
||||||
void *result;
|
void *result;
|
||||||
@ -260,13 +261,11 @@ static void unpack_all(void)
|
|||||||
die("unresolved deltas left after unpacking");
|
die("unresolved deltas left after unpacking");
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int cmd_unpack_objects(int argc, const char **argv, const char *prefix)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
unsigned char sha1[20];
|
unsigned char sha1[20];
|
||||||
|
|
||||||
setup_git_directory();
|
|
||||||
|
|
||||||
quiet = !isatty(2);
|
quiet = !isatty(2);
|
||||||
|
|
||||||
for (i = 1 ; i < argc; i++) {
|
for (i = 1 ; i < argc; i++) {
|
@ -51,6 +51,7 @@ extern int cmd_mv(int argc, const char **argv, const char *prefix);
|
|||||||
extern int cmd_repo_config(int argc, const char **argv, const char *prefix);
|
extern int cmd_repo_config(int argc, const char **argv, const char *prefix);
|
||||||
extern int cmd_name_rev(int argc, const char **argv, const char *prefix);
|
extern int cmd_name_rev(int argc, const char **argv, const char *prefix);
|
||||||
extern int cmd_pack_objects(int argc, const char **argv, const char *prefix);
|
extern int cmd_pack_objects(int argc, const char **argv, const char *prefix);
|
||||||
|
extern int cmd_unpack_objects(int argc, const char **argv, const char *prefix);
|
||||||
|
|
||||||
extern int cmd_write_tree(int argc, const char **argv, const char *prefix);
|
extern int cmd_write_tree(int argc, const char **argv, const char *prefix);
|
||||||
extern int write_tree(unsigned char *sha1, int missing_ok, const char *prefix);
|
extern int write_tree(unsigned char *sha1, int missing_ok, const char *prefix);
|
||||||
|
1
git.c
1
git.c
@ -267,6 +267,7 @@ static void handle_internal_command(int argc, const char **argv, char **envp)
|
|||||||
{ "repo-config", cmd_repo_config },
|
{ "repo-config", cmd_repo_config },
|
||||||
{ "name-rev", cmd_name_rev, NEEDS_PREFIX },
|
{ "name-rev", cmd_name_rev, NEEDS_PREFIX },
|
||||||
{ "pack-objects", cmd_pack_objects, NEEDS_PREFIX },
|
{ "pack-objects", cmd_pack_objects, NEEDS_PREFIX },
|
||||||
|
{ "unpack-objects", cmd_unpack_objects, NEEDS_PREFIX },
|
||||||
};
|
};
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user