|
Packit |
33f14e |
#!/bin/sh
|
|
Packit |
33f14e |
# Unit tests for vc-list-files
|
|
Packit |
33f14e |
# Copyright (C) 2008-2017 Free Software Foundation, Inc.
|
|
Packit |
33f14e |
# This file is part of the GNUlib Library.
|
|
Packit |
33f14e |
#
|
|
Packit |
33f14e |
# This program is free software: you can redistribute it and/or modify
|
|
Packit |
33f14e |
# it under the terms of the GNU General Public License as published by
|
|
Packit |
33f14e |
# the Free Software Foundation; either version 3 of the License, or
|
|
Packit |
33f14e |
# (at your option) any later version.
|
|
Packit |
33f14e |
#
|
|
Packit |
33f14e |
# This program is distributed in the hope that it will be useful,
|
|
Packit |
33f14e |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
33f14e |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit |
33f14e |
# GNU General Public License for more details.
|
|
Packit |
33f14e |
#
|
|
Packit |
33f14e |
# You should have received a copy of the GNU General Public License
|
|
Packit |
33f14e |
# along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
Packit |
33f14e |
|
|
Packit |
33f14e |
: ${srcdir=.}
|
|
Packit |
33f14e |
. "$srcdir/init.sh"; path_prepend_ "$abs_aux_dir" .
|
|
Packit |
33f14e |
|
|
Packit |
33f14e |
tmpdir=vc-git-$$
|
|
Packit |
33f14e |
GIT_DIR= GIT_WORK_TREE=; unset GIT_DIR GIT_WORK_TREE
|
|
Packit |
33f14e |
|
|
Packit |
33f14e |
fail=1
|
|
Packit |
33f14e |
mkdir $tmpdir && cd $tmpdir &&
|
|
Packit |
33f14e |
# without git, skip the test
|
|
Packit |
33f14e |
# The double use of 'exit' is needed for the reference to $? inside the trap.
|
|
Packit |
33f14e |
{ ( git init -q ) > /dev/null 2>&1 \
|
|
Packit |
33f14e |
|| skip_ "git not found in PATH"; } &&
|
|
Packit |
33f14e |
mkdir d &&
|
|
Packit |
33f14e |
touch d/a b c &&
|
|
Packit |
33f14e |
git config user.email "you@example.com" &&
|
|
Packit |
33f14e |
git config user.name "Your Name" &&
|
|
Packit |
33f14e |
git add . > /dev/null &&
|
|
Packit |
33f14e |
git commit -q -a -m log &&
|
|
Packit |
33f14e |
printf '%s\n' b c d/a > expected &&
|
|
Packit |
33f14e |
vc-list-files > actual &&
|
|
Packit |
33f14e |
compare expected actual &&
|
|
Packit |
33f14e |
fail=0
|
|
Packit |
33f14e |
|
|
Packit |
33f14e |
Exit $fail
|