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

Make git-name-rev 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 d6b64ed0f3549f56c4d948dc2c0f12abc52fd6c9
4 files changed +8 -5
Makefile
+4 -3
@@ -185,7 +185,7 @@ PROGRAMS = \
185 git-unpack-objects$X git-update-server-info$X \
186 git-upload-pack$X git-verify-pack$X \
187 git-symbolic-ref$X \
188 - git-name-rev$X git-pack-redundant$X git-var$X \
188 + git-pack-redundant$X git-var$X \
189 git-describe$X git-merge-tree$X git-blame$X git-imap-send$X
190
191 BUILT_INS = git-log$X git-whatchanged$X git-show$X git-update-ref$X \
@@ -198,7 +198,7 @@ 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
201 + git-repo-config$X git-name-rev$X
202
203 # what 'all' will build and 'install' will install, in gitexecdir
204 ALL_PROGRAMS = $(PROGRAMS) $(SIMPLE_PROGRAMS) $(SCRIPTS)
@@ -255,7 +255,8 @@ BUILTIN_OBJS = \
255 builtin-diff-index.o builtin-diff-stages.o builtin-diff-tree.o \
256 builtin-cat-file.o builtin-mailsplit.o builtin-stripspace.o \
257 builtin-update-ref.o builtin-fmt-merge-msg.o builtin-prune.o \
258 - builtin-mv.o builtin-prune-packed.o builtin-repo-config.o
258 + builtin-mv.o builtin-prune-packed.o builtin-repo-config.o \
259 + builtin-name-rev.o
260
261 GITLIBS = $(LIB_FILE) $(XDIFF_LIB)
262 LIBS = $(GITLIBS) -lz
builtin-name-rev.c renamed
+2 -2
@@ -1,4 +1,5 @@
1 #include <stdlib.h>
2 +#include "builtin.h"
3 #include "cache.h"
4 #include "commit.h"
5 #include "tag.h"
@@ -126,12 +127,11 @@ static const char* get_rev_name(struct object *o)
127 return buffer;
128 }
129
129 -int main(int argc, char **argv)
130 +int cmd_name_rev(int argc, const char **argv, const char *prefix)
131 {
132 struct object_array revs = { 0, 0, NULL };
133 int as_is = 0, all = 0, transform_stdin = 0;
134
134 - setup_git_directory();
135 git_config(git_default_config);
136
137 if (argc < 2)
builtin.h
+1
@@ -49,6 +49,7 @@ extern int cmd_update_ref(int argc, const char **argv, const char *prefix);
49 extern int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix);
50 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
54 extern int cmd_write_tree(int argc, const char **argv, const char *prefix);
55 extern int write_tree(unsigned char *sha1, int missing_ok, const char *prefix);
git.c
+1
@@ -265,6 +265,7 @@ static void handle_internal_command(int argc, const char **argv, char **envp)
265 { "mv", cmd_mv, NEEDS_PREFIX },
266 { "prune-packed", cmd_prune_packed, NEEDS_PREFIX },
267 { "repo-config", cmd_repo_config },
268 + { "name-rev", cmd_name_rev, NEEDS_PREFIX },
269 };
270 int i;
271