From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Ping Yin <pkufranky@gmail.com>
Cc: git@vger.kernel.org, gitster@pobox.com
Subject: Re: [PATCH v2] git-submodule: Don't die when command fails for one submodule
Date: Wed, 5 Mar 2008 17:48:37 +0100 (CET) [thread overview]
Message-ID: <alpine.LSU.1.00.0803051742290.15786@racer.site> (raw)
In-Reply-To: <1204730478-22027-1-git-send-email-pkufranky@gmail.com>
Hi,
On Wed, 5 Mar 2008, Ping Yin wrote:
> @@ -221,29 +229,40 @@ cmd_init()
> done
>
> git ls-files --stage -- "$@" | grep -e '^160000 ' |
> + {
> + total=0
> + success=0
> while read mode sha1 stage path
> do
> + total=$(( $total + 1 ))
> # Skip already registered paths
> - name=$(module_name "$path") || exit
> + name=$(module_name "$path") || continue
What about this case? Was the comment misleading?
> url=$(git config submodule."$name".url)
> - test -z "$url" || continue
> + test -n "$url" && success=$(( $success + 1 )) && continue
Why counting? Why not just 'status=0 && continue'?
>
> - git config submodule."$name".url "$url" ||
> - die "Failed to register url for submodule path '$path'"
> -
> - say "Submodule '$name' ($url) registered for path '$path'"
> + if git config submodule."$name".url "$url"
> + then
> + say "Submodule '$name' ($url) registered for path '$path'"
> + else
> + say "Failed to register url for submodule path '$path'"
> + continue
> + fi
> + success=$(( $success + 1 ))
> done
> + test $success = $total
> + }
> }
>
> #
Note: I have not even begun to audit if one of your returns should not
have been a "status=0 && continue" instead.
> @@ -358,9 +392,11 @@ cmd_status()
> done
>
> git ls-files --stage -- "$@" | grep -e '^160000 ' |
> + {
> + exit_status=0
> while read mode sha1 stage path
> do
> - name=$(module_name "$path") || exit
> + ! name=$(module_name "$path") && exit_status=1 && continue
> url=$(git config submodule."$name".url)
> if test -z "$url" || ! test -d "$path"/.git
> then
> @@ -380,6 +416,8 @@ cmd_status()
> say "+$sha1 $path$revname"
> fi
> done
> + exit $exit_status
> + }
> }
But here you use the simpler paradigm of setting exit_status? Why that
complicated and ugly "total" and "success" counting before?
Ciao,
Dscho
next prev parent reply other threads:[~2008-03-05 16:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-05 15:21 [PATCH v2] git-submodule: Don't die when command fails for one submodule Ping Yin
2008-03-05 16:48 ` Johannes Schindelin [this message]
2008-03-05 17:20 ` Ping Yin
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LSU.1.00.0803051742290.15786@racer.site \
--to=johannes.schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=pkufranky@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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).