summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2017-07-10 13:58:57 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-07-10 13:58:58 -0700
commit040746c061c1138222d7db1f9ace292ef1a0935d (patch)
tree1cd0b022889ba7e8bb3672e6950f90002cd451d0 /t
parentMerge branch 'rs/pretty-add-again' into maint (diff)
parentalias: use the early config machinery to expand aliases (diff)
downloadtgif-040746c061c1138222d7db1f9ace292ef1a0935d.tar.xz
Merge branch 'js/alias-early-config' into maint
The code to pick up and execute command alias definition from the configuration used to switch to the top of the working tree and then come back when the expanded alias was executed, which was unnecessarilyl complex. Attempt to simplify the logic by using the early-config mechanism that does not chdir around. * js/alias-early-config: alias: use the early config machinery to expand aliases t7006: demonstrate a problem with aliases in subdirectories t1308: relax the test verifying that empty alias values are disallowed help: use early config when autocorrecting aliases config: report correct line number upon error discover_git_directory(): avoid setting invalid git_dir
Diffstat (limited to 't')
-rwxr-xr-xt/t1300-repo-config.sh6
-rwxr-xr-xt/t1308-config-set.sh4
-rwxr-xr-xt/t7006-pager.sh11
3 files changed, 20 insertions, 1 deletions
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
index 13b7851f7c..a37ef04222 100755
--- a/t/t1300-repo-config.sh
+++ b/t/t1300-repo-config.sh
@@ -703,6 +703,12 @@ test_expect_success 'invalid unit' '
test_i18ngrep "bad numeric config value .1auto. for .aninvalid.unit. in file .git/config: invalid unit" actual
'
+test_expect_success 'line number is reported correctly' '
+ printf "[bool]\n\tvar\n" >invalid &&
+ test_must_fail git config -f invalid --path bool.var 2>actual &&
+ test_i18ngrep "line 2" actual
+'
+
test_expect_success 'invalid stdin config' '
echo "[broken" | test_must_fail git config --list --file - >output 2>&1 &&
test_i18ngrep "bad config line 1 in standard input" output
diff --git a/t/t1308-config-set.sh b/t/t1308-config-set.sh
index ff50960cca..69a0aa56d6 100755
--- a/t/t1308-config-set.sh
+++ b/t/t1308-config-set.sh
@@ -215,7 +215,9 @@ test_expect_success 'check line errors for malformed values' '
br
EOF
test_expect_code 128 git br 2>result &&
- test_i18ngrep "fatal: .*alias\.br.*\.git/config.*line 2" result
+ test_i18ngrep "missing value for .alias\.br" result &&
+ test_i18ngrep "fatal: .*\.git/config" result &&
+ test_i18ngrep "fatal: .*line 2" result
'
test_expect_success 'error on modifying repo config without repo' '
diff --git a/t/t7006-pager.sh b/t/t7006-pager.sh
index 4f3794d415..20b4d83c28 100755
--- a/t/t7006-pager.sh
+++ b/t/t7006-pager.sh
@@ -391,6 +391,17 @@ test_expect_success TTY 'core.pager in repo config works and retains cwd' '
)
'
+test_expect_success TTY 'core.pager is found via alias in subdirectory' '
+ sane_unset GIT_PAGER &&
+ test_config core.pager "cat >via-alias" &&
+ (
+ cd sub &&
+ rm -f via-alias &&
+ test_terminal git -c alias.r="-p rev-parse" r HEAD &&
+ test_path_is_file via-alias
+ )
+'
+
test_doesnt_paginate expect_failure test_must_fail 'git -p nonsense'
test_pager_choices 'git shortlog'