[PATCH] dim: make apply-patch fail again
Jani Nikula
jani.nikula at linux.intel.com
Wed Oct 17 10:41:01 UTC 2018
On Wed, 17 Oct 2018, Daniel Vetter <daniel.vetter at ffwll.ch> wrote:
> On Wed, Oct 17, 2018 at 11:43 AM Jani Nikula
> <jani.nikula at linux.intel.com> wrote:
>>
>> On Wed, 17 Oct 2018, Daniel Vetter <daniel.vetter at ffwll.ch> wrote:
>> > Somewhere since I originally typed this and today git apply-mbox lost
>> > the error status for "this patch didn't apply cleanly". So instead of
>> > exiting, we happily continue on and add Link: tags and other nonsense
>> > to the current patch, instead of the one that we wanted to apply.
>> >
>> > Fix this.
>> >
>> > Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
>> > ---
>> > dim | 4 ++++
>> > 1 file changed, 4 insertions(+)
>> >
>> > diff --git a/dim b/dim
>> > index af092e50bb08..915de89d48b7 100755
>> > --- a/dim
>> > +++ b/dim
>> > @@ -926,6 +926,10 @@ function apply_patch #patch_file
>> >
>> > git am --scissors -3 $sob "$@" $patch
>> >
>> > + if [ -d "$(git_dir)/rebase-apply" ] ; then
>> > + warn_or_fail "git apply-mbox failed"
>> > + fi
>> > +
>>
>> Or this?
>
> We have set -e, which worked way back, but doesn't anymore because git
> am changed. Whether it's implicit or an explicit if doesn't change
> that. Note that from my testing git am still fails on lots of errors,
> but it stopped failing for when it managed to parse the mail, but
> failed to apply it cleanly. Which is the case I'm catching here.
Did you actually try to check the git am exit status on the command
line?
I'm pretty sure we introduced this when we wrapped the apply_patch call
in dim_apply_branch in an if statement. The set -e does not propagate
from there on.
For fun:
#!/bin/bash
set -e
foo()
{
/bin/false
return 0
}
if foo; then
echo "foo returned true"
else
echo "foo returned false"
fi
foo
echo "foo returned"
BR,
Jani.
> -Daniel
>
>>
>> if ! git am --scissors -3 $sob "$@" $patch; then
>> return 1
>> fi
>>
>> > if [ -n "$message_id" ]; then
>> > dim_commit_add_tag "Link: https://patchwork.freedesktop.org/patch/msgid/$message_id"
>> > else
>>
>> --
>> Jani Nikula, Intel Open Source Graphics Center
--
Jani Nikula, Intel Open Source Graphics Center
More information about the dim-tools
mailing list