Builtin git-init-db
PATCH 1/1 Builtin git-init-db
Basically this just renames init-db.c to builtin-init-db.c and makes some strings const.
Signed-off-by Timo Hirvonen <[email protected]>
---
ea0920d755efa314e2be014e2a1eccda89d8f850
Makefile | 13 ++++++------- init-db.c => builtin-init-db.c | 12 +++++++----- builtin.h | 1 + git.c | 1 + 4 files changed, 15 insertions(+), 12 deletions(-) rename init-db.c => builtin-init-db.c (96%)
ea0920d755efa314e2be014e2a1eccda89d8f850
Makefile +6 -7
@@ -154,7 +154,7 @@ PROGRAMS = \ git-convert-objects$X git-diff-files$X \ git-diff-index$X git-diff-stages$X \ git-diff-tree$X git-fetch-pack$X git-fsck-objects$X \ - git-hash-object$X git-index-pack$X git-init-db$X git-local-fetch$X \ + git-hash-object$X git-index-pack$X git-local-fetch$X \ git-ls-files$X git-ls-tree$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-peek-remote$X git-prune-packed$X git-read-tree$X \
@@ -170,7 +170,8 @@ 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-rev-list$X git-check-ref-format$X + git-grep$X git-rev-list$X git-check-ref-format$X \ + git-init-db$X # what 'all' will build and 'install' will install, in gitexecdir ALL_PROGRAMS = $(PROGRAMS) $(SIMPLE_PROGRAMS) $(SCRIPTS)
@@ -218,7 +219,8 @@ LIB_OBJS = \ BUILTIN_OBJS = \ builtin-log.o builtin-help.o builtin-count.o builtin-diff.o builtin-push.o \ - builtin-grep.o builtin-rev-list.o builtin-check-ref-format.o + builtin-grep.o builtin-rev-list.o builtin-check-ref-format.o \ + builtin-init-db.o GITLIBS = $(LIB_FILE) $(XDIFF_LIB) LIBS = $(GITLIBS) -lz
@@ -473,6 +475,7 @@ strip: $(PROGRAMS) git$X git$X: git.c common-cmds.h $(BUILTIN_OBJS) $(GITLIBS) $(CC) -DGIT_VERSION='"$(GIT_VERSION)"' \ + -DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir_SQ)"' \ $(ALL_CFLAGS) -o $@ $(filter %.c,$^) \ $(BUILTIN_OBJS) $(ALL_LDFLAGS) $(LIBS)
@@ -565,10 +568,6 @@ git-http-push$X: revision.o http.o http- $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \ $(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT) -init-db.o: init-db.c - $(CC) -c $(ALL_CFLAGS) \ - -DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir_SQ)"' $*.c - $(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H) $(patsubst git-%$X,%.o,$(PROGRAMS)): $(GITLIBS) $(DIFF_OBJS): diffcore.h
builtin-init-db.c renamed from init-db.c +7 -5
@@ -4,6 +4,7 @@* Copyright (C) Linus Torvalds, 2005 */ #include "cache.h" +#include "builtin.h" #ifndef DEFAULT_GIT_TEMPLATE_DIR #define DEFAULT_GIT_TEMPLATE_DIR "/usr/share/git-core/templates/"
@@ -116,7 +117,7 @@ static void copy_templates_1(char *path, } } -static void copy_templates (const char *git_dir,int len,char *template_dir) +static void copy_templates (const char *git_dir,int len,const char *template_dir) {char path[PATH_MAX ];char template_path[PATH_MAX ];
@@ -163,7 +164,7 @@ static void copy_templates(const char *gclosedir (dir); } -static void create_default_files (const char *git_dir,char *template_path) +static void create_default_files (const char *git_dir,const char *template_path) {unsigned len =strlen (git_dir);static char path[PATH_MAX ];
@@ -234,15 +235,16 @@ static const char init_db_usage[] =* On the other hand, it might just make lookup slower and messier. You * be the judge. The default case is to have one DB per managed directory. */ -int main (int argc,char **argv) +int cmd_init_db (int argc,const char **argv,char **envp) {const char *git_dir;const char *sha1_dir; -char *path, *template_dir =NULL ; +const char *template_dir =NULL ; +char *path;int len, i;for (i =1 ; i < argc; i++, argv++) { -char *arg = argv[1 ]; +const char *arg = argv[1 ];if (!strncmp (arg,"--template=" ,11 )) template_dir = arg+11 ;else if (!strcmp (arg,"--shared" ))
builtin.h +1 -0
@@ -26,5 +26,6 @@ extern int cmd_push(int argc, const charextern int cmd_grep (int argc,const char **argv,char **envp);extern int cmd_rev_list (int argc,const char **argv,char **envp);extern int cmd_check_ref_format (int argc,const char **argv,char **envp); +extern int cmd_init_db (int argc,const char **argv,char **envp);#endif
git.c +1 -0
@@ -51,6 +51,7 @@ static void handle_internal_command(int { "diff", cmd_diff }, { "grep", cmd_grep }, { "rev-list", cmd_rev_list }, + { "init-db", cmd_init_db }, { "check-ref-format", cmd_check_ref_format } };int i;
Signature · 1 line
1.3.3.gff62-dirty