From: Richard Hansen <rhansen@bbn.com>
To: Felipe Contreras <felipe.contreras@gmail.com>, git@vger.kernel.org
Cc: srabbelier@gmail.com
Subject: Re: [PATCH v4 12/10] git-remote-testgit: support the new 'force' option
Date: Sun, 10 Nov 2013 17:46:15 -0500 [thread overview]
Message-ID: <52800CB7.7080905@bbn.com> (raw)
In-Reply-To: <526f74cf8307f_37cdfb1e7c31@nysa.notmuch>
On 2013-10-29 04:41, Felipe Contreras wrote:
> 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.
Good point. I personally avoid tabs whenever possible, and <<- only
works with tabs, so I'm in the habit of doing <<EOF.
>
> Also, I don't see why all the variables are ${foo} instead of $foo.
I'm in the habit of doing ${foo} because I like the consistency --
sometimes you need them to disambiguate, and sometimes you need special
expansions like ${foo##bar} or ${foo:-bar}.
In this case it's actually less consistent to do ${foo} because the rest
of the file doesn't use {} when not needed, so I agree with your change.
>
>> + case ${opt} in
>> + force)
>
> I think the convention is to align these:
>
> case $opt in
> force)
The existing case statement in this file indents the patterns the same
amount as the case statement, so this should be aligned to match.
In general I rarely see the case patterns indented at the same level as
the case statement, possibly because Emacs shell-mode indents the
patterns more than the case statement (by default). The POSIX spec
contains a mix of styles:
* the normative text documenting the format of a 'case' construct
indents the patterns more than the 'case' statement
* two of the four non-normative examples indent the patterns
more than the 'case' statements; the other two do not
>
>> + 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
> ;;
Works for me.
>
> But this is definetly good to have, will merge.
Thanks,
Richard
next prev parent reply other threads:[~2013-11-10 22:46 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 ` [PATCH v4 12/10] git-remote-testgit: support the new 'force' option Felipe Contreras
2013-11-10 22:46 ` Richard Hansen [this message]
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=52800CB7.7080905@bbn.com \
--to=rhansen@bbn.com \
--cc=felipe.contreras@gmail.com \
--cc=git@vger.kernel.org \
--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).