hooks: alint: pass commit to alint fixup cmd `alint fix` is not currently supported for non-HEAD commits. Passing the commit to alint fix in combination with cl/892353691 will make that more clear to users. Bug: 498149194 Change-Id: I2af67023686ac2a07fc3fe7ab51d8cddfc434e9d Reviewed-on: https://gerrit-review.googlesource.com/c/git-repohooks/+/567561 Reviewed-by: Alibek Manabayev <minmax@google.com> Reviewed-by: Lauren Minchin <lminchin@google.com> Tested-by: Marty Heavey <mheavey@google.com> Reviewed-by: Mike Frysinger <vapier@google.com> Commit-Queue: Marty Heavey <mheavey@google.com>
diff --git a/rh/hooks.py b/rh/hooks.py index b41c3ca..faea03d 100644 --- a/rh/hooks.py +++ b/rh/hooks.py
@@ -1304,7 +1304,7 @@ # alint returns exit code 5 or 6 if there are findings with fixes available. fixup_cmd = ( - [alint_path, "fix", "--no_amend"] + [alint_path, "fix", "--no_amend", "--commit", commit] if result.returncode in (5, 6) else None )
diff --git a/rh/hooks_unittest.py b/rh/hooks_unittest.py index bbc8f95..0ab5c4e 100755 --- a/rh/hooks_unittest.py +++ b/rh/hooks_unittest.py
@@ -1204,7 +1204,9 @@ self.project, commit, "desc", diff, options=self.options ) self.assertIsNotNone(ret) - self.assertEqual(ret[0].fixup_cmd, ["alint", "fix", "--no_amend"]) + self.assertEqual( + ret[0].fixup_cmd, ["alint", "fix", "--no_amend", "--commit", commit] + ) self.assertFalse(ret[0].is_warning()) self.assertEqual(ret[0].result.returncode, 5) @@ -1214,7 +1216,9 @@ self.project, commit, "desc", diff, options=self.options ) self.assertIsNotNone(ret) - self.assertEqual(ret[0].fixup_cmd, ["alint", "fix", "--no_amend"]) + self.assertEqual( + ret[0].fixup_cmd, ["alint", "fix", "--no_amend", "--commit", commit] + ) self.assertFalse(ret[0].is_warning()) self.assertEqual(ret[0].result.returncode, 6)