Skip to content

Commit fdf778e

Browse files
committed
mingw: ensure that core.longPaths is handled *always*
A ton of Git commands simply do not read (or at least parse) the core.* settings. This is not good, as Git for Windows relies on the core.longPaths setting to be read quite early on. So let's just make sure that all commands read the config and give platform_core_config() a chance. This patch teaches tons of Git commands to respect the config setting `core.longPaths = true`, including `pack-refs`, thereby fixing git-for-windows#1218 Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 72b74e0 commit fdf778e

34 files changed

+64
-5
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
{
@@ -94,6 +95,7 @@ int cmd_archive(int argc, const char **argv, const char *prefix)
9495
OPT_END()
9596
};
9697

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

builtin/bisect--helper.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "parse-options.h"
44
#include "bisect.h"
55
#include "refs.h"
6+
#include "config.h"
67

78
static GIT_PATH_FUNC(git_path_bisect_terms, "BISECT_TERMS")
89
static GIT_PATH_FUNC(git_path_bisect_expected_rev, "BISECT_EXPECTED_REV")
@@ -129,6 +130,7 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix)
129130
OPT_END()
130131
};
131132

133+
git_config(git_default_config, NULL);
132134
argc = parse_options(argc, argv, prefix, options,
133135
git_bisect_helper_usage, 0);
134136

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
@@ -896,6 +896,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
896896
struct refspec *refspec;
897897
const char *fetch_pattern;
898898

899+
git_config(platform_core_config, NULL);
899900
fetch_if_missing = 0;
900901

901902
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
@@ -4,6 +4,7 @@
44
#include "remote.h"
55
#include "connect.h"
66
#include "sha1-array.h"
7+
#include "config.h"
78

89
static const char fetch_pack_usage[] =
910
"git fetch-pack [--all] [--stdin] [--quiet | -q] [--keep | -k] [--thin] "
@@ -53,6 +54,7 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)
5354
struct oid_array shallow = OID_ARRAY_INIT;
5455
struct string_list deepen_not = STRING_LIST_INIT_DUP;
5556

57+
git_config(git_default_config, NULL);
5658
fetch_if_missing = 0;
5759

5860
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>...]"),
@@ -109,6 +110,7 @@ int cmd_interpret_trailers(int argc, const char **argv, const char *prefix)
109110
OPT_END()
110111
};
111112

113+
git_config(git_default_config, NULL);
112114
argc = parse_options(argc, argv, prefix, options,
113115
git_interpret_trailers_usage, 0);
114116

0 commit comments

Comments
 (0)