From 10d17a75e06575dd7d1a37795700cada515cc7d8 Mon Sep 17 00:00:00 2001 From: Alexandre Vicenzi Date: Sep 07 2022 16:28:07 +0000 Subject: git_sort: Check if Patch-mainline tag exists If Patch-mainline and Git-commit tags are missing in the patch, sort script will fail with: IndexError: list index out of range This change ensures that Patch-mainline tag is present and if not, raise an error to warn the user. Signed-off-by: Alexandre Vicenzi --- diff --git a/scripts/git_sort/lib.py b/scripts/git_sort/lib.py index c656116..59d08bf 100644 --- a/scripts/git_sort/lib.py +++ b/scripts/git_sort/lib.py @@ -277,6 +277,12 @@ class InputEntry(object): raise exc.KSError("Multiple Patch-mainline tags found. Patch \"%s\" is " "tagged improperly." % (name,)) + if not mainline_tags: + raise exc.KSError( + "There is a problem with patch \"%s\". " + "The Patch-mainline tag is missing." % ( + name,)) + if not commit_tags: self.dest_head = git_sort.oot mainline = mainline_tags[0]