Skip to content

Commit dadf0cf

Browse files
committed
Merge branch 'core-longpaths-everywhere'
Git for Windows supports the core.longPaths config setting to allow writing/reading long paths via the \\?\ trick for a long time now. However, for that support to work, it is absolutely necessary that git_default_config() is given a chance to parse the config. Otherwise Git will be non the wiser. So let's make sure that as many commands that previously failed to parse the core.* settings now do that, implicitly enabling long path support in a lot more places. Note: this is not a perfect solution, and it cannot be, as there is a chicken-and-egg problem in reading the config itself... This fixes #1218 Signed-off-by: Johannes Schindelin <[email protected]>
2 parents bb7c644 + 2a85c26 commit dadf0cf

33 files changed

+63
-4
lines changed

builtin/archive.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "parse-options.h"
1010
#include "pkt-line.h"
1111
#include "sideband.h"
12+
#include "config.h"
1213

1314
static void create_output_file(const char *output_file)
1415
{
@@ -95,6 +96,7 @@ int cmd_archive(int argc, const char **argv, const char *prefix)
9596
OPT_END()
9697
};
9798

99+
git_config(git_default_config, NULL);
98100
argc = parse_options(argc, argv, prefix, local_opts, NULL,
99101
PARSE_OPT_KEEP_ALL);
100102

builtin/bisect--helper.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "run-command.h"
99
#include "prompt.h"
1010
#include "quote.h"
11+
#include "config.h"
1112

1213
static GIT_PATH_FUNC(git_path_bisect_terms, "BISECT_TERMS")
1314
static GIT_PATH_FUNC(git_path_bisect_expected_rev, "BISECT_EXPECTED_REV")
@@ -654,6 +655,7 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix)
654655
};
655656
struct bisect_terms terms = { .term_good = NULL, .term_bad = NULL };
656657

658+
git_config(git_default_config, NULL);
657659
argc = parse_options(argc, argv, prefix, options,
658660
git_bisect_helper_usage,
659661
PARSE_OPT_KEEP_DASHDASH | PARSE_OPT_KEEP_UNKNOWN);

builtin/bundle.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "builtin.h"
22
#include "cache.h"
33
#include "bundle.h"
4+
#include "config.h"
45

56
/*
67
* Basic handler for bundle files to connect repositories via sneakernet.
@@ -21,6 +22,7 @@ int cmd_bundle(int argc, const char **argv, const char *prefix)
2122
const char *cmd, *bundle_file;
2223
int bundle_fd = -1;
2324

25+
git_config(git_default_config, NULL);
2426
if (argc < 3)
2527
usage(builtin_bundle_usage);
2628

builtin/check-ref-format.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "refs.h"
77
#include "builtin.h"
88
#include "strbuf.h"
9+
#include "config.h"
910

1011
static const char builtin_check_ref_format_usage[] =
1112
"git check-ref-format [--normalize] [<options>] <refname>\n"
@@ -58,6 +59,7 @@ int cmd_check_ref_format(int argc, const char **argv, const char *prefix)
5859
int flags = 0;
5960
const char *refname;
6061

62+
git_config(git_default_config, NULL);
6163
if (argc == 2 && !strcmp(argv[1], "-h"))
6264
usage(builtin_check_ref_format_usage);
6365

builtin/clone.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -908,6 +908,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
908908

909909
struct argv_array ref_prefixes = ARGV_ARRAY_INIT;
910910

911+
git_config(platform_core_config, NULL);
911912
fetch_if_missing = 0;
912913

913914
packet_trace_identity("clone");

builtin/column.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ int cmd_column(int argc, const char **argv, const char *prefix)
3434
OPT_END()
3535
};
3636

37+
git_config(platform_core_config, NULL);
38+
3739
/* This one is special and must be the first one */
3840
if (argc > 1 && starts_with(argv[1], "--command=")) {
3941
command = argv[1] + 10;

builtin/credential.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "git-compat-util.h"
22
#include "credential.h"
33
#include "builtin.h"
4+
#include "config.h"
45

56
static const char usage_msg[] =
67
"git credential [fill|approve|reject]";
@@ -10,6 +11,8 @@ int cmd_credential(int argc, const char **argv, const char *prefix)
1011
const char *op;
1112
struct credential c = CREDENTIAL_INIT;
1213

14+
git_config(git_default_config, NULL);
15+
1316
if (argc != 2 || !strcmp(argv[1], "-h"))
1417
usage(usage_msg);
1518
op = argv[1];

builtin/fetch-pack.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "connect.h"
66
#include "sha1-array.h"
77
#include "protocol.h"
8+
#include "config.h"
89

910
static const char fetch_pack_usage[] =
1011
"git fetch-pack [--all] [--stdin] [--quiet | -q] [--keep | -k] [--thin] "
@@ -57,6 +58,7 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)
5758
struct packet_reader reader;
5859
enum protocol_version version;
5960

