Skip to content

Commit 8dffffc

Browse files
committed
t5411: teach test_cmp_refs a --git-dir option
Preparing for `safe.bareRepository` defaulting to `explicit` (see 8d1a744), add `--git-dir` option parsing to `test_cmp_refs` in t5411/common-functions.sh, parallel to the existing `-C` handling. When given, the helper passes `--git-dir="$gitdir"` to `git show-ref`. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent f5ec623 commit 8dffffc

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

t/t5411/common-functions.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,20 @@ format_and_save_expect () {
5959

6060
test_cmp_refs () {
6161
indir=
62+
gitdir=
6263
if test "$1" = "-C"
6364
then
6465
shift
6566
indir="$1"
6667
shift
68+
elif test "$1" = "--git-dir"
69+
then
70+
shift
71+
gitdir="$1"
72+
shift
6773
fi
68-
indir=${indir:+"$indir"/}
6974
cat >show-ref.expect &&
70-
git ${indir:+ -C "$indir"} show-ref >show-ref.pristine &&
75+
git ${indir:+ -C "$indir"} ${gitdir:+ --git-dir="$gitdir"} show-ref >show-ref.pristine &&
7176
make_user_friendly_and_stable_output <show-ref.pristine >show-ref.filtered &&
7277
test_cmp show-ref.expect show-ref.filtered
7378
}

0 commit comments

Comments
 (0)