Skip to content

Commit f9d49d6

Browse files
committed
t7103, t9903: export GIT_CONFIG_PARAMETERS in .git directory tests
Export `GIT_CONFIG_PARAMETERS` with `safe.bareRepository=all` (12 matches). Mechanical verification (the awk script undoes the transformation on the new lines; empty output is success): git diff HEAD^! | awk ' /^diff/,/^\+\+\+/ { next } /^-/ { old[m++] = substr($0,2) } /^\+/ { new = substr($0,2) # undo: strip GIT_CONFIG_PARAMETERS and export gcp="GIT_CONFIG_PARAMETERS" gsub(" " gcp "=[^ ]* && export " gcp " &&", "", new) if (old[n++] != new) print old[n-1] " != " new }' Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 8034893 commit f9d49d6

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

t/t7103-reset-bare.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,26 @@ test_expect_success 'setup non-bare' '
1313
'
1414

1515
test_expect_success '"hard" reset requires a worktree' '
16-
(cd .git &&
16+
(cd .git && GIT_CONFIG_PARAMETERS="${SQ}safe.bareRepository=all${SQ}" && export GIT_CONFIG_PARAMETERS &&
1717
test_must_fail git reset --hard)
1818
'
1919

2020
test_expect_success '"merge" reset requires a worktree' '
21-
(cd .git &&
21+
(cd .git && GIT_CONFIG_PARAMETERS="${SQ}safe.bareRepository=all${SQ}" && export GIT_CONFIG_PARAMETERS &&
2222
test_must_fail git reset --merge)
2323
'
2424

2525
test_expect_success '"keep" reset requires a worktree' '
26-
(cd .git &&
26+
(cd .git && GIT_CONFIG_PARAMETERS="${SQ}safe.bareRepository=all${SQ}" && export GIT_CONFIG_PARAMETERS &&
2727
test_must_fail git reset --keep)
2828
'
2929

3030
test_expect_success '"mixed" reset is ok' '
31-
(cd .git && git reset)
31+
(cd .git && GIT_CONFIG_PARAMETERS="${SQ}safe.bareRepository=all${SQ}" && export GIT_CONFIG_PARAMETERS && git reset)
3232
'
3333

3434
test_expect_success '"soft" reset is ok' '
35-
(cd .git && git reset --soft)
35+
(cd .git && GIT_CONFIG_PARAMETERS="${SQ}safe.bareRepository=all${SQ}" && export GIT_CONFIG_PARAMETERS && git reset --soft)
3636
'
3737

3838
test_expect_success 'hard reset works with GIT_WORK_TREE' '

t/t9903-bash-prompt.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ test_expect_success 'prompt - describe detached head - default' '
135135
test_expect_success 'prompt - inside .git directory' '
136136
printf " (GIT_DIR!)" >expected &&
137137
(
138-
cd .git &&
138+
cd .git && GIT_CONFIG_PARAMETERS="${SQ}safe.bareRepository=all${SQ}" && export GIT_CONFIG_PARAMETERS &&
139139
__git_ps1 >"$actual"
140140
) &&
141141
test_cmp expected "$actual"
@@ -155,7 +155,7 @@ test_expect_success 'prompt - inside bare repository' '
155155
git init --bare bare.git &&
156156
test_when_finished "rm -rf bare.git" &&
157157
(
158-
cd bare.git &&
158+
cd bare.git && GIT_CONFIG_PARAMETERS="${SQ}safe.bareRepository=all${SQ}" && export GIT_CONFIG_PARAMETERS &&
159159
__git_ps1 >"$actual"
160160
) &&
161161
test_cmp expected "$actual"
@@ -374,7 +374,7 @@ test_expect_success 'prompt - dirty status indicator - not shown inside .git dir
374374
test_when_finished "git reset --hard" &&
375375
(
376376
GIT_PS1_SHOWDIRTYSTATE=y &&
377-
cd .git &&
377+
cd .git && GIT_CONFIG_PARAMETERS="${SQ}safe.bareRepository=all${SQ}" && export GIT_CONFIG_PARAMETERS &&
378378
__git_ps1 >"$actual"
379379
) &&
380380
test_cmp expected "$actual"
@@ -409,7 +409,7 @@ test_expect_success 'prompt - stash status indicator - not shown inside .git dir
409409
test_when_finished "git stash drop" &&
410410
(
411411
GIT_PS1_SHOWSTASHSTATE=y &&
412-
cd .git &&
412+
cd .git && GIT_CONFIG_PARAMETERS="${SQ}safe.bareRepository=all${SQ}" && export GIT_CONFIG_PARAMETERS &&
413413
__git_ps1 >"$actual"
414414
) &&
415415
test_cmp expected "$actual"
@@ -514,7 +514,7 @@ test_expect_success 'prompt - untracked files status indicator - not shown insid
514514
printf " (GIT_DIR!)" >expected &&
515515
(
516516
GIT_PS1_SHOWUNTRACKEDFILES=y &&
517-
cd .git &&
517+
cd .git && GIT_CONFIG_PARAMETERS="${SQ}safe.bareRepository=all${SQ}" && export GIT_CONFIG_PARAMETERS &&
518518
__git_ps1 >"$actual"
519519
) &&
520520
test_cmp expected "$actual"
@@ -619,7 +619,7 @@ test_expect_success 'prompt - bash color pc mode - inside .git directory' '
619619
(
620620
GIT_PS1_SHOWDIRTYSTATE=y &&
621621
GIT_PS1_SHOWCOLORHINTS=y &&
622-
cd .git &&
622+
cd .git && GIT_CONFIG_PARAMETERS="${SQ}safe.bareRepository=all${SQ}" && export GIT_CONFIG_PARAMETERS &&
623623
__git_ps1 "BEFORE:" ":AFTER" &&
624624
printf "%s\\n%s" "$PS1" "${__git_ps1_branch_name}" >"$actual"
625625
) &&
@@ -749,7 +749,7 @@ test_expect_success 'prompt - hide if pwd ignored - inside gitdir' '
749749
printf " (GIT_DIR!)" >expected &&
750750
(
751751
GIT_PS1_HIDE_IF_PWD_IGNORED=y &&
752-
cd .git &&
752+
cd .git && GIT_CONFIG_PARAMETERS="${SQ}safe.bareRepository=all${SQ}" && export GIT_CONFIG_PARAMETERS &&
753753
__git_ps1 >"$actual"
754754
) &&
755755
test_cmp expected "$actual"

0 commit comments

Comments
 (0)