[PATCH v3 4/5] tools: Trivial formatting fixes

Tom Rini trini at konsulko.com
Fri Dec 2 02:07:42 AEDT 2016


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 <stephen at that.guru>
> Cc: Paul Jakma <paul at jakma.org>
> Cc: Tom Rini <trini at 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 <trini at konsulko.com>

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.ozlabs.org/pipermail/patchwork/attachments/20161201/5ce73993/attachment-0001.sig>


More information about the Patchwork mailing list