#!/bin/sh
# Ensure things work in a git worktree, for which .git is a file.

. "${srcdir=.}/init.sh"; path_prepend_ ..
print_ver_ vc-dwim

require_git_

# if git isn't new enough to support worktree, just skip this test.
if git worktree --help >/dev/null; then :; else
  exit 77
fi

git init > /dev/null			\
  && touch x				\
  && git add .				\
  && git commit -m m . > /dev/null	\
  && git worktree add wt		\
  && cd wt				\
    || framework_failure_

fail=0
vc-dwim --init || fail=1
test -h ChangeLog || fail=1

Exit $fail
