Re: [PATCH 3/4] Add tests for .git file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Lars Hjemli <hjemli@xxxxxxxxx> writes:

> Verify that the basic plumbing works when .git is a file pointing at
> the real git directory.
>
> Signed-off-by: Lars Hjemli <hjemli@xxxxxxxxx>
> ---
>  t/t0002-gitfile.sh |   71 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 71 insertions(+), 0 deletions(-)
>  create mode 100755 t/t0002-gitfile.sh
>
> diff --git a/t/t0002-gitfile.sh b/t/t0002-gitfile.sh
> new file mode 100755
> index 0000000..f8f39e6
> --- /dev/null
> +++ b/t/t0002-gitfile.sh
> @@ -0,0 +1,71 @@
> +#!/bin/sh
> +
> +test_description='.git file
> +
> +Verify that plumbing commands work when .git is a file
> +'
> +. ./test-lib.sh
> +
> +chkfile() {
> +	D=$(echo $1 | cut -b 1-2) &&
> +	F=$(echo $1 | cut -b 3-40) &&
> +	if test ! -f $REAL/objects/$D/$F

	P=$(echo $1 | sed -e 's|\(..\)\(.*\)|\1/\2\|') &&
        if test ! -f "$REAL/objects/$P"
		...

Although it probably is more efficient to do this with one
process, s/cut/sed/ is mostly a style issue.

Be careful with quoting.  $REAL might contain a $IFS whitespace
as you grabbed it from $(pwd)...

> +test_expect_success 'setup' '
> +	REAL=$(pwd)/.real &&
> +	mv .git $REAL &&
> +	echo "gitdir: $REAL" >.git
> +'
> ...
> +test_expect_success 'check update-index' '
> +	if test -f $REAL/index
> +	then
> +		echo "Hmm, $REAL/index exists?"
> +		false
> +	fi &&
> +	rm -rf $REAL/objects/* &&

... and it matters especially if you do this ;-)

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

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux