On Tue, May 14, 2019 at 02:19:36PM +0200, Ævar Arnfjörð Bjarmason wrote:
> Aside from this change, I wonder if making "fetch" optionally "exit 1"
> if no refs were updated would be useful, as in the below WIP. Of course
> it would be better to distinguish errors from "no refs to update".
That seems very sensible to me, as long as it's an optional flag as you
have it here.
> @@ -133,6 +135,8 @@ static struct option builtin_fetch_options[] = {
> { OPTION_CALLBACK, 0, "recurse-submodules", &recurse_submodules,
> N_("on-demand"),
> N_("control recursive fetching of submodules"),
> PARSE_OPT_OPTARG, option_fetch_parse_recurse_submodules },
> + OPT_BOOL(0, "exit-code", &exit_code,
> + N_("exit successfully if refs are updated")),
I think it makes sense to flip this explanation: "exit non-zero if no
refs are updated" or "treat it as an error if no refs are updated".
Since the default behavior is already to exit successfully in this case. :)
We may also want to advertise a particular result code so callers can
distinguish it from regular die() errors.
-Peff