aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Kestenholz <matthias@spinlock.ch>2006-08-03 17:24:38 +0200
committerJunio C Hamano <junkio@cox.net>2006-08-03 23:15:11 -0700
commit640ce1052bbd6a8f1dd4d58beaa521d7592a0f02 (patch)
tree6083c20c6ca0704d370f07d7f981c65c2d6909bb
parent6441363079d85cf17aee21b8925e9745c8abda16 (diff)
downloadgit-640ce1052bbd6a8f1dd4d58beaa521d7592a0f02.tar.gz
git-640ce1052bbd6a8f1dd4d58beaa521d7592a0f02.tar.xz
Make git-symbolic-ref a builtin
Signed-off-by: Matthias Kestenholz <matthias@spinlock.ch> Signed-off-by: Junio C Hamano <junkio@cox.net>
-rw-r--r--Makefile6
-rw-r--r--builtin-symbolic-ref.c (renamed from symbolic-ref.c)4
-rw-r--r--builtin.h1
-rw-r--r--git.c1
4 files changed, 7 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index b108a8aa7..db59e00ed 100644
--- a/Makefile
+++ b/Makefile
@@ -184,7 +184,6 @@ PROGRAMS = \
git-ssh-upload$X git-unpack-file$X \
git-update-server-info$X \
git-upload-pack$X git-verify-pack$X \
- git-symbolic-ref$X \
git-pack-redundant$X git-var$X \
git-describe$X git-merge-tree$X git-blame$X git-imap-send$X
@@ -199,7 +198,7 @@ BUILT_INS = git-log$X git-whatchanged$X git-show$X git-update-ref$X \
git-diff-index$X git-diff-stages$X git-diff-tree$X git-cat-file$X \
git-fmt-merge-msg$X git-prune$X git-mv$X git-prune-packed$X \
git-repo-config$X git-name-rev$X git-pack-objects$X \
- git-unpack-objects$X
+ git-unpack-objects$X git-symbolic-ref$X
# what 'all' will build and 'install' will install, in gitexecdir
ALL_PROGRAMS = $(PROGRAMS) $(SIMPLE_PROGRAMS) $(SCRIPTS)
@@ -257,7 +256,8 @@ BUILTIN_OBJS = \
builtin-cat-file.o builtin-mailsplit.o builtin-stripspace.o \
builtin-update-ref.o builtin-fmt-merge-msg.o builtin-prune.o \
builtin-mv.o builtin-prune-packed.o builtin-repo-config.o \
- builtin-name-rev.o builtin-pack-objects.o builtin-unpack-objects.o
+ builtin-name-rev.o builtin-pack-objects.o builtin-unpack-objects.o \
+ builtin-symbolic-ref.o
GITLIBS = $(LIB_FILE) $(XDIFF_LIB)
LIBS = $(GITLIBS) -lz
diff --git a/symbolic-ref.c b/builtin-symbolic-ref.c
index 193c87c17..b4ec6f28e 100644
--- a/symbolic-ref.c
+++ b/builtin-symbolic-ref.c
@@ -1,3 +1,4 @@
+#include "builtin.h"
#include "cache.h"
static const char git_symbolic_ref_usage[] =
@@ -17,9 +18,8 @@ static void check_symref(const char *HEAD)
die("No such ref: %s", HEAD);
}
-int main(int argc, const char **argv)
+int cmd_symbolic_ref(int argc, const char **argv, const char *prefix)
{
- setup_git_directory();
git_config(git_default_config);
switch (argc) {
case 2:
diff --git a/builtin.h b/builtin.h
index af73c3c19..b767245c7 100644
--- a/builtin.h
+++ b/builtin.h
@@ -52,6 +52,7 @@ extern int cmd_repo_config(int argc, const char **argv, const char *prefix);
extern int cmd_name_rev(int argc, const char **argv, const char *prefix);
extern int cmd_pack_objects(int argc, const char **argv, const char *prefix);
extern int cmd_unpack_objects(int argc, const char **argv, const char *prefix);
+extern int cmd_symbolic_ref(int argc, const char **argv, const char *prefix);
extern int cmd_write_tree(int argc, const char **argv, const char *prefix);
extern int write_tree(unsigned char *sha1, int missing_ok, const char *prefix);
diff --git a/git.c b/git.c
index 7c3a7f8fd..e40e85935 100644
--- a/git.c
+++ b/git.c
@@ -268,6 +268,7 @@ static void handle_internal_command(int argc, const char **argv, char **envp)
{ "name-rev", cmd_name_rev, NEEDS_PREFIX },
{ "pack-objects", cmd_pack_objects, NEEDS_PREFIX },
{ "unpack-objects", cmd_unpack_objects, NEEDS_PREFIX },
+ { "symbolic-ref", cmd_symbolic_ref, NEEDS_PREFIX },
};
int i;