threads / patch / 4193

patchMake git-check-format-ref a builtin.

Subject: [PATCH] Make git-check-format-ref a builtin.

## tl;dr

2 messages between May 18, 2006 and May 18, 2006. Diffs are folded; open one to read it.

replies: 1people: 1as markdown or json

Lukas Sandström· May 18, 2006, 12:15 UTC · lore
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
Show changes to 4 files +18 −2

Makefile, builtin-check-ref-format.c, builtin.h, git.c

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
Lukas Sandström· May 18, 2006, 12:17 UTC · re: Lukas Sandström · lore

[PATCH] Remove the non-builtin git-check-ref-format

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
Show changes to 2 files +1 −18

Makefile, check-ref-format.c

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

← back to recent threads