You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tests: replace -C to --git-dir, dropping ../ prefixes as needed
An easy way to prepare the tests for a time when the `safe.bareRepository`
default changes is to replaced `-C <dir>` with `--git-dir=<dir>` in those
invocations that concern bare repositories. However, in some cases, further
adjustments are required: since `-C` changes the work directory, relative
paths specified in the Git command have to change, too.
This commit takes care of the `git -C <dir>` invocations that specified
paths in the current directory, via `../<name>` arguments. Naturally, these
arguments now need to drop that `../` prefix.
This commit can be verified mechanically via this awk script that applies the
transformation on the old lines; empty output is success:
git diff HEAD^! | awk '
/^diff/,/^\+\+\+/ { next }
/^-/ {
line = substr($0,2)
# apply: -C X -> --git-dir=X and strip ../
if (match(line, /-C ([^ ]*)/, a)) {
gsub(/-C [^ ]*/, "--git-dir=" a[1], line)
}
gsub(/\.\.\//, "", line)
old[m++] = line
}
/^\+/ { new = substr($0,2); if (old[n++] != new) print old[n-1] " != " new }'
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
0 commit comments