зеркало из https://github.com/microsoft/git.git
Merge branch 'jc/line-log-takes-no-pathspec'
"git log -L<range>:<path>" is documented to take no pathspec, but this was not enforced by the command line option parser, which has been corrected. * jc/line-log-takes-no-pathspec: log: diagnose -L used with pathspec as an error
This commit is contained in:
Коммит
f8a1cee7b3
|
@ -206,6 +206,9 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,
|
|||
if (argc > 1)
|
||||
die(_("unrecognized argument: %s"), argv[1]);
|
||||
|
||||
if (rev->line_level_traverse && rev->prune_data.nr)
|
||||
die(_("-L<range>:<file> cannot be used with pathspec"));
|
||||
|
||||
memset(&w, 0, sizeof(w));
|
||||
userformat_find_requirements(NULL, &w);
|
||||
|
||||
|
|
|
@ -8,6 +8,28 @@ test_expect_success 'setup (import history)' '
|
|||
git reset --hard
|
||||
'
|
||||
|
||||
test_expect_success 'basic command line parsing' '
|
||||
# This may fail due to "no such path a.c in commit", or
|
||||
# "-L is incompatible with pathspec", depending on the
|
||||
# order the error is checked. Either is acceptable.
|
||||
test_must_fail git log -L1,1:a.c -- a.c &&
|
||||
|
||||
# -L requires there is no pathspec
|
||||
test_must_fail git log -L1,1:b.c -- b.c 2>error &&
|
||||
test_i18ngrep "cannot be used with pathspec" error &&
|
||||
|
||||
# This would fail because --follow wants a single path, but
|
||||
# we may fail due to incompatibility between -L/--follow in
|
||||
# the future. Either is acceptable.
|
||||
test_must_fail git log -L1,1:b.c --follow &&
|
||||
test_must_fail git log --follow -L1,1:b.c &&
|
||||
|
||||
# This would fail because -L wants no pathspec, but
|
||||
# we may fail due to incompatibility between -L/--follow in
|
||||
# the future. Either is acceptable.
|
||||
test_must_fail git log --follow -L1,1:b.c -- b.c
|
||||
'
|
||||
|
||||
canned_test_1 () {
|
||||
test_expect_$1 "$2" "
|
||||
git log $2 >actual &&
|
||||
|
|
Загрузка…
Ссылка в новой задаче