aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-01-10 06:36:36 -0500
committerJunio C Hamano <junkio@cox.net>2007-01-10 08:27:01 -0800
commit9a0eaf83eab5f53db0ba6a514c4d4cf16e846f30 (patch)
treea0fdf34b38d51b090dc1180d50d3d7f3f16b1c62
parent8c599c749f2f5aaf477db1327b97461f9fa3f62a (diff)
downloadgit-9a0eaf83eab5f53db0ba6a514c4d4cf16e846f30.tar.gz
git-9a0eaf83eab5f53db0ba6a514c4d4cf16e846f30.tar.xz
Make git-describe a builtin.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
-rw-r--r--Makefile3
-rw-r--r--builtin-describe.c (renamed from describe.c)4
-rw-r--r--builtin.h1
-rw-r--r--git.c1
4 files changed, 6 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 43113e9e1..e4f520ac9 100644
--- a/Makefile
+++ b/Makefile
@@ -204,7 +204,7 @@ PROGRAMS = \
git-update-server-info$X \
git-upload-pack$X git-verify-pack$X \
git-pack-redundant$X git-var$X \
- git-describe$X git-merge-tree$X git-imap-send$X \
+ git-merge-tree$X git-imap-send$X \
git-merge-recursive$X \
$(EXTRA_PROGRAMS)
@@ -275,6 +275,7 @@ BUILTIN_OBJS = \
builtin-check-ref-format.o \
builtin-commit-tree.o \
builtin-count-objects.o \
+ builtin-describe.o \
builtin-diff.o \
builtin-diff-files.o \
builtin-diff-index.o \
diff --git a/describe.c b/builtin-describe.c
index 3c2df037e..ad3b469f3 100644
--- a/describe.c
+++ b/builtin-describe.c
@@ -2,6 +2,7 @@
#include "commit.h"
#include "tag.h"
#include "refs.h"
+#include "builtin.h"
#define SEEN (1u << 0)
@@ -139,7 +140,7 @@ static void describe(const char *arg, int last_one)
die("cannot describe '%s'", sha1_to_hex(cmit->object.sha1));
}
-int main(int argc, char **argv)
+int cmd_describe(int argc, const char **argv, const char *prefix)
{
int i;
@@ -161,7 +162,6 @@ int main(int argc, char **argv)
usage(describe_usage);
}
- setup_git_directory();
save_commit_buffer = 0;
if (argc <= i)
diff --git a/builtin.h b/builtin.h
index df72d0944..0b3c9f62e 100644
--- a/builtin.h
+++ b/builtin.h
@@ -25,6 +25,7 @@ extern int cmd_check_ref_format(int argc, const char **argv, const char *prefix)
extern int cmd_cherry(int argc, const char **argv, const char *prefix);
extern int cmd_commit_tree(int argc, const char **argv, const char *prefix);
extern int cmd_count_objects(int argc, const char **argv, const char *prefix);
+extern int cmd_describe(int argc, const char **argv, const char *prefix);
extern int cmd_diff_files(int argc, const char **argv, const char *prefix);
extern int cmd_diff_index(int argc, const char **argv, const char *prefix);
extern int cmd_diff(int argc, const char **argv, const char *prefix);
diff --git a/git.c b/git.c
index bf55499dc..9ce545d67 100644
--- a/git.c
+++ b/git.c
@@ -220,6 +220,7 @@ static void handle_internal_command(int argc, const char **argv, char **envp)
{ "cherry", cmd_cherry, RUN_SETUP },
{ "commit-tree", cmd_commit_tree, RUN_SETUP },
{ "count-objects", cmd_count_objects, RUN_SETUP },
+ { "describe", cmd_describe, RUN_SETUP },
{ "diff", cmd_diff, RUN_SETUP | USE_PAGER },
{ "diff-files", cmd_diff_files, RUN_SETUP },
{ "diff-index", cmd_diff_index, RUN_SETUP },