Browse Source

Builtin git-rev-parse.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
maint
Christian Couder 19 years ago committed by Junio C Hamano
parent
commit
895f10c3b5
  1. 7
      Makefile
  2. 3
      builtin-rev-parse.c
  3. 1
      builtin.h
  4. 3
      git.c

7
Makefile

@ -154,8 +154,7 @@ PROGRAMS = \
git-hash-object$X git-index-pack$X git-local-fetch$X \ git-hash-object$X git-index-pack$X git-local-fetch$X \
git-mailinfo$X git-merge-base$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-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-peek-remote$X git-prune-packed$X git-receive-pack$X \
git-receive-pack$X git-rev-parse$X \
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 \
@ -168,7 +167,7 @@ PROGRAMS = \
BUILT_INS = git-log$X git-whatchanged$X git-show$X \ BUILT_INS = git-log$X git-whatchanged$X git-show$X \
git-count-objects$X git-diff$X git-push$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-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-init-db$X git-tar-tree$X git-upload-tar$X git-format-patch$X \
git-ls-files$X git-ls-tree$X \ git-ls-files$X git-ls-tree$X \
git-read-tree$X git-commit-tree$X \ git-read-tree$X git-commit-tree$X \
@ -222,7 +221,7 @@ LIB_OBJS = \
BUILTIN_OBJS = \ BUILTIN_OBJS = \
builtin-log.o builtin-help.o builtin-count.o builtin-diff.o builtin-push.o \ 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-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-tar-tree.o builtin-upload-tar.o \
builtin-ls-files.o builtin-ls-tree.o \ builtin-ls-files.o builtin-ls-tree.o \
builtin-read-tree.o builtin-commit-tree.o \ builtin-read-tree.o builtin-commit-tree.o \

3
rev-parse.c → builtin-rev-parse.c

@ -7,6 +7,7 @@
#include "commit.h" #include "commit.h"
#include "refs.h" #include "refs.h"
#include "quote.h" #include "quote.h"
#include "builtin.h"


#define DO_REVS 1 #define DO_REVS 1
#define DO_NOREV 2 #define DO_NOREV 2
@ -163,7 +164,7 @@ static int show_file(const char *arg)
return 0; 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; int i, as_is = 0, verify = 0;
unsigned char sha1[20]; unsigned char sha1[20];

1
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_stages(int argc, const char **argv, char **envp);
extern int cmd_diff_tree(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_cat_file(int argc, const char **argv, char **envp);
extern int cmd_rev_parse(int argc, const char **argv, char **envp);


#endif #endif

3
git.c

@ -69,7 +69,8 @@ static void handle_internal_command(int argc, const char **argv, char **envp)
{ "diff-index", cmd_diff_index }, { "diff-index", cmd_diff_index },
{ "diff-stages", cmd_diff_stages }, { "diff-stages", cmd_diff_stages },
{ "diff-tree", cmd_diff_tree }, { "diff-tree", cmd_diff_tree },
{ "cat-file", cmd_cat_file } { "cat-file", cmd_cat_file },
{ "rev-parse", cmd_rev_parse }
}; };
int i; int i;



Loading…
Cancel
Save