git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 06/21] git p4 test: use client_view in t9806

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 28, 2012, 19:11 UTC
Message-ID
<7v4nmiklbt.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1348833865-6093-7-git-send-email-pw@padd.com>
Pete Wyckoff <pw@padd.com> writes:
Show 56 quoted lines
> Use the standard client_view function from lib-git-p4.sh
> instead of building one by hand.  This requires a bit of
> rework, using the current value of $P4CLIENT for the client
> name.  It also reorganizes the test to isolate changes to
> $P4CLIENT and $cli in a subshell.
>
> Signed-off-by: Pete Wyckoff <pw@padd.com>
> ---
>  t/lib-git-p4.sh           |  4 ++--
>  t/t9806-git-p4-options.sh | 50 ++++++++++++++++++++++-------------------------
>  2 files changed, 25 insertions(+), 29 deletions(-)
>
> diff --git a/t/lib-git-p4.sh b/t/lib-git-p4.sh
> index 890ee60..d558dd0 100644
> --- a/t/lib-git-p4.sh
> +++ b/t/lib-git-p4.sh
> @@ -116,8 +116,8 @@ marshal_dump() {
>  client_view() {
>  	(
>  		cat <<-EOF &&
> -		Client: client
> -		Description: client
> +		Client: $P4CLIENT
> +		Description: $P4CLIENT
>  		Root: $cli
>  		View:
>  		EOF
> diff --git a/t/t9806-git-p4-options.sh b/t/t9806-git-p4-options.sh
> index fa40cc8..37ca30a 100755
> --- a/t/t9806-git-p4-options.sh
> +++ b/t/t9806-git-p4-options.sh
> @@ -126,37 +126,33 @@ test_expect_success 'clone --use-client-spec' '
>  		exec >/dev/null &&
>  		test_must_fail git p4 clone --dest="$git" --use-client-spec
>  	) &&
> -	cli2=$(test-path-utils real_path "$TRASH_DIRECTORY/cli2") &&
> +	# build a different client
> +	cli2="$TRASH_DIRECTORY/cli2" &&
>  	mkdir -p "$cli2" &&
>  	test_when_finished "rmdir \"$cli2\"" &&
>  	test_when_finished cleanup_git &&
> ...
> -	# same thing again, this time with variable instead of option
>  	(
> ...
> +		# group P4CLIENT and cli changes in a sub-shell
> +		P4CLIENT=client2 &&
> +		cli="$cli2" &&
> +		client_view "//depot/sub/... //client2/bus/..." &&
> +		git p4 clone --dest="$git" --use-client-spec //depot/... &&
> +		(
> +			cd "$git" &&
> +			test_path_is_file bus/dir/f4 &&
> +			test_path_is_missing file1
> +		) &&
> +		cleanup_git &&

Hmm, the use of "test-path-utils real_path" to form cli2 in the original was not necessary at all?

Show 10 quoted lines
> +		# same thing again, this time with variable instead of option
> +		(
> +			cd "$git" &&
> +			git init &&
> +			git config git-p4.useClientSpec true &&
> +			git p4 sync //depot/... &&
> +			git checkout -b master p4/master &&
> +			test_path_is_file bus/dir/f4 &&
> +			test_path_is_missing file1
> +		)

Do you need a separate sub-shell inside a sub-shell we are already in that you called client_view in?

>  	)
>  '
Previous: Pete WyckoffNext: Pete Wyckoff
Message 11 of 29 in “git p4: work on cygwin”
  1. 00/21 git p4: work on cygwinPete Wyckoff, Sep 28, 2012
  2. 01/21 git p4: temp branch name should use / even on windowsPete Wyckoff, Sep 28, 2012
  3. 02/21 git p4: remove unused importsPete Wyckoff, Sep 28, 2012
  4. 03/21 git p4: generate better error message for bad depot pathPete Wyckoff, Sep 28, 2012
  5. Junio C HamanoSep 28, 2012
  6. 04/21 git p4: fix error message when "describe -s" failsPete Wyckoff, Sep 28, 2012
  7. Junio C HamanoSep 28, 2012
  8. 05/21 git p4 test: use client_view to build the initial clientPete Wyckoff, Sep 28, 2012
  9. Junio C HamanoSep 28, 2012
  10. 06/21 git p4 test: use client_view in t9806Pete Wyckoff, Sep 28, 2012
  11. Junio C HamanoSep 28, 2012
  12. Pete WyckoffJan 27, 2013
  13. 07/21 git p4 test: start p4d inside its db dirPete Wyckoff, Sep 28, 2012
  14. 08/21 git p4 test: translate windows paths for cygwinPete Wyckoff, Sep 28, 2012
  15. 09/21 git p4: remove unreachable windows \r\n conversion codePete Wyckoff, Sep 28, 2012
  16. 10/21 git p4: scrub crlf for utf16 files on windowsPete Wyckoff, Sep 28, 2012
  17. 11/21 git p4 test: newline handlingPete Wyckoff, Sep 28, 2012
  18. 12/21 git p4 test: use LineEnd unix in windows tests tooPete Wyckoff, Sep 28, 2012
  19. 13/21 git p4 test: avoid wildcard * in windowsPete Wyckoff, Sep 28, 2012
  20. 14/21 git p4: cygwin p4 client does not mark read-onlyPete Wyckoff, Sep 28, 2012
  21. 15/21 git p4 test: disable chmod test for cygwinPete Wyckoff, Sep 28, 2012
  22. Johannes SixtSep 28, 2012
  23. 16/21 git p4: disable read-only attribute before deletingPete Wyckoff, Sep 28, 2012
  24. 17/21 git p4: avoid shell when mapping usersPete Wyckoff, Sep 28, 2012
  25. 18/21 git p4: avoid shell when invoking git rev-listPete Wyckoff, Sep 28, 2012
  26. 19/21 git p4: avoid shell when invoking git config --get-allPete Wyckoff, Sep 28, 2012
  27. 20/21 git p4: avoid shell when calling git configPete Wyckoff, Sep 28, 2012
  28. 21/21 git p4: introduce gitConfigBoolPete Wyckoff, Sep 28, 2012
  29. Junio C HamanoSep 28, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.