Skip to content

Commit afd49c3

Browse files
committed
Merge branch 'jk/slimmed-down'
Trim an unused binary and turn a bunch of commands into built-in. * jk/slimmed-down: drop vcs-svn experiment make git-fast-import a builtin make git-bugreport a builtin make credential helpers builtins Makefile: drop builtins from MSVC pdb list
2 parents cce5178 + fc47391 commit afd49c3

31 files changed

+80
-3915
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@
134134
/git-remote-fd
135135
/git-remote-ext
136136
/git-remote-testpy
137-
/git-remote-testsvn
138137
/git-repack
139138
/git-replace
140139
/git-request-pull

Makefile

Lines changed: 6 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,6 @@ BUILT_INS =
569569
COMPAT_CFLAGS =
570570
COMPAT_OBJS =
571571
XDIFF_OBJS =
572-
VCSSVN_OBJS =
573572
GENERATED_H =
574573
EXTRA_CPPFLAGS =
575574
FUZZ_OBJS =
@@ -671,13 +670,9 @@ EXTRA_PROGRAMS =
671670
# ... and all the rest that could be moved out of bindir to gitexecdir
672671
PROGRAMS += $(EXTRA_PROGRAMS)
673672

674-
PROGRAM_OBJS += bugreport.o
675-
PROGRAM_OBJS += credential-store.o
676673
PROGRAM_OBJS += daemon.o
677-
PROGRAM_OBJS += fast-import.o
678674
PROGRAM_OBJS += http-backend.o
679675
PROGRAM_OBJS += imap-send.o
680-
PROGRAM_OBJS += remote-testsvn.o
681676
PROGRAM_OBJS += sh-i18n--envsubst.o
682677
PROGRAM_OBJS += shell.o
683678

@@ -749,8 +744,6 @@ TEST_BUILTINS_OBJS += test-xml-encode.o
749744
# Do not add more tests here unless they have extra dependencies. Add
750745
# them in TEST_BUILTINS_OBJS above.
751746
TEST_PROGRAMS_NEED_X += test-fake-ssh
752-
TEST_PROGRAMS_NEED_X += test-line-buffer
753-
TEST_PROGRAMS_NEED_X += test-svn-fe
754747
TEST_PROGRAMS_NEED_X += test-tool
755748

756749
TEST_PROGRAMS = $(patsubst %,t/helper/%$X,$(TEST_PROGRAMS_NEED_X))
@@ -806,7 +799,6 @@ TEST_SHELL_PATH = $(SHELL_PATH)
806799

807800
LIB_FILE = libgit.a
808801
XDIFF_LIB = xdiff/lib.a
809-
VCSSVN_LIB = vcs-svn/lib.a
810802

811803
GENERATED_H += config-list.h
812804
GENERATED_H += command-list.h
@@ -1042,6 +1034,7 @@ BUILTIN_OBJS += builtin/archive.o
10421034
BUILTIN_OBJS += builtin/bisect--helper.o
10431035
BUILTIN_OBJS += builtin/blame.o
10441036
BUILTIN_OBJS += builtin/branch.o
1037+
BUILTIN_OBJS += builtin/bugreport.o
10451038
BUILTIN_OBJS += builtin/bundle.o
10461039
BUILTIN_OBJS += builtin/cat-file.o
10471040
BUILTIN_OBJS += builtin/check-attr.o
@@ -1052,6 +1045,9 @@ BUILTIN_OBJS += builtin/checkout-index.o
10521045
BUILTIN_OBJS += builtin/checkout.o
10531046
BUILTIN_OBJS += builtin/clean.o
10541047
BUILTIN_OBJS += builtin/clone.o
1048+
BUILTIN_OBJS += builtin/credential-cache.o
1049+
BUILTIN_OBJS += builtin/credential-cache--daemon.o
1050+
BUILTIN_OBJS += builtin/credential-store.o
10551051
BUILTIN_OBJS += builtin/column.o
10561052
BUILTIN_OBJS += builtin/commit-graph.o
10571053
BUILTIN_OBJS += builtin/commit-tree.o
@@ -1067,6 +1063,7 @@ BUILTIN_OBJS += builtin/diff.o
10671063
BUILTIN_OBJS += builtin/difftool.o
10681064
BUILTIN_OBJS += builtin/env--helper.o
10691065
BUILTIN_OBJS += builtin/fast-export.o
1066+
BUILTIN_OBJS += builtin/fast-import.o
10701067
BUILTIN_OBJS += builtin/fetch-pack.o
10711068
BUILTIN_OBJS += builtin/fetch.o
10721069
BUILTIN_OBJS += builtin/fmt-merge-msg.o
@@ -1634,11 +1631,8 @@ ifdef NO_INET_PTON
16341631
endif
16351632
ifdef NO_UNIX_SOCKETS
16361633
BASIC_CFLAGS += -DNO_UNIX_SOCKETS
1637-
EXCLUDED_PROGRAMS += git-credential-cache git-credential-cache--daemon
16381634
else
16391635
LIB_OBJS += unix-socket.o
1640-
PROGRAM_OBJS += credential-cache.o
1641-
PROGRAM_OBJS += credential-cache--daemon.o
16421636
endif
16431637

