@matheusbsbs / matheus-bagliano / commits / 6441363079
Fork 0

Make git-unpack-objects a builtin

Signed-off-by: Matthias Kestenholz <matthias@spinlock.ch> Signed-off-by: Junio C Hamano <junkio@cox.net>

Matthias Kestenholz committed Aug 3, 2006 at 17:24 UTC 6441363079d85cf17aee21b8925e9745c8abda16
4 files changed +9 -7
Makefile
+4 -3
@@ -182,7 +182,7 @@ PROGRAMS = \
182 git-send-pack$X git-shell$X \
183 git-show-index$X git-ssh-fetch$X \
184 git-ssh-upload$X git-unpack-file$X \
185 - git-unpack-objects$X git-update-server-info$X \
185 + git-update-server-info$X \
186 git-upload-pack$X git-verify-pack$X \
187 git-symbolic-ref$X \
188 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 \
198 git-apply$X git-show-branch$X git-diff-files$X git-update-index$X \
199 git-diff-index$X git-diff-stages$X git-diff-tree$X git-cat-file$X \
200 git-fmt-merge-msg$X git-prune$X git-mv$X git-prune-packed$X \
201 - git-repo-config$X git-name-rev$X git-pack-objects$X
201 + git-repo-config$X git-name-rev$X git-pack-objects$X \
202 + git-unpack-objects$X
203
204 # what 'all' will build and 'install' will install, in gitexecdir
205 ALL_PROGRAMS = $(PROGRAMS) $(SIMPLE_PROGRAMS) $(SCRIPTS)
@@ -256,7 +257,7 @@ BUILTIN_OBJS = \
257 builtin-cat-file.o builtin-mailsplit.o builtin-stripspace.o \
258 builtin-update-ref.o builtin-fmt-merge-msg.o builtin-prune.o \
259 builtin-mv.o builtin-prune-packed.o builtin-repo-config.o \
259 - builtin-name-rev.o builtin-pack-objects.o
260 + builtin-name-rev.o builtin-pack-objects.o builtin-unpack-objects.o
261
262 GITLIBS = $(LIB_FILE) $(XDIFF_LIB)
263 LIBS = $(GITLIBS) -lz
builtin-unpack-objects.c renamed
+3 -4
@@ -1,3 +1,4 @@
1 +#include "builtin.h"
2 #include "cache.h"
3 #include "object.h"
4 #include "delta.h"
@@ -112,7 +113,7 @@ static void write_object(void *buf, unsigned long size, const char *type)
113 }
114
115 static int resolve_delta(const char *type,
115 - void *base, unsigned long base_size,
116 + void *base, unsigned long base_size,
117 void *delta, unsigned long delta_size)
118 {
119 void *result;
@@ -260,13 +261,11 @@ static void unpack_all(void)
261 die("unresolved deltas left after unpacking");
262 }
263
263 -int main(int argc, char **argv)
264 +int cmd_unpack_objects(int argc, const char **argv, const char *prefix)
265 {
266 int i;
267 unsigned char sha1[20];
268
268 - setup_git_directory();
269 -
269 quiet = !isatty(2);
270
271 for (i = 1 ; i < argc; i++) {
builtin.h
+1
@@ -51,6 +51,7 @@ extern int cmd_mv(int argc, const char **argv, const char *prefix);
51 extern int cmd_repo_config(int argc, const char **argv, const char *prefix);
52 extern int cmd_name_rev(int argc, const char **argv, const char *prefix);
53 extern int cmd_pack_objects(int argc, const char **argv, const char *prefix);
54 +extern int cmd_unpack_objects(int argc, const char **argv, const char *prefix);
55
56 extern int cmd_write_tree(int argc, const char **argv, const char *prefix);
57 extern int write_tree(unsigned char *sha1, int missing_ok, const char *prefix);
git.c
+1
@@ -267,6 +267,7 @@ static void handle_internal_command(int argc, const char **argv, char **envp)
267 { "repo-config", cmd_repo_config },
268 { "name-rev", cmd_name_rev, NEEDS_PREFIX },
269 { "pack-objects", cmd_pack_objects, NEEDS_PREFIX },
270 + { "unpack-objects", cmd_unpack_objects, NEEDS_PREFIX },
271 };
272 int i;
273