Re: [PATCH 3/6] t5000: factor out check_tar

2013-05-20 Thread René Scharfe

Am 20.05.2013 21:54, schrieb Eric Sunshine:

On Mon, May 20, 2013 at 5:58 AM, René Scharfe
 wrote:

+check_tar() {
+   tarfile=$1.tar
+   listfile=$1.lst
+   dir=$1
+   dir_with_prefix=$dir/$2
+
+   test_expect_success ' extract tar archive' '


s/' extract/'extract/


It might be a bit hackish, but I added that single space here and in the 
three other cases intentionally in order to designate sub-tests.


René

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/6] t5000: factor out check_tar

2013-05-20 Thread Eric Sunshine
On Mon, May 20, 2013 at 5:58 AM, René Scharfe
 wrote:
> Create a helper function that extracts a tar archive and checks its
> contents, modelled after check_zip in t5003.
>
> Signed-off-by: René Scharfe 
> ---
>  t/t5000-tar-tree.sh | 35 ++-
>  1 file changed, 22 insertions(+), 13 deletions(-)
>
> diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
> index 41cd609..8337a1f 100755
> --- a/t/t5000-tar-tree.sh
> +++ b/t/t5000-tar-tree.sh
> @@ -30,6 +30,26 @@ GUNZIP=${GUNZIP:-gzip -d}
>
>  SUBSTFORMAT=%H%n
>
> +check_tar() {
> +   tarfile=$1.tar
> +   listfile=$1.lst
> +   dir=$1
> +   dir_with_prefix=$dir/$2
> +
> +   test_expect_success ' extract tar archive' '

s/' extract/'extract/

> +   (mkdir $dir && cd $dir && "$TAR" xf -) <$tarfile
> +   '
> +
> +   test_expect_success ' validate filenames' '

s/' validate/'validate/

> +   (cd ${dir_with_prefix}a && find .) | sort >$listfile &&
> +   test_cmp a.lst $listfile
> +   '
> +
> +   test_expect_success ' validate file contents' '

s/' validate/'validate/

> +   diff -r a ${dir_with_prefix}a
> +   '
> +}
> +
>  test_expect_success \
>  'populate workdir' \
>  'mkdir a &&
> @@ -81,6 +101,8 @@ test_expect_success \
>  'git archive' \
>  'git archive HEAD >b.tar'
>
> +check_tar b
> +
>  test_expect_success \
>  'git tar-tree' \
>  'git tar-tree HEAD >b2.tar'
> @@ -125,19 +147,6 @@ test_expect_success \
>   test_cmp .git/$(git symbolic-ref HEAD) b.commitid'
>
>  test_expect_success \
> -'extract tar archive' \
> -'(mkdir b && cd b && "$TAR" xf -)  -
> -test_expect_success \
> -'validate filenames' \
> -'(cd b/a && find .) | sort >b.lst &&
> - test_cmp a.lst b.lst'
> -
> -test_expect_success \
> -'validate file contents' \
> -'diff -r a b/a'
> -
> -test_expect_success \
>  'git tar-tree with prefix' \
>  'git tar-tree HEAD prefix >c.tar'
>
> --
> 1.8.2.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/6] t5000: factor out check_tar

2013-05-20 Thread René Scharfe
Create a helper function that extracts a tar archive and checks its
contents, modelled after check_zip in t5003.

Signed-off-by: René Scharfe 
---
 t/t5000-tar-tree.sh | 35 ++-
 1 file changed, 22 insertions(+), 13 deletions(-)

diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
index 41cd609..8337a1f 100755
--- a/t/t5000-tar-tree.sh
+++ b/t/t5000-tar-tree.sh
@@ -30,6 +30,26 @@ GUNZIP=${GUNZIP:-gzip -d}
 
 SUBSTFORMAT=%H%n
 
+check_tar() {
+   tarfile=$1.tar
+   listfile=$1.lst
+   dir=$1
+   dir_with_prefix=$dir/$2
+
+   test_expect_success ' extract tar archive' '
+   (mkdir $dir && cd $dir && "$TAR" xf -) <$tarfile
+   '
+
+   test_expect_success ' validate filenames' '
+   (cd ${dir_with_prefix}a && find .) | sort >$listfile &&
+   test_cmp a.lst $listfile
+   '
+
+   test_expect_success ' validate file contents' '
+   diff -r a ${dir_with_prefix}a
+   '
+}
+
 test_expect_success \
 'populate workdir' \
 'mkdir a &&
@@ -81,6 +101,8 @@ test_expect_success \
 'git archive' \
 'git archive HEAD >b.tar'
 
+check_tar b
+
 test_expect_success \
 'git tar-tree' \
 'git tar-tree HEAD >b2.tar'
@@ -125,19 +147,6 @@ test_expect_success \
  test_cmp .git/$(git symbolic-ref HEAD) b.commitid'
 
 test_expect_success \
-'extract tar archive' \
-'(mkdir b && cd b && "$TAR" xf -) b.lst &&
- test_cmp a.lst b.lst'
-
-test_expect_success \
-'validate file contents' \
-'diff -r a b/a'
-
-test_expect_success \
 'git tar-tree with prefix' \
 'git tar-tree HEAD prefix >c.tar'
 
-- 
1.8.2.3

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html