16441638
ifdef NO_ICONV
@@ -2346,16 +2340,9 @@ XDIFF_OBJS += xdiff/xpatience.o
23462340
XDIFF_OBJS += xdiff/xprepare.o
23472341
XDIFF_OBJS += xdiff/xutils.o
23482342

2349-
VCSSVN_OBJS += vcs-svn/fast_export.o
2350-
VCSSVN_OBJS += vcs-svn/line_buffer.o
2351-
VCSSVN_OBJS += vcs-svn/sliding_window.o
2352-
VCSSVN_OBJS += vcs-svn/svndiff.o
2353-
VCSSVN_OBJS += vcs-svn/svndump.o
2354-
23552343
TEST_OBJS := $(patsubst %$X,%.o,$(TEST_PROGRAMS)) $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS))
23562344
OBJECTS := $(LIB_OBJS) $(BUILTIN_OBJS) $(PROGRAM_OBJS) $(TEST_OBJS) \
23572345
$(XDIFF_OBJS) \
2358-
$(VCSSVN_OBJS) \
23592346
$(FUZZ_OBJS) \
23602347
common-main.o \
23612348
git.o
@@ -2459,10 +2446,6 @@ endif
24592446
git-%$X: %.o GIT-LDFLAGS $(GITLIBS)
24602447
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
24612448

2462-
git-bugreport$X: bugreport.o GIT-LDFLAGS $(GITLIBS)
2463-
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
2464-
$(LIBS)
2465-
24662449
git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS)
24672450
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
24682451
$(IMAP_SEND_LDFLAGS) $(LIBS)
@@ -2474,10 +2457,6 @@ git-http-push$X: http.o http-push.o GIT-LDFLAGS $(GITLIBS)
24742457
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
24752458
$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
24762459

2477-
git-remote-testsvn$X: remote-testsvn.o GIT-LDFLAGS $(GITLIBS) $(VCSSVN_LIB)
2478-
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) \
2479-
$(VCSSVN_LIB)
2480-
24812460
$(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)
24822461
$(QUIET_LNCP)$(RM) $@ && \
24832462
ln $< $@ 2>/dev/null || \
@@ -2494,9 +2473,6 @@ $(LIB_FILE): $(LIB_OBJS)
24942473
$(XDIFF_LIB): $(XDIFF_OBJS)
24952474
$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
24962475

2497-
$(VCSSVN_LIB): $(VCSSVN_OBJS)
2498-
$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^
2499-
25002476
export DEFAULT_EDITOR DEFAULT_PAGER
25012477

25022478
Documentation/GIT-EXCLUDED-PROGRAMS: FORCE
@@ -2771,10 +2747,6 @@ perf: all
27712747

27722748
.PHONY: test perf
27732749

2774-
t/helper/test-line-buffer$X: $(VCSSVN_LIB)
2775-
2776-
t/helper/test-svn-fe$X: $(VCSSVN_LIB)
2777-
27782750
.PRECIOUS: $(TEST_OBJS)
27792751