61+
git_config(git_default_config, NULL);
6062
fetch_if_missing = 0;
6163

6264
packet_trace_identity("fetch-pack");

builtin/get-tar-commit-id.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "tar.h"
77
#include "builtin.h"
88
#include "quote.h"
9+
#include "config.h"
910

1011
static const char builtin_get_tar_commit_id_usage[] =
1112
"git get-tar-commit-id";
@@ -25,6 +26,7 @@ int cmd_get_tar_commit_id(int argc, const char **argv, const char *prefix)
2526
if (argc != 1)
2627
usage(builtin_get_tar_commit_id_usage);
2728

29+
git_config(git_default_config, NULL);
2830
n = read_in_full(0, buffer, HEADERSIZE);
2931
if (n < 0)
3032
die_errno("git get-tar-commit-id: read error");

builtin/interpret-trailers.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "parse-options.h"
1111
#include "string-list.h"
1212
#include "trailer.h"
13+
#include "config.h"
1314

1415
static const char * const git_interpret_trailers_usage[] = {
1516
N_("git interpret-trailers [--in-place] [--trim-empty] [(--trailer <token>[(=|:)<value>])...] [<file>...]"),
@@ -112,6 +113,7 @@ int cmd_interpret_trailers(int argc, const char **argv, const char *prefix)
112113
OPT_END()
113114
};
114115

116+
git_config(git_default_config, NULL);
115117
argc = parse_options(argc, argv, prefix, options,
116118
git_interpret_trailers_usage, 0);
117119

builtin/log.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2038,6 +2038,7 @@ int cmd_cherry(int argc, const char **argv, const char *prefix)
20382038
OPT_END()
20392039
};
20402040

2041+
git_config(git_default_config, NULL);
20412042
argc = parse_options(argc, argv, prefix, options, cherry_usage, 0);
20422043

