"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: gotd: initial implementation of the delete-refs capability
To:
Omar Polo <op@omarpolo.com>
Cc:
gameoftrees@openbsd.org
Date:
Fri, 27 Jan 2023 20:37:02 +0100

Download raw body.

Thread
On Fri, Jan 27, 2023 at 06:21:48PM +0100, Omar Polo wrote:
> updated diff

Ok by me, with a suggestion for two follow-up tweaks below:

> +	got send -r $testroot/repo-clone -d foo >$testroot/stdout
> +	ret=$?
> +	if [ $ret -ne 0 ]; then
> +		echo "got send -d failed unexpectedly" >&2
> +		test_done "$testroot" 1
> +		return 1
> +	fi
> +
> +	cat <<EOF >$testroot/stdout.expected
> +Connecting to "origin" ${GOTD_TEST_REPO_URL}
> +Server has deleted refs/heads/foo
> +EOF
> +	if ! cmp -s $testroot/stdout.expected $testroot/stdout; then
> +		diff -u $testroot/stdout.expected $testroot/stdout
> +		test_done "$testroot" 1
> +		return 1
> +	fi

Could we verify the ref-list reported by the server via got clone -l,
before and after deletion?

> +
> +	# now try again but while also updating another branch
> +	# other than deleting `foo'.
> +
> +	(cd $testroot/wt && got up -b main && \
> +		echo 'more alpha' > alpha && \
> +		got commit -m 'edit alpha on main' && \
> +		got send -q -b foo) >/dev/null
> +
> +	got send -r $testroot/repo-clone -d foo -b main | \
> +		grep '^Server has' >$testroot/stdout
> +	ret=$?
> +	if [ $ret -ne 0 ]; then
> +		echo "got send -d foo -b main failed unexpectedly" >&2
> +		test_done "$testroot" 1
> +		return 1
> +	fi
> +
> +	cat <<EOF >$testroot/stdout.expected
> +Server has accepted refs/heads/main
> +Server has deleted refs/heads/foo
> +EOF
> +	if ! cmp -s $testroot/stdout.expected $testroot/stdout; then
> +		diff -u $testroot/stdout.expected $testroot/stdout
> +		test_done "$testroot" 1
> +		return 1
> +	fi

Same here.

> +
> +	test_done "$testroot" 0
> +}
> +
>  test_parseargs "$@"
>  run_test test_send_basic
>  run_test test_fetch_more_history
>  run_test test_send_new_empty_branch
> +run_test test_delete_branch
> 
>