* [PATCH] Make git-check-format-ref a builtin.
@ 2006-05-18 12:15 Lukas Sandström
2006-05-18 12:17 ` [PATCH] Remove the non-builtin git-check-ref-format Lukas Sandström
0 siblings, 1 reply; 2+ messages in thread
From: Lukas Sandström @ 2006-05-18 12:15 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Git Mailing List
Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
---
It was already written in C, but now it's 219k less in my ~/bin dir.
Makefile | 4 ++--
builtin-check-ref-format.c | 13 +++++++++++++
builtin.h | 2 ++
git.c | 1 +
4 files changed, 18 insertions(+), 2 deletions(-)
create mode 100644 builtin-check-ref-format.c
2e18872b12d1635a6814053f3cfc3c9e433db428
diff --git a/Makefile b/Makefile
index 3a28580..b737cb8 100644
--- a/Makefile
+++ b/Makefile
@@ -170,7 +170,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-grep$X git-add$X git-check-ref-format$X
# what 'all' will build and 'install' will install, in gitexecdir
ALL_PROGRAMS = $(PROGRAMS) $(SIMPLE_PROGRAMS) $(SCRIPTS)
@@ -218,7 +218,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-grep.o builtin-add.o builtin-check-ref-format.o
GITLIBS = $(LIB_FILE) $(XDIFF_LIB)
LIBS = $(GITLIBS) -lz
diff --git a/builtin-check-ref-format.c b/builtin-check-ref-format.c
new file mode 100644
index 0000000..ac29383
--- /dev/null
+++ b/builtin-check-ref-format.c
@@ -0,0 +1,13 @@
+/*
+ * GIT - The information manager from hell
+ */
+
+#include "cache.h"
+#include "refs.h"
+
+int cmd_check_ref_format(int argc, const char **argv, char **envp)
+{
+ if (argc != 2)
+ usage("git check-ref-format refname");
+ return check_ref_format(argv[1]) == 0 ? 0 : 1;
+}
diff --git a/builtin.h b/builtin.h
index ccd0e31..a26f2c2 100644
--- a/builtin.h
+++ b/builtin.h
@@ -27,4 +27,6 @@ extern int cmd_push(int argc, const char
extern int cmd_grep(int argc, const char **argv, char **envp);
extern int cmd_add(int argc, const char **argv, char **envp);
+extern int cmd_check_ref_format(int argc, const char **argv, char **envp);
+
#endif
diff --git a/git.c b/git.c
index 6a470cf..62baf25 100644
--- a/git.c
+++ b/git.c
@@ -52,6 +52,7 @@ static void handle_internal_command(int
{ "diff", cmd_diff },
{ "grep", cmd_grep },
{ "add", cmd_add },
+ { "check-ref-format", cmd_check_ref_format }
};
int i;
--
1.3.2.g3c45-dirty
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] Remove the non-builtin git-check-ref-format
2006-05-18 12:15 [PATCH] Make git-check-format-ref a builtin Lukas Sandström
@ 2006-05-18 12:17 ` Lukas Sandström
0 siblings, 0 replies; 2+ messages in thread
From: Lukas Sandström @ 2006-05-18 12:17 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Lukas Sandström, Git Mailing List
Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
---
Makefile | 2 +-
check-ref-format.c | 17 -----------------
2 files changed, 1 insertions(+), 18 deletions(-)
delete mode 100644 check-ref-format.c
d459dd88b8b541bbfa03bb3bebfac152d3d1b9e5
diff --git a/Makefile b/Makefile
index b737cb8..ee62ca2 100644
--- a/Makefile
+++ b/Makefile
@@ -164,7 +164,7 @@ PROGRAMS = \
git-ssh-upload$X git-tar-tree$X git-unpack-file$X \
git-unpack-objects$X git-update-index$X git-update-server-info$X \
git-upload-pack$X git-verify-pack$X git-write-tree$X \
- git-update-ref$X git-symbolic-ref$X git-check-ref-format$X \
+ git-update-ref$X git-symbolic-ref$X \
git-name-rev$X git-pack-redundant$X git-repo-config$X git-var$X \
git-describe$X git-merge-tree$X git-blame$X git-imap-send$X
diff --git a/check-ref-format.c b/check-ref-format.c
deleted file mode 100644
index a0adb3d..0000000
--- a/check-ref-format.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * GIT - The information manager from hell
- */
-
-#include "cache.h"
-#include "refs.h"
-
-#include <stdio.h>
-
-int main(int ac, char **av)
-{
- if (ac != 2)
- usage("git-check-ref-format refname");
- if (check_ref_format(av[1]))
- exit(1);
- return 0;
-}
--
1.3.2.g3c45-dirty
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-05-18 12:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-18 12:15 [PATCH] Make git-check-format-ref a builtin Lukas Sandström
2006-05-18 12:17 ` [PATCH] Remove the non-builtin git-check-ref-format Lukas Sandström
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).