Skip to content

Commit e91d552

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 #1218 Signed-off-by: Johannes Schindelin <[email protected]>
1 parent cfacbd4 commit e91d552

31 files changed

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

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

builtin/bisect--helper.c

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

1314
static GIT_PATH_FUNC(git_path_bisect_terms, "BISECT_TERMS")
1415
static GIT_PATH_FUNC(git_path_bisect_expected_rev, "BISECT_EXPECTED_REV")
@@ -1277,6 +1278,7 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix)
12771278
};
12781279
struct bisect_terms terms = { .term_good = NULL, .term_bad = NULL };
12791280

1281+
git_config(git_default_config, NULL);
12801282
argc = parse_options(argc, argv, prefix, options,
12811283
git_bisect_helper_usage,
12821284
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
@@ -3,6 +3,7 @@
33
#include "parse-options.h"
44
#include "cache.h"
55
#include "bundle.h"
6+
#include "config.h"
67

78
/*
89
* Basic handler for bundle files to connect repositories via sneakernet.
@@ -110,6 +111,7 @@ static int cmd_bundle_verify(int argc, const char **argv, const char *prefix) {
110111
};
111112
char *bundle_file;
112113

114+
git_config(git_default_config, NULL);
113115
argc = parse_options_cmd_bundle(argc, argv, prefix,
114116
builtin_bundle_verify_usage, options, &bundle_file);
115117
/* bundle internals use argv[1] as further parameters */

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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -890,6 +890,8 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
890890
struct transport_ls_refs_options transport_ls_refs_options =
891891
TRANSPORT_LS_REFS_OPTIONS_INIT;
892892

893+
git_config(git_default_core_config, NULL);
894+
893895
packet_trace_identity("clone");
894896

895897
git_config(git_clone_config, NULL);

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(git_default_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-store.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "credential.h"
55
#include "string-list.h"
66
#include "parse-options.h"
7+
#include "config.h"
78

89
static struct lock_file credential_lock;
910

@@ -165,6 +166,8 @@ int cmd_credential_store(int argc, const char **argv, const char *prefix)
165166

166167
umask(077);
167168

169+
git_config(git_default_config, NULL);
170+
168171
argc = parse_options(argc, (const char **)argv, prefix, options, usage, 0);
169172
if (argc != 1)
170173
usage_with_options(usage, options);

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 "oid-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";
@@ -27,6 +28,7 @@ int cmd_get_tar_commit_id(int argc, const char **argv, const char *prefix)
2728
if (argc != 1)
2829
usage(builtin_get_tar_commit_id_usage);
2930

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

builtin/log.c

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

2350+
git_config(git_default_config, NULL);
23502351
argc = parse_options(argc, argv, prefix, options, cherry_usage, 0);
23512352

23522353
switch (argc) {

0 commit comments

Comments
 (0)