@matheusbsbs / matheus-bagliano / commits / a006f875e2
Fork 0

make git-fast-import a builtin

There's no reason that git-fast-import benefits from being a separate binary. And as it links against libgit.a, it has a non-trivial disk footprint. Let's make it a builtin, which reduces the size of a stripped installation from 22MB to 21MB. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Aug 13, 2020 at 10:59 UTC a006f875e2689cb7df543d5950beadb0416d305b
5 files changed +5 -8
Makefile
+1 -2
@@ -672,7 +672,6 @@ EXTRA_PROGRAMS =
672 PROGRAMS += $(EXTRA_PROGRAMS)
673
674 PROGRAM_OBJS += daemon.o
675 -PROGRAM_OBJS += fast-import.o
675 PROGRAM_OBJS += http-backend.o
676 PROGRAM_OBJS += imap-send.o
677 PROGRAM_OBJS += remote-testsvn.o
@@ -1069,6 +1068,7 @@ BUILTIN_OBJS += builtin/diff.o
1068 BUILTIN_OBJS += builtin/difftool.o
1069 BUILTIN_OBJS += builtin/env--helper.o
1070 BUILTIN_OBJS += builtin/fast-export.o
1071 +BUILTIN_OBJS += builtin/fast-import.o
1072 BUILTIN_OBJS += builtin/fetch-pack.o
1073 BUILTIN_OBJS += builtin/fetch.o
1074 BUILTIN_OBJS += builtin/fmt-merge-msg.o
@@ -2897,7 +2897,6 @@ ifdef MSVC
2897 $(INSTALL) git.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
2898 $(INSTALL) git-shell.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
2899 $(INSTALL) git-daemon.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2900 - $(INSTALL) git-fast-import.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2900 $(INSTALL) git-http-backend.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2901 $(INSTALL) git-http-fetch.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2902 $(INSTALL) git-http-push.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
builtin.h
+1
@@ -150,6 +150,7 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix);
150 int cmd_difftool(int argc, const char **argv, const char *prefix);
151 int cmd_env__helper(int argc, const char **argv, const char *prefix);
152 int cmd_fast_export(int argc, const char **argv, const char *prefix);
153 +int cmd_fast_import(int argc, const char **argv, const char *prefix);
154 int cmd_fetch(int argc, const char **argv, const char *prefix);
155 int cmd_fetch_pack(int argc, const char **argv, const char *prefix);
156 int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix);
builtin/fast-import.c renamed
+1 -2
@@ -3519,14 +3519,13 @@ static void parse_argv(void)
3519 build_mark_map(&sub_marks_from, &sub_marks_to);
3520 }
3521
3522 -int cmd_main(int argc, const char **argv)
3522 +int cmd_fast_import(int argc, const char **argv, const char *prefix)
3523 {
3524 unsigned int i;
3525
3526 if (argc == 2 && !strcmp(argv[1], "-h"))
3527 usage(fast_import_usage);
3528
3529 - setup_git_directory();
3529 reset_pack_idx_option(&pack_idx_opts);
3530 git_pack_config();
3531
contrib/buildsystems/CMakeLists.txt
+1 -4
@@ -501,7 +501,7 @@ unset(CMAKE_REQUIRED_INCLUDES)
501
502 #programs
503 set(PROGRAMS_BUILT
504 - git git-daemon git-fast-import git-http-backend git-sh-i18n--envsubst
504 + git git-daemon git-http-backend git-sh-i18n--envsubst
505 git-shell git-remote-testsvn)
506
507 if(NOT CURL_FOUND)
@@ -627,9 +627,6 @@ target_link_libraries(git common-main)
627 add_executable(git-daemon ${CMAKE_SOURCE_DIR}/daemon.c)
628 target_link_libraries(git-daemon common-main)
629
630 -add_executable(git-fast-import ${CMAKE_SOURCE_DIR}/fast-import.c)
631 -target_link_libraries(git-fast-import common-main)
632 -
630 add_executable(git-http-backend ${CMAKE_SOURCE_DIR}/http-backend.c)
631 target_link_libraries(git-http-backend common-main)
632
git.c
+1
@@ -511,6 +511,7 @@ static struct cmd_struct commands[] = {
511 { "difftool", cmd_difftool, RUN_SETUP_GENTLY },
512 { "env--helper", cmd_env__helper },
513 { "fast-export", cmd_fast_export, RUN_SETUP },
514 + { "fast-import", cmd_fast_import, RUN_SETUP | NO_PARSEOPT },
515 { "fetch", cmd_fetch, RUN_SETUP },
516 { "fetch-pack", cmd_fetch_pack, RUN_SETUP | NO_PARSEOPT },
517 { "fmt-merge-msg", cmd_fmt_merge_msg, RUN_SETUP },