Integrated: 1854: Add "clean" label for merge PRs that have no merge resolution
Zhao Song
zsong at openjdk.org
Thu Apr 13 20:02:41 UTC 2023
On Tue, 11 Apr 2023 22:53:36 GMT, Zhao Song <zsong at openjdk.org> wrote:
> In this patch, PR bot would add clean label to Merge-style PRs if one of the following conditions is met.
>
> 1. There isn't a merge commit at HEAD.
> To verify this condition, we can simply check the number of parents that the HEAD commit has. If the HEAD commit has one parent, it is not a merge commit. However, if it has two parents, then it is considered a merge commit.
>
> 2. The merge commit at HEAD is empty(has no merge resolutions)
> To verify this condition, we should be able to tell the difference between an empty merge commit and a non-empty merge commit.
>
> Using `git show <Hash>` would help us differentiate between this two types of commits.
>
> (1) git show output for empty merge commit
>
> commit 9752b806edafbdc210db00f3099404cd8bd11edf
> Merge: 982b5ad5d8b 99f8d05da93
> Author: Zhao Song <zhao.song at oracle.com>
> Date: Tue Apr 11 14:26:18 2023 -0700
>
> Merge branch 'feature'
>
>
>
> (2) git show output for non-empty merge commit
>
> commit 242a0c07cf3204c662a2f1d55a2ca3e494f955fd (HEAD -> master)
> Merge: af35791d093 0ebf3bd5fe1
> Author: Zhao Song <zhao.song at oracle.com>
> Date: Tue Apr 11 14:38:05 2023 -0700
>
> Merge branch 'feature2'
>
> diff --cc test.java
> index 7c736ab8f08,09647d12eda..a3c5725e39d
> --- a/test.java
> +++ b/test.java
> @@@ -3,4 -3,4 +3,5 @@@
> aaaaa
> +++++
> 11111
> +33333
> + 22222
>
>
>
> We could find that the difference between the two is whether the commit message body is empty or not.
>
> Since we only care about commit message body, we can use the `git show --pretty=format:%b <Hash>` command to extract solely the commit message body.
This pull request has now been integrated.
Changeset: aeedbc8f
Author: Zhao Song <zsong at openjdk.org>
URL: https://git.openjdk.org/skara/commit/aeedbc8f3abdbfa9cc9732d76731d1075f32c8fc
Stats: 180 lines in 5 files changed: 177 ins; 0 del; 3 mod
1854: Add "clean" label for merge PRs that have no merge resolution
Reviewed-by: erikj
-------------
PR: https://git.openjdk.org/skara/pull/1500
More information about the skara-dev
mailing list