Re: [PATCH 05/21] git p4 test: use client_view to build the initial client
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 28, 2012, 19:06 UTC
- Message-ID
- <7va9waklbv.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <1348833865-6093-6-git-send-email-pw@padd.com>
Pete Wyckoff <pw@padd.com> writes:
Show 28 quoted lines
> Simplify the code a bit by using an existing function.
>
> Signed-off-by: Pete Wyckoff <pw@padd.com>
> ---
> t/lib-git-p4.sh | 11 ++---------
> 1 file changed, 2 insertions(+), 9 deletions(-)
>
> diff --git a/t/lib-git-p4.sh b/t/lib-git-p4.sh
> index 7061dce..890ee60 100644
> --- a/t/lib-git-p4.sh
> +++ b/t/lib-git-p4.sh
> @@ -74,15 +74,8 @@ start_p4d() {
> fi
>
> # build a client
> - (
> - cd "$cli" &&
> - p4 client -i <<-EOF
> - Client: client
> - Description: client
> - Root: $cli
> - View: //depot/... //client/...
> - EOF
> - )
> + client_view "//depot/... //client/..." &&
> +
> return 0
> }Assuming that writing //depot/... //client/... on the next line indented by a tab is equivalent to writing it on View: line (which I think it is), this looks like an obviously good reuse of the code.
I have to wonder if the use of printf in client_view implementation should be tighted up, though.
diff --git i/t/lib-git-p4.sh w/t/lib-git-p4.sh index 7061dce..4e58289 100644 --- i/t/lib-git-p4.sh +++ w/t/lib-git-p4.sh @@ -128,8 +128,6 @@ client_view() { Root: $cli View: EOF - for arg ; do - printf "\t$arg\n" - done + printf "\t%s\n" "$@" ) | p4 client -i }