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

Builtin git-apply.

Signed-off-by: Peter Eriksen <s022018@student.dtu.dk> Signed-off-by: Junio C Hamano <junkio@cox.net>

Peter Eriksen committed May 23, 2006 at 14:15 UTC ac6245e31a359200b65bfdd910bba9a0fbe90c11
4 files changed +10 -5
Makefile
+5 -3
@@ -149,7 +149,7 @@ SIMPLE_PROGRAMS = \
149
150 # ... and all the rest that could be moved out of bindir to gitexecdir
151 PROGRAMS = \
152 - git-apply$X git-cat-file$X \
152 + git-cat-file$X \
153 git-checkout-index$X git-clone-pack$X \
154 git-convert-objects$X git-diff-files$X \
155 git-diff-index$X git-diff-stages$X \
@@ -172,7 +172,8 @@ BUILT_INS = git-log$X git-whatchanged$X git-show$X \
172 git-count-objects$X git-diff$X git-push$X \
173 git-grep$X git-rev-list$X git-check-ref-format$X \
174 git-init-db$X git-ls-files$X git-ls-tree$X \
175 - git-tar-tree$X git-read-tree$X git-commit-tree$X
175 + git-tar-tree$X git-read-tree$X git-commit-tree$X \
176 + git-apply$X
177
178 # what 'all' will build and 'install' will install, in gitexecdir
179 ALL_PROGRAMS = $(PROGRAMS) $(SIMPLE_PROGRAMS) $(SCRIPTS)
@@ -222,7 +223,8 @@ BUILTIN_OBJS = \
223 builtin-log.o builtin-help.o builtin-count.o builtin-diff.o builtin-push.o \
224 builtin-grep.o builtin-rev-list.o builtin-check-ref-format.o \
225 builtin-init-db.o builtin-ls-files.o builtin-ls-tree.o \
225 - builtin-tar-tree.o builtin-read-tree.o builtin-commit-tree.o
226 + builtin-tar-tree.o builtin-read-tree.o builtin-commit-tree.o \
227 + builtin-apply.o
228
229 GITLIBS = $(LIB_FILE) $(XDIFF_LIB)
230 LIBS = $(GITLIBS) -lz
builtin-apply.c renamed
+2 -1
@@ -11,6 +11,7 @@
11 #include "quote.h"
12 #include "blob.h"
13 #include "delta.h"
14 +#include "builtin.h"
15
16 // --check turns on checking that the working tree matches the
17 // files that are being modified, but doesn't apply the patch
@@ -2151,7 +2152,7 @@ static int git_apply_config(const char *var, const char *value)
2152 }
2153
2154
2154 -int main(int argc, char **argv)
2155 +int cmd_apply(int argc, const char **argv, char **envp)
2156 {
2157 int i;
2158 int read_stdin = 1;
builtin.h
+1
@@ -32,5 +32,6 @@ extern int cmd_ls_tree(int argc, const char **argv, char **envp);
32 extern int cmd_tar_tree(int argc, const char **argv, char **envp);
33 extern int cmd_read_tree(int argc, const char **argv, char **envp);
34 extern int cmd_commit_tree(int argc, const char **argv, char **envp);
35 +extern int cmd_apply(int argc, const char **argv, char **envp);
36
37 #endif
git.c
+2 -1
@@ -57,7 +57,8 @@ static void handle_internal_command(int argc, const char **argv, char **envp)
57 { "ls-tree", cmd_ls_tree },
58 { "tar-tree", cmd_tar_tree },
59 { "read-tree", cmd_read_tree },
60 - { "commit-tree", cmd_commit_tree }
60 + { "commit-tree", cmd_commit_tree },
61 + { "apply", cmd_apply }
62 };
63 int i;
64