Re: [PATCH v4 1/2] stash: reserve exit status 1 for conflicts
- From
Harald Nordgren <haraldnordgren@gmail.com>
- Date
- Sep 3, 2026, 14:45 UTC
- Message-ID
- <CAHwyqnVp6BVGx3+UCqBC_gOCuyq1c62uNi1f7Wyfpxd1KdyM9A@mail.gmail.com>
- In-Reply-To
- <002b1324-0f7f-45ec-9f67-624a41801ff7@gmail.com>
Show 18 quoted lines
> >> + if (fn) {
> >> + ret = fn(argc, argv, prefix, repo);
> >> +
> >> + /*
> >> + * The subcommand implementations return 0 on success, a
> >> + * negative value on failure, and STASH_APPLY_CONFLICT
> >> + * when applying a stash entry resulted in conflicts.
> >> + * Map failures to 128, the status die() uses, so that
> >> + * exit status 1 unambiguously indicates conflicts.
> >> + */
> >> + if (ret < 0)
> >> + return 128;
> >> + return ret;
> >> + } else if (!argc)
> >> return !!push_stash_unassumed(0, NULL, prefix, repo);
> >
> > Style. Once one of "if", "else if" and "else" cascade gains
> > {braches}, others should do so as well.I would love to have a linter rule for this, since I keep forgetting and it's a waste of time for others to remind me.
Maybe we should copy this over from Linux? https://github.com/torvalds/linux/blob/v7.2/scripts/checkpatch.pl#L6270
Harald