t7003: fix subdirectory-filter test
The test would not fail if the filtering failed to do anything, since in test -z "$(git diff HEAD directorymoved:newsubdir)"' 'directorymoved:newsubdir' is not valid, so git-diff fails without printing anything on stdout. But then the exit status of git-diff is lost, whereas test -z "" succeeds. Use 'git diff --exit-code' instead, which does the right thing and has the added bonus of showing the differences if there are any. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Thomas Rast committed
Jul 29, 2010 at 17:10 UTC
3c8710aeaa81a70ecad9facfc332d843ee37de35
1 file changed
+2
-1
t/t7003-filter-branch.sh
+2
-1
@@ -147,7 +147,8 @@ test_expect_success 'use index-filter to move into a subdirectory' '
147
GIT_INDEX_FILE=\$GIT_INDEX_FILE.new \
148
git update-index --index-info &&
149
mv \"\$GIT_INDEX_FILE.new\" \"\$GIT_INDEX_FILE\"" directorymoved &&
150
- test -z "$(git diff HEAD directorymoved:newsubdir)"'
150
+ git diff --exit-code HEAD directorymoved:newsubdir
151
+'
152
153
test_expect_success 'stops when msg filter fails' '
154
old=$(git rev-parse HEAD) &&