From 895f10c3b596ef955c7f252717e5b4668530c569 Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Sat, 3 Jun 2006 18:45:43 +0200 Subject: [PATCH] Builtin git-rev-parse. Signed-off-by: Christian Couder Signed-off-by: Junio C Hamano --- Makefile | 7 +++---- rev-parse.c => builtin-rev-parse.c | 3 ++- builtin.h | 1 + git.c | 3 ++- 4 files changed, 8 insertions(+), 6 deletions(-) rename rev-parse.c => builtin-rev-parse.c (98%) diff --git a/Makefile b/Makefile index b6fce394e9..004c2169c9 100644 --- a/Makefile +++ b/Makefile @@ -154,8 +154,7 @@ PROGRAMS = \ git-hash-object$X git-index-pack$X git-local-fetch$X \ git-mailinfo$X git-merge-base$X \ git-merge-index$X git-mktag$X git-mktree$X git-pack-objects$X git-patch-id$X \ - git-peek-remote$X git-prune-packed$X \ - git-receive-pack$X git-rev-parse$X \ + git-peek-remote$X git-prune-packed$X git-receive-pack$X \ git-send-pack$X git-shell$X \ git-show-index$X git-ssh-fetch$X \ git-ssh-upload$X git-unpack-file$X \ @@ -168,7 +167,7 @@ PROGRAMS = \ BUILT_INS = git-log$X git-whatchanged$X git-show$X \ git-count-objects$X git-diff$X git-push$X \ git-grep$X git-add$X git-rm$X git-rev-list$X \ - git-check-ref-format$X \ + git-check-ref-format$X git-rev-parse$X \ git-init-db$X git-tar-tree$X git-upload-tar$X git-format-patch$X \ git-ls-files$X git-ls-tree$X \ git-read-tree$X git-commit-tree$X \ @@ -222,7 +221,7 @@ LIB_OBJS = \ BUILTIN_OBJS = \ builtin-log.o builtin-help.o builtin-count.o builtin-diff.o builtin-push.o \ builtin-grep.o builtin-add.o builtin-rev-list.o builtin-check-ref-format.o \ - builtin-rm.o builtin-init-db.o \ + builtin-rm.o builtin-init-db.o builtin-rev-parse.o \ builtin-tar-tree.o builtin-upload-tar.o \ builtin-ls-files.o builtin-ls-tree.o \ builtin-read-tree.o builtin-commit-tree.o \ diff --git a/rev-parse.c b/builtin-rev-parse.c similarity index 98% rename from rev-parse.c rename to builtin-rev-parse.c index 4e2d9fbdf6..c353a481b0 100644 --- a/rev-parse.c +++ b/builtin-rev-parse.c @@ -7,6 +7,7 @@ #include "commit.h" #include "refs.h" #include "quote.h" +#include "builtin.h" #define DO_REVS 1 #define DO_NOREV 2 @@ -163,7 +164,7 @@ static int show_file(const char *arg) return 0; } -int main(int argc, char **argv) +int cmd_rev_parse(int argc, const char **argv, char **envp) { int i, as_is = 0, verify = 0; unsigned char sha1[20]; diff --git a/builtin.h b/builtin.h index 738ec3d945..ffa9340c37 100644 --- a/builtin.h +++ b/builtin.h @@ -43,5 +43,6 @@ extern int cmd_diff_index(int argc, const char **argv, char **envp); extern int cmd_diff_stages(int argc, const char **argv, char **envp); extern int cmd_diff_tree(int argc, const char **argv, char **envp); extern int cmd_cat_file(int argc, const char **argv, char **envp); +extern int cmd_rev_parse(int argc, const char **argv, char **envp); #endif diff --git a/git.c b/git.c index 10ea934bcf..bc463c98ea 100644 --- a/git.c +++ b/git.c @@ -69,7 +69,8 @@ static void handle_internal_command(int argc, const char **argv, char **envp) { "diff-index", cmd_diff_index }, { "diff-stages", cmd_diff_stages }, { "diff-tree", cmd_diff_tree }, - { "cat-file", cmd_cat_file } + { "cat-file", cmd_cat_file }, + { "rev-parse", cmd_rev_parse } }; int i; -- 2.11.4.GIT