27802752
t/helper/test-tool$X: $(patsubst %,t/helper/%,$(TEST_BUILTINS_OBJS))
@@ -2901,18 +2873,13 @@ ifdef MSVC
29012873
# because it is just a copy/hardlink of git.exe, rather than a unique binary.
29022874
$(INSTALL) git.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
29032875
$(INSTALL) git-shell.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
2904-
$(INSTALL) git-upload-pack.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
2905-
$(INSTALL) git-credential-store.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
29062876
$(INSTALL) git-daemon.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2907-
$(INSTALL) git-fast-import.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
29082877
$(INSTALL) git-http-backend.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
29092878
$(INSTALL) git-http-fetch.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
29102879
$(INSTALL) git-http-push.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
29112880
$(INSTALL) git-imap-send.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
29122881
$(INSTALL) git-remote-http.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2913-
$(INSTALL) git-remote-testsvn.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
29142882
$(INSTALL) git-sh-i18n--envsubst.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
2915-
$(INSTALL) git-show-index.pdb '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
29162883
ifndef DEBUG
29172884
$(INSTALL) $(vcpkg_rel_bin)/*.dll '$(DESTDIR_SQ)$(bindir_SQ)'
29182885
$(INSTALL) $(vcpkg_rel_bin)/*.pdb '$(DESTDIR_SQ)$(bindir_SQ)'
@@ -3112,7 +3079,7 @@ cocciclean:
31123079
clean: profile-clean coverage-clean cocciclean
31133080
$(RM) *.res
31143081
$(RM) $(OBJECTS)
3115-
$(RM) $(LIB_FILE) $(XDIFF_LIB) $(VCSSVN_LIB)
3082+
$(RM) $(LIB_FILE) $(XDIFF_LIB)
31163083
$(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X
31173084
$(RM) $(TEST_PROGRAMS)
31183085
$(RM) $(FUZZ_PROGRAMS)

builtin.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ int cmd_archive(int argc, const char **argv, const char *prefix);
119119
int cmd_bisect__helper(int argc, const char **argv, const char *prefix);
120120
int cmd_blame(int argc, const char **argv, const char *prefix);
121121
int cmd_branch(int argc, const char **argv, const char *prefix);
122+
int cmd_bugreport(int argc, const char **argv, const char *prefix);
122123
int cmd_bundle(int argc, const char **argv, const char *prefix);
123124
int cmd_cat_file(int argc, const char **argv, const char *prefix);
124125
int cmd_checkout(int argc, const char **argv, const char *prefix);
@@ -138,6 +139,9 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix);
138139
int cmd_config(int argc, const char **argv, const char *prefix);
139140
int cmd_count_objects(int argc, const char **argv, const char *prefix);
140141
int cmd_credential(int argc, const char **argv, const char *prefix);
142+
int cmd_credential_cache(int argc, const char **argv, const char *prefix);
143+
int cmd_credential_cache_daemon(int argc, const char **argv, const char *prefix);
144+
int cmd_credential_store(int argc, const char **argv, const char *prefix);
141145
int cmd_describe(int argc, const char **argv, const char *prefix);
142146
int cmd_diff_files(int argc, const char **argv, const char *prefix);
143147
int cmd_diff_index(int argc, const char **argv, const char *prefix);
@@ -146,6 +150,7 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix);
146150
int cmd_difftool(int argc, const char **argv, const char *prefix);
147151
int cmd_env__helper(int argc, const char **argv, const char *prefix);
148152
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);
149154
int cmd_fetch(int argc, const char **argv, const char *prefix);
150155
int cmd_fetch_pack(int argc, const char **argv, const char *prefix);
151156
int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix);

bugreport.c renamed to builtin/bugreport.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "cache.h"
1+
#include "builtin.h"
22
#include "parse-options.h"
33
#include "strbuf.h"
44
#include "help.h"
@@ -119,16 +119,14 @@ static void get_header(struct strbuf *buf, const char *title)
119119
strbuf_addf(buf, "\n\n[%s]\n", title);
120120
}
121121

122-
int cmd_main(int argc, const char **argv)
122+
int cmd_bugreport(int argc, const char **argv, const char *prefix)
123123
{
124124
struct strbuf buffer = STRBUF_INIT;
125125
struct strbuf report_path = STRBUF_INIT;
126126
int report = -1;
127127
time_t now = time(NULL);
128128
char *option_output = NULL;
129129
char *option_suffix = "%Y-%m-%d-%H%M";
130-
int nongit_ok = 0;
131-
const char *prefix = NULL;
132130
const char *user_relative_path = NULL;
133131

134132
const struct option bugreport_options[] = {
@@ -139,8 +137,6 @@ int cmd_main(int argc, const char **argv)
139137
OPT_END()
140138
};
141139

142-
prefix = setup_git_directory_gently(&nongit_ok);
143-
144140
argc = parse_options(argc, argv, prefix, bugreport_options,
145141
bugreport_usage, 0);
146142

@@ -170,7 +166,7 @@ int cmd_main(int argc, const char **argv)
170166
get_system_info(&buffer);
171167

172168
get_header(&buffer, _("Enabled Hooks"));
173-
get_populated_hooks(&buffer, nongit_ok);
169+
get_populated_hooks(&buffer, !startup_info->have_repository);
174170

175171
/* fopen doesn't offer us an O_EXCL alternative, except with glibc. */
176172
report = open(report_path.buf, O_CREAT | O_EXCL | O_WRONLY, 0666);

credential-cache--daemon.c renamed to builtin/credential-cache--daemon.c

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
#include "cache.h"
1+
#include "builtin.h"
2+
#include "parse-options.h"
3+
4+
#ifndef NO_UNIX_SOCKETS
5+
26
#include "config.h"
37
#include "tempfile.h"
48
#include "credential.h"
59
#include "unix-socket.h"
6-
#include "parse-options.h"
710

811
struct credential_cache_entry {
912
struct credential item;
@@ -257,7 +260,7 @@ static void init_socket_directory(const char *path)
257260
free(path_copy);
258261
}
259262

