Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2019-01-27 03:35:24 +0300
committerJunio C Hamano <gitster@pobox.com>2019-01-28 03:28:17 +0300
commitbaa4adc66aefe2c3cc15b573b8a19dec786a1641 (patch)
treec070957142913b008595683d14f1fdeea3246cba /parse-options.c
parent202fbb33156287feeabc39c46db0e9857cb97152 (diff)
parse-options: disable option abbreviation with PARSE_OPT_KEEP_UNKNOWN
parse-options can unambiguously find an abbreviation only if it sees all available options. This is usually the case when you use parse_options(). But there are other callers like blame or shortlog which uses parse_options_start() in combination with a custom option parser, like rev-list. parse-options cannot see all options in this case and will get abbrev detection wrong. Disable it. t7800 needs update because --symlink no longer expands to --symlinks and will be passed down to git-diff, which will not recognize it. I still think this is the correct thing to do. But if --symlink has been actually used in the wild, we would just add an option alias for it. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'parse-options.c')
-rw-r--r--parse-options.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/parse-options.c b/parse-options.c
index 740ae5438f..779034e1fd 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -266,7 +266,8 @@ again:
}
if (!rest) {
/* abbreviated? */
- if (!strncmp(long_name, arg, arg_end - arg)) {
+ if (!(p->flags & PARSE_OPT_KEEP_UNKNOWN) &&
+ !strncmp(long_name, arg, arg_end - arg)) {
is_abbreviated:
if (abbrev_option) {
/*