On Thu, Dec 01, 2016 at 09:46:51AM +0000, Stephen Finucane wrote:

> These tools are currently broken, but before beginning surgery let's
> clean things up. Use standard 4 spaces and the longer, but easier to
> read, if-else-fi syntax for comparison.
> 
> Missing license headers are added for completeness sake.
> 
> Signed-off-by: Stephen Finucane <step...@that.guru>
> Cc: Paul Jakma <p...@jakma.org>
> Cc: Tom Rini <tr...@konsulko.com>
[snip]
> -update_patches()
[snip]
> -    hash=$(get_patchwork_hash $rev) \
> -      || { echo "E: failed to hash rev $rev." >&2; continue; }
> -    id=$(get_patch_id $hash) \
> -      || { echo "E: failed to find patch for rev $rev." >&2; continue; }
> -    reason="$(set_patch_state $id $3 $rev)" \
> -      || { echo "E: failed to update patch #$id${reason:+: $reason}." >&2; 
> continue; }
[snip]
> +        hash=$(get_patchwork_hash $rev)
> +        if [ -z "$hash" ]; then
> +            echo "E: failed to hash rev $rev." >&2
> +            continue
> +        fi
> +        id=$(get_patch_id $hash)
> +        if [ -z "$id" ]; then
> +            echo "E: failed to find patch for rev $rev." >&2
> +            continue
> +        fi
> +        reason="$(set_patch_state $id $3 $rev)"
> +        if [ -z "$reason" ]; then
> +            echo "E: failed to update patch #$id${reason:+: $reason}." >&2
> +            continue
> +        fi

These are not quite equivalent.  hash and id return a string on success
or empty on failure, so the conversion is fine.  set_patch_state is the
opposite.  On success we say nothing and on failure we get output (_but_
in both cases, exit code is 0, confirmed that by trying to modify a
patch in another project just now).  So it should be '! -z "$reason"'
here.

After fixing that:

Tested-by: Tom Rini <tr...@konsulko.com>

-- 
Tom

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Patchwork mailing list
Patchwork@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/patchwork

Reply via email to