260-
int cmd_main(int argc, const char **argv)
263+
int cmd_credential_cache_daemon(int argc, const char **argv, const char *prefix)
261264
{
262265
struct tempfile *socket_file;
263266
const char *socket_path;
@@ -275,7 +278,7 @@ int cmd_main(int argc, const char **argv)
275278

276279
git_config_get_bool("credentialcache.ignoresighup", &ignore_sighup);
277280

278-
argc = parse_options(argc, argv, NULL, options, usage, 0);
281+
argc = parse_options(argc, argv, prefix, options, usage, 0);
279282
socket_path = argv[0];
280283

281284
if (!socket_path)
@@ -295,3 +298,21 @@ int cmd_main(int argc, const char **argv)
295298

296299
return 0;
297300
}
301+
302+
#else
303+
304+
int cmd_credential_cache_daemon(int argc, const char **argv, const char *prefix)
305+
{
306+
const char * const usage[] = {
307+
"git credential-cache--daemon [options] <action>",
308+
"",
309+
"credential-cache--daemon is disabled in this build of Git",
310+
NULL
311+
};
312+
struct option options[] = { OPT_END() };
313+
314+
argc = parse_options(argc, argv, prefix, options, usage, 0);
315+
die(_("credential-cache--daemon unavailable; no unix socket support"));
316+
}
317+
318+
#endif /* NO_UNIX_SOCKET */

credential-cache.c renamed to builtin/credential-cache.c

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
#include "cache.h"
1+
#include "builtin.h"
2+
#include "parse-options.h"
3+
4+
#ifndef NO_UNIX_SOCKETS
5+
26
#include "credential.h"
37
#include "string-list.h"
4-
#include "parse-options.h"
58
#include "unix-socket.h"
69
#include "run-command.h"
710

@@ -96,7 +99,7 @@ static char *get_socket_path(void)
9699
return socket;
97100
}
98101

99-
int cmd_main(int argc, const char **argv)
102+
int cmd_credential_cache(int argc, const char **argv, const char *prefix)
100103
{
101104
char *socket_path = NULL;
102105
int timeout = 900;
@@ -113,7 +116,7 @@ int cmd_main(int argc, const char **argv)
113116
OPT_END()
114117
};
115118

116-
argc = parse_options(argc, argv, NULL, options, usage, 0);
119+
argc = parse_options(argc, argv, prefix, options, usage, 0);
117120
if (!argc)
118121
usage_with_options(usage, options);
119122
op = argv[0];
@@ -134,3 +137,21 @@ int cmd_main(int argc, const char **argv)
134137

135138
return 0;
136139
}
140+
141+
#else
142+
143+
int cmd_credential_cache(int argc, const char **argv, const char *prefix)
144+
{
145+
const char * const usage[] = {
146+
"git credential-cache [options] <action>",
147+
"",
148+
"credential-cache is disabled in this build of Git",
149+
NULL
150+
};
151+
struct option options[] = { OPT_END() };
152+
153+
argc = parse_options(argc, argv, prefix, options, usage, 0);
154+
die(_("credential-cache unavailable; no unix socket support"));
155+
}
156+
157+
#endif /* NO_UNIX_SOCKETS */

credential-store.c renamed to builtin/credential-store.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "cache.h"
1+
#include "builtin.h"
22
#include "lockfile.h"
33
#include "credential.h"
44
#include "string-list.h"
@@ -143,7 +143,7 @@ static void lookup_credential(const struct string_list *fns, struct credential *
143143
return; /* Found credential */
144144
}
145145

146-
int cmd_main(int argc, const char **argv)
146+
int cmd_credential_store(int argc, const char **argv, const char *prefix)
147147
{
148148
const char * const usage[] = {
149149
"git credential-store [<options>] <action>",
@@ -161,7 +161,7 @@ int cmd_main(int argc, const char **argv)
161161

162162
umask(077);
163163

164-
argc = parse_options(argc, (const char **)argv, NULL, options, usage, 0);
164+
argc = parse_options(argc, (const char **)argv, prefix, options, usage, 0);
165165
if (argc != 1)
166166
usage_with_options(usage, options);
167167
op = argv[0];

fast-import.c renamed to builtin/fast-import.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3511,14 +3511,13 @@ static void parse_argv(void)
35113511
build_mark_map(&sub_marks_from, &sub_marks_to);
35123512
}
35133513

3514-
int cmd_main(int argc, const char **argv)
3514+
int cmd_fast_import(int argc, const char **argv, const char *prefix)
35153515
{
35163516
unsigned int i;
35173517

35183518
if (argc == 2 && !strcmp(argv[1], "-h"))
35193519
usage(fast_import_usage);
35203520

3521-
setup_git_directory();
35223521
reset_pack_idx_option(&pack_idx_opts);
35233522
git_pack_config();
35243523

0 commit comments

Comments
 (0)