git/t/t9140-git-svn-reset.sh
Đoàn Trần Công Danh 37eb90f79a t: convert fgrep usage to "grep -F"
Despite POSIX states that:

> The old egrep and fgrep commands are likely to be supported for many
> years to come as implementation extensions, allowing historical
> applications to operate unmodified.

GNU grep 3.8 started to warn[1]:

> The egrep and fgrep commands, which have been deprecated since
> release 2.5.3 (2007), now warn that they are obsolescent and should
> be replaced by grep -E and grep -F.

Prepare for their removal in the future.

[1]: https://lists.gnu.org/archive/html/info-gnu/2022-09/msg00001.html

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-09-21 11:00:19 -07:00

66 lines
1.5 KiB
Bash
Executable file

#!/bin/sh
#
# Copyright (c) 2009 Ben Jackson
#
test_description='git svn reset'
. ./lib-git-svn.sh
test_expect_success 'setup test repository' '
svn_cmd co "$svnrepo" s &&
(
cd s &&
mkdir vis &&
echo always visible > vis/vis.txt &&
svn_cmd add vis &&
svn_cmd commit -m "create visible files" &&
mkdir hid &&
echo initially hidden > hid/hid.txt &&
svn_cmd add hid &&
svn_cmd commit -m "create initially hidden files" &&
svn_cmd up &&
echo mod >> vis/vis.txt &&
svn_cmd commit -m "modify vis" &&
svn_cmd up
)
'
test_expect_success 'clone SVN repository with hidden directory' '
git svn init "$svnrepo" g &&
( cd g && git svn fetch --ignore-paths="^hid" )
'
test_expect_success 'modify hidden file in SVN repo' '
( cd s &&
echo mod hidden >> hid/hid.txt &&
svn_cmd commit -m "modify hid" &&
svn_cmd up
)
'
test_expect_success 'fetch fails on modified hidden file' '
( cd g &&
git svn find-rev refs/remotes/git-svn > ../expect &&
test_must_fail git svn fetch 2> ../errors &&
git svn find-rev refs/remotes/git-svn > ../expect2 ) &&
grep "not found in commit" errors &&
test_cmp expect expect2
'
test_expect_success 'reset unwinds back to r1' '
( cd g &&
git svn reset -r1 &&
git svn find-rev refs/remotes/git-svn > ../expect2 ) &&
echo 1 >expect &&
test_cmp expect expect2
'
test_expect_success 'refetch succeeds not ignoring any files' '
( cd g &&
git svn fetch &&
git svn rebase &&
grep "mod hidden" hid/hid.txt
)
'
test_done