[libcamera-devel,2/4] utils: checkstyle.py: Initialise staged trailers
diff mbox series

Message ID 20230711133915.650485-3-kieran.bingham@ideasonboard.com
State Accepted
Commit 37106ba02a699eb485edcc2e5058dcaf25ee92a0
Headers show
Series
  • utils: checkstyle.py: Fix Trailer handling
Related show

Commit Message

Kieran Bingham July 11, 2023, 1:39 p.m. UTC
There are no possible Trailers for staged changes as the commit message
has not yet been written.

Initialise the empty trailers when the commit object is initialised.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 utils/checkstyle.py | 3 +++
 1 file changed, 3 insertions(+)

Comments

Umang Jain July 11, 2023, 1:49 p.m. UTC | #1
Hi Kieran

Thank you  for the patch.

On 7/11/23 7:09 PM, Kieran Bingham via libcamera-devel wrote:
> There are no possible Trailers for staged changes as the commit message
> has not yet been written.
>
> Initialise the empty trailers when the commit object is initialised.
>
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>

> ---
>   utils/checkstyle.py | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/utils/checkstyle.py b/utils/checkstyle.py
> index 5a1268064d31..2ba3165b8ecd 100755
> --- a/utils/checkstyle.py
> +++ b/utils/checkstyle.py
> @@ -253,6 +253,9 @@ class StagedChanges(Commit):
>       def __init__(self):
>           Commit.__init__(self, '')
>   
> +        # There are no trailers to parse on a Staged Change.
> +        self._trailers = []
> +
>       def _parse(self):
>           ret = subprocess.run(['git', 'diff', '--staged', '--name-status'],
>                                stdout=subprocess.PIPE).stdout.decode('utf-8')

Patch
diff mbox series

diff --git a/utils/checkstyle.py b/utils/checkstyle.py
index 5a1268064d31..2ba3165b8ecd 100755
--- a/utils/checkstyle.py
+++ b/utils/checkstyle.py
@@ -253,6 +253,9 @@  class StagedChanges(Commit):
     def __init__(self):
         Commit.__init__(self, '')
 
+        # There are no trailers to parse on a Staged Change.
+        self._trailers = []
+
     def _parse(self):
         ret = subprocess.run(['git', 'diff', '--staged', '--name-status'],
                              stdout=subprocess.PIPE).stdout.decode('utf-8')