git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: Richard Hansen <rhansen@bbn.com>, git@vger.kernel.org
Cc: srabbelier@gmail.com, felipe.contreras@gmail.com,
	Richard Hansen <rhansen@bbn.com>
Subject: RE: [PATCH v4 12/10] git-remote-testgit: support the new 'force' option
Date: Tue, 29 Oct 2013 02:41:51 -0600	[thread overview]
Message-ID: <526f74cf8307f_37cdfb1e7c31@nysa.notmuch> (raw)
In-Reply-To: <1382908589-7000-1-git-send-email-rhansen@bbn.com>

Richard Hansen wrote:
> Signed-off-by: Richard Hansen <rhansen@bbn.com>
> ---
>  git-remote-testgit.sh | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/git-remote-testgit.sh b/git-remote-testgit.sh
> index 6d2f282..80546c1 100755
> --- a/git-remote-testgit.sh
> +++ b/git-remote-testgit.sh
> @@ -6,6 +6,7 @@ url=$2
>  
>  dir="$GIT_DIR/testgit/$alias"
>  prefix="refs/testgit/$alias"
> +forcearg=
>  
>  default_refspec="refs/heads/*:${prefix}/heads/*"
>  
> @@ -39,6 +40,7 @@ do
>  		fi
>  		test -n "$GIT_REMOTE_TESTGIT_SIGNED_TAGS" && echo "signed-tags"
>  		test -n "$GIT_REMOTE_TESTGIT_NO_PRIVATE_UPDATE" && echo "no-private-update"
> +		echo 'option'
>  		echo
>  		;;
>  	list)
> @@ -93,6 +95,7 @@ do
>  		before=$(git for-each-ref --format=' %(refname) %(objectname) ')
>  
>  		git fast-import \
> +			${forcearg} \
>  			${testgitmarks:+"--import-marks=$testgitmarks"} \
>  			${testgitmarks:+"--export-marks=$testgitmarks"} \
>  			--quiet
> @@ -115,6 +118,21 @@ do
>  
>  		echo
>  		;;
> +	option\ *)
> +		read cmd opt val <<EOF
> +${line}
> +EOF

We can do <<-EOF to align this properly.

Also, I don't see why all the variables are ${foo} instead of $foo.

> +		case ${opt} in
> +		    force)

I think the convention is to align these:

case $opt in
force)

> +			case ${val} in
> +			    true) forcearg=--force; echo 'ok';;
> +			    false) forcearg=; echo 'ok';;
> +			    *) printf %s\\n "error '${val}'\
> + is not a valid value for option ${opt}";;

I think this is packing a lot of stuff and it's not that readable.

Moreover, this is not for production purposes, it's for testing purposes and a
guideline, I think this suffices.


	option\ *)
		read cmd opt val <<-EOF
		$line
		EOF
		case $opt in
		force)
			test $val = "true" && force="true" || force=
			echo "ok"
			;;
		*)
			echo "unsupported"
			;;
		esac
		;;

But this is definetly good to have, will merge.

-- 
Felipe Contreras

  parent reply	other threads:[~2013-10-29  8:52 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-27  7:05 [PATCH v4 00/10] transport-helper: updates Felipe Contreras
2013-10-27  7:05 ` [PATCH v4 03/10] transport-helper: check for 'forced update' message Felipe Contreras
2013-10-27  7:05 ` [PATCH v4 05/10] fast-export: add new --refspec option Felipe Contreras
2013-10-27  7:05 ` [PATCH v4 06/10] transport-helper: add support for old:new refspec Felipe Contreras
2013-10-27  7:05 ` [PATCH v4 02/10] transport-helper: fix extra lines Felipe Contreras
2013-10-27  7:05 ` [PATCH v4 09/10] transport-helper: add support to delete branches Felipe Contreras
2013-10-27  7:05 ` [PATCH v4 01/10] transport-helper: add 'force' to 'export' helpers Felipe Contreras
2013-10-27 21:11   ` [PATCH v4 11/10] fixup! " Richard Hansen
2013-10-27  7:05 ` [PATCH v4 08/10] fast-export: add support to delete refs Felipe Contreras
2013-10-27  7:05 ` [PATCH v4 10/10] transport-helper: don't update refs in dry-run Felipe Contreras
2013-10-27  7:05 ` [PATCH v4 07/10] fast-import: add support to delete refs Felipe Contreras
2013-10-27 10:24   ` Eric Sunshine
2013-10-27  7:05 ` [PATCH v4 04/10] fast-export: improve argument parsing Felipe Contreras
2013-10-27 21:16 ` [PATCH v4 12/10] git-remote-testgit: support the new 'force' option Richard Hansen
2013-10-27 21:16   ` [PATCH v4 13/10] test: remote-helper: add test for force pushes Richard Hansen
2013-10-29  8:41   ` Felipe Contreras [this message]
2013-11-10 22:46     ` [PATCH v4 12/10] git-remote-testgit: support the new 'force' option Richard Hansen
2013-11-11  3:57       ` Felipe Contreras
2013-11-11 18:28       ` Junio C Hamano
2013-11-12  6:09         ` Richard Hansen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=526f74cf8307f_37cdfb1e7c31@nysa.notmuch \
    --to=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=rhansen@bbn.com \
    --cc=srabbelier@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).