doc-base icon indicating copy to clipboard operation
doc-base copied to clipboard

Only checks for `[skip-revcheck]` at start of commit messages

Open alfsb opened this issue 3 months ago • 12 comments

This PR changes the [skip-revcheck] function. Instead of being activated from anywhere, it only be effective if positioned at the beginning of the commit message, and ignored otherwise.

This is the root cause of https://github.com/php/doc-base/issues/133 .

This PR resolves the issue above (and avoid future cases) by changing the meaning of some commits that have [skip-revcheck] outside of begging of commit messages. They are:

git show --no-patch 3e871fe7eab38f9b0398569c57a1dd0c21e69652 # accidental
git show --no-patch 26e26a95fdc3aac9b464068953ea3105dee00f14 # accidental
git show --no-patch 8f6fd5c55ab10709a4ff8daf6140dea422c1363c # accidental
git show --no-patch f80105b4fc1196bd8d5fecb98d686b580b1ff65d # accidental
git show --no-patch 9d6701a7205c16fc24062e90e2508bb498fbdac5 # accidental
git show --no-patch 38ce6211e1da2f62833f8961511f3c980ea9093b # intended
git show --no-patch 1bfd6a1d79b134d49bf17a1880b719e0efd04198 # intended
git show --no-patch 8afaddf6cc8a90ccba001a52349cb751fcfeb558 # intended

The oldest commits shows that [skip-revcheck] function is originally intended to be used from anywhere in the commit message. But most occurrences are now of accidental usage. Not only are most accidental, but all accidental occurrences are recent ones. This shows that [skip-revcheck] usage shifted from being used anywhere on commit messages.

This PR does not changes the interpretation of other 142 [skip-revcheck] usages, all of them occurring at the start of commit messages.

The old most accidental hashes are good examples of what I'm calling accidental usage. f80105 is a squashed commit, and 9d6701 is a reversion one. In both cases, these "grouping" commits includes the one liners of all grouped commits, and if one of individual commit messages contains [skip-revcheck], so this is the case with the grouped commit message.

This will change files from "ok" to "old" in almost all translations. As for now, the changes are:

before	ok	old	
after	ok	old	diff
			
de	3148	32	
de	3148	32	0
			
es	3365	3746	
es	3359	3752	6
			
fr	10998	33	
fr	10959	72	39
			
it	172	244	
it	171	245	1
			
ja	7385	236	
ja	7373	248	12
			
pl	1007	42	
pl	1006	43	1
			
pt_BR	8142	1	
pt_BR	8142	1	0
			
ro	161	167	
ro	160	168	1
			
ru	11010	27	
ru	10984	53	26
			
tr	3235	216	
tr	3230	221	5
			
uk	337	79	
uk	336	80	1
			
zh	3092	125	
zh	3085	132	7

That is, about a hundred in total.

The Files Changed listing is a bit longer than needed, but this is because this PR depends on https://github.com/php/doc-base/pull/180 . After it is merged, the changed set will shrink to the erasing of backport.php, removing the function parseInto of GitLogParser and:

@@ -142,19 +73,11 @@ class GitLogParser
 
             while ( $proc->live && str_starts_with( $proc->line , '    ' ) )
             {
-                if ( LOOSE_SKIP_REVCHECK ) // https://github.com/php/doc-base/pull/132
-                {
-                    // Messages that contains [skip-revcheck] flags entire commit as ignored.
-                    if ( str_contains( $proc->line , '[skip-revcheck]' ) )
-                        $skip = true;
-                }
-                else
-                {
-                    // Messages that start with [skip-revcheck] flags entire commit as ignored.
-                    $lcnt++;
-                    if ( $lcnt == 1 && str_starts_with( trim( $line ) , '[skip-revcheck]' ) )
-                        $skip = true;
-                }
+                // Messages that start with [skip-revcheck] flags entire commit as ignored.
+                $lcnt++;
+                if ( $lcnt == 1 && str_starts_with( trim( $proc->line ) , '[skip-revcheck]' ) )
+                    $skip = true;
+
                 $proc->next();
             }

Reviews and comments welcome. I also plan to write about usage of [skip-revcheck] somewhere on https://github.com/php/doc-base/tree/master/docs . Suggestions of where?

Draft state, waiting for https://github.com/php/doc-base/pull/180 .

alfsb avatar Nov 18 '24 12:11 alfsb