20432044
switch (argc) {

builtin/ls-remote.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "ref-filter.h"
55
#include "remote.h"
66
#include "refs.h"
7+
#include "config.h"
78

89
static const char * const ls_remote_usage[] = {
910
N_("git ls-remote [--heads] [--tags] [--refs] [--upload-pack=<exec>]\n"
@@ -84,6 +85,7 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
8485
PARSE_OPT_STOP_AT_NON_OPTION);
8586
dest = argv[0];
8687

88+
git_config(git_default_config, NULL);
8789
if (argc > 1) {
8890
int i;
8991
pattern = xcalloc(argc, sizeof(const char *));

builtin/mailinfo.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "utf8.h"
88
#include "strbuf.h"
99
#include "mailinfo.h"
10+
#include "config.h"
1011

1112
static const char mailinfo_usage[] =
1213
"git mailinfo [-k | -b] [-m | --message-id] [-u | --encoding=<encoding> | -n] [--scissors | --no-scissors] <msg> <patch> < mail >info";
@@ -18,6 +19,7 @@ int cmd_mailinfo(int argc, const char **argv, const char *prefix)
1819
int status;
1920
char *msgfile, *patchfile;
2021

22+
git_config(git_default_config, NULL);
2123
setup_mailinfo(&mi);
2224

2325
def_charset = get_commit_output_encoding();

builtin/mailsplit.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "builtin.h"
99
#include "string-list.h"
1010
#include "strbuf.h"
11+
#include "config.h"
1112

1213
static const char git_mailsplit_usage[] =
1314
"git mailsplit [-d<prec>] [-f<n>] [-b] [--keep-cr] -o<directory> [(<mbox>|<Maildir>)...]";
@@ -276,6 +277,7 @@ int cmd_mailsplit(int argc, const char **argv, const char *prefix)
276277
const char **argp;
277278
static const char *stdin_only[] = { "-", NULL };
278279

280+
git_config(git_default_config, NULL);
279281
for (argp = argv+1; *argp; argp++) {
280282
const char *arg = *argp;
281283

builtin/merge-index.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#define USE_THE_INDEX_COMPATIBILITY_MACROS
22
#include "builtin.h"
33
#include "run-command.h"
4+
#include "config.h"
45

56
static const char *pgm;
67
static int one_shot, quiet;
@@ -75,6 +76,8 @@ int cmd_merge_index(int argc, const char **argv, const char *prefix)
7576
*/
7677
signal(SIGCHLD, SIG_DFL);
7778

79+
git_config(git_default_config, NULL);
80+
7881
if (argc < 3)
7982
usage("git merge-index [-o] [-q] <merge-program> (-a | [--] [<filename>...])");
8083

builtin/merge-tree.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "blob.h"
88
#include "exec-cmd.h"
99
#include "merge-blobs.h"
10+
#include "config.h"
1011

1112
static const char merge_tree_usage[] = "git merge-tree <base-tree> <branch1> <branch2>";
1213

@@ -372,6 +373,7 @@ int cmd_merge_tree(int argc, const char **argv, const char *prefix)
372373
if (argc != 4)
373374
usage(merge_tree_usage);
374375

376+
git_config(git_default_config, NULL);
375377
buf1 = get_tree_descriptor(t+0, argv[1]);
376378
buf2 = get_tree_descriptor(t+1, argv[2]);
377379
buf3 = get_tree_descriptor(t+2, argv[3]);

builtin/mktag.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "tag.h"
33
#include "replace-object.h"
44
#include "object-store.h"
5+
#include "config.h"
56

67
/*
78
* A signature file has a very simple fixed format: four lines
@@ -158,6 +159,7 @@ int cmd_mktag(int argc, const char **argv, const char *prefix)
158159
if (argc != 1)
159160
usage("git mktag");
160161

162+
git_config(git_default_config, NULL);
161163
if (strbuf_read(&buf, 0, 4096) < 0) {
162164
die_errno("could not read from stdin");
163165
}

builtin/mktree.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "tree.h"
99
#include "parse-options.h"
1010
#include "object-store.h"
11+
#include "config.h"
1112

1213
static struct treeent {
1314
unsigned mode;
@@ -157,6 +158,7 @@ int cmd_mktree(int ac, const char **av, const char *prefix)
157158
OPT_END()
158159
};
159160

161+
git_config(git_default_config, NULL);
160162
ac = parse_options(ac, av, prefix, option, mktree_usage, 0);
161163
getline_fn = nul_term_line ? strbuf_getline_nul : strbuf_getline_lf;
162164

builtin/pack-refs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "parse-options.h"
33
#include "refs.h"
44
#include "repository.h"
5+
#include "config.h"
56

67
static char const * const pack_refs_usage[] = {
78
N_("git pack-refs [<options>]"),
@@ -16,6 +17,7 @@ int cmd_pack_refs(int argc, const char **argv, const char *prefix)
1617
OPT_BIT(0, "prune", &flags, N_("prune loose refs (default)"), PACK_REFS_PRUNE),
1718
OPT_END(),
1819
};
20+
git_config(git_default_config, NULL);
1921
if (parse_options(argc, argv, prefix, opts, pack_refs_usage, 0))
2022
usage_with_options(pack_refs_usage, opts);
2123
return refs_pack_refs(get_main_ref_store(the_repository), flags);

builtin/prune-packed.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "parse-options.h"
55
#include "packfile.h"
66
#include "object-store.h"
7+
#include "config.h"
78

89
static const char * const prune_packed_usage[] = {
910
N_("git prune-packed [-n | --dry-run] [-q | --quiet]"),
@@ -60,6 +61,7 @@ int cmd_prune_packed(int argc, const char **argv, const char *prefix)
6061
OPT_END()
6162
};
6263

64+
git_config(git_default_config, NULL);
6365
argc = parse_options(argc, argv, prefix, prune_packed_options,
6466
prune_packed_usage, 0);
6567

builtin/prune.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "parse-options.h"
88
#include "progress.h"
99
#include "object-store.h"
10+
#include "config.h"
1011

1112
static const char * const prune_usage[] = {
1213
N_("git prune [-n] [-v] [--progress] [--expire <time>] [--] [<head>...]"),
@@ -116,6 +117,8 @@ int cmd_prune(int argc, const char **argv, const char *prefix)
116117
};
117118
char *s;
118119

120+
git_config(git_default_config, NULL);
121+
119122
expire = TIME_MAX;
120123
save_commit_buffer = 0;
121124
read_replace_refs = 0;

builtin/reflog.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,7 @@ N_("git reflog [ show | expire | delete | exists ]");
765765

766766
int cmd_reflog(int argc, const char **argv, const char *prefix)
767767
{
768+
git_config(git_default_config, NULL);
768769
if (argc > 1 && !strcmp(argv[1], "-h"))
769770
usage(_(reflog_usage));
770771

builtin/remote-ext.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "transport.h"
33
#include "run-command.h"
44
#include "pkt-line.h"
5+
#include "config.h"
56

67
static const char usage_msg[] =
78
"git remote-ext <remote> <url>";
@@ -198,5 +199,6 @@ int cmd_remote_ext(int argc, const char **argv, const char *prefix)
198199
if (argc != 3)
199200
usage(usage_msg);
200201

202+
git_config(git_default_config, NULL);
201203
return command_loop(argv[2]);
202204
}

builtin/remote.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1612,6 +1612,7 @@ int cmd_remote(int argc, const char **argv, const char *prefix)
16121612
};
16131613
int result;
16141614

1615+
git_config(git_default_config, NULL);
16151616
argc = parse_options(argc, argv, prefix, options, builtin_remote_usage,
16161617
PARSE_OPT_STOP_AT_NON_OPTION);
16171618

builtin/rev-parse.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,7 @@ static int cmd_parseopt(int argc, const char **argv, const char *prefix)
425425
struct option *opts = NULL;
426426
int onb = 0, osz = 0, unb = 0, usz = 0;
427427

428+
git_config(git_default_config, NULL);
428429
strbuf_addstr(&parsed, "set --");
429430
argc = parse_options(argc, argv, prefix, parseopt_opts, parseopt_usage,
430431
PARSE_OPT_KEEP_DASHDASH);

builtin/show-index.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "builtin.h"
22
#include "cache.h"
33
#include "pack.h"
4+
#include "config.h"
45

56
static const char show_index_usage[] =
67
"git show-index";
@@ -14,6 +15,7 @@ int cmd_show_index(int argc, const char **argv, const char *prefix)
1415

1516
if (argc != 1)
1617
usage(show_index_usage);
18+
git_config(git_default_config, NULL);
1719
if (fread(top_index, 2 * 4, 1, stdin) != 1)
1820
die("unable to read header");
1921
if (top_index[0] == htonl(PACK_IDX_SIGNATURE)) {

builtin/show-ref.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "tag.h"
77
#include "string-list.h"
88
#include "parse-options.h"
9+
#include "config.h"
910

1011
static const char * const show_ref_usage[] = {
1112
N_("git show-ref [-q | --quiet] [--verify] [--head] [-d | --dereference] [-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags] [--heads] [--] [<pattern>...]"),
@@ -182,6 +183,7 @@ static const struct option show_ref_options[] = {
182183

183184
int cmd_show_ref(int argc, const char **argv, const char *prefix)
184185
{
186+
git_config(git_default_config, NULL);
185187
argc = parse_options(argc, argv, prefix, show_ref_options,
186188
show_ref_usage, 0);
187189

builtin/stripspace.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,9 @@ int cmd_stripspace(int argc, const char **argv, const char *prefix)
4646
if (argc)
4747
usage_with_options(stripspace_usage, options);
4848

49-
if (mode == STRIP_COMMENTS || mode == COMMENT_LINES) {
49+
if (mode == STRIP_COMMENTS || mode == COMMENT_LINES)
5050
setup_git_directory_gently(&nongit);
51-
git_config(git_default_config, NULL);
52-
}
51+
git_config(git_default_config, NULL);
5352

5453
if (strbuf_read(&buf, 0, 1024) < 0)
5554
die_errno("could not read the input");

0 commit comments

Comments
 (0)