Skip to content

Commit 734eceb

Browse files
committed
Merge branch 'jn/unknown-index-extensions' into pu
A bit too alarming warning given when unknown index extensions exist is getting revamped. * jn/unknown-index-extensions: index: offer advice for unknown index extensions index: do not warn about unrecognized extensions
2 parents 3747823 + ee70c12 commit 734eceb

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

advice.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ int advice_add_embedded_repo = 1;
2828
int advice_ignored_hook = 1;
2929
int advice_waiting_for_editor = 1;
3030
int advice_graft_file_deprecated = 1;
31+
int advice_unknown_index_extension = 1;
3132
int advice_checkout_ambiguous_remote_branch_name = 1;
3233
int advice_nested_tag = 1;
3334
int advice_submodule_alternate_error_strategy_die = 1;
@@ -89,6 +90,7 @@ static struct {
8990
{ "ignoredHook", &advice_ignored_hook },
9091
{ "waitingForEditor", &advice_waiting_for_editor },
9192
{ "graftFileDeprecated", &advice_graft_file_deprecated },
93+
{ "unknownIndexExtension", &advice_unknown_index_extension },
9294
{ "checkoutAmbiguousRemoteBranchName", &advice_checkout_ambiguous_remote_branch_name },
9395
{ "nestedTag", &advice_nested_tag },
9496
{ "submoduleAlternateErrorStrategyDie", &advice_submodule_alternate_error_strategy_die },

advice.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ extern int advice_add_embedded_repo;
2828
extern int advice_ignored_hook;
2929
extern int advice_waiting_for_editor;
3030
extern int advice_graft_file_deprecated;
31+
extern int advice_unknown_index_extension;
3132
extern int advice_checkout_ambiguous_remote_branch_name;
3233
extern int advice_nested_tag;
3334
extern int advice_submodule_alternate_error_strategy_die;

read-cache.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1758,7 +1758,17 @@ static int read_index_extension(struct index_state *istate,
17581758
if (*ext < 'A' || 'Z' < *ext)
17591759
return error(_("index uses %.4s extension, which we do not understand"),
17601760
ext);
1761-
fprintf_ln(stderr, _("ignoring %.4s extension"), ext);
1761+
if (advice_unknown_index_extension) {
1762+
warning(_("ignoring optional %.4s index extension"), ext);
1763+
advise(_("This is likely due to the file having been written by a newer\n"
1764+
"version of Git than is reading it. You can upgrade Git to\n"
1765+
"take advantage of performance improvements from the updated\n"
1766+
"file format.\n"
1767+
"\n"
1768+
"Run \"%s\"\n"
1769+
"to suppress this message."),
1770+
"git config advice.unknownIndexExtension false");
1771+
}
17621772
break;
17631773
}
17641774
return 0;

0 commit comments

Comments
 (0)