Subject: Re: [PATCH 5/7] t5540-http-push: check existence of fetched files

From: Clemens Buchacher <[email-masked]>
Date: Sun, 25 Oct 2009 17:49:13 +0100

On Sun, Oct 25, 2009 at 11:22:27PM +0800, Tay Ray Chuan wrote:

>  	# By reset, we force git to retrieve the object
>  	(cd "$ROOT_PATH"/fetch_unpacked &&
>  	 git reset --hard HEAD^ &&
>  	 git remote rm origin &&
>  	 git reflog expire --expire=0 --all &&
>  	 git prune &&
> -	 git push -f -v $HTTPD_URL/test_repo_unpacked.git master)
> +	 test ! -e ".git/objects/$COMMIT_PATH" &&
> +	 git push -f -v $HTTPD_URL/test_repo_unpacked.git master &&
> +	 test -e ".git/objects/$COMMIT_PATH")
>  '

This fails with smart HTTP. First of all, the objects are packed,
so I substituted the above with

 ! git rev-list -1 $HEAD &&
 git push -f -v $HTTPD_GIT_URL/test_repo_unpacked.git master &&
 git rev-list -1 $HEAD > rev-list.out &&
 test -n rev-list.out

That should be an equivalent test, right? But still, why should push
re-fetch the commit we just pruned? Smart HTTP does not do that and
therefore fails the last rev-list test:

 ++ git rev-list -1 9d498b0bbc2a25438e2fbd19081948da86028c23
 fatal: bad object 9d498b0bbc2a25438e2fbd19081948da86028c23

Clemens