Skip to content

Commit c654945

Browse files
author
André L F S Bacci
committed
Only checks for [skip-revcheck] at start of commit messages
Closes GH-133.
1 parent a0e0d81 commit c654945

File tree

3 files changed

+5
-232
lines changed

3 files changed

+5
-232
lines changed

scripts/translation/lib/GitLogParser.php

Lines changed: 5 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -21,75 +21,6 @@
2121

2222
class GitLogParser
2323
{
24-
static function parseInto( string $lang , RevcheckFileList & $list )
25-
{
26-
$cwd = getcwd();
27-
chdir( $lang );
28-
$fp = popen( "git log --name-only" , "r" );
29-
chdir( $cwd );
30-
31-
$hash = "";
32-
$date = "";
33-
$skip = false;
34-
$mcnt = 0;
35-
36-
while ( ( $line = fgets( $fp ) ) !== false )
37-
{
38-
// new commit block
39-
if ( substr( $line , 0 , 7 ) == "commit " )
40-
{
41-
$hash = trim( substr( $line , 7 ) );
42-
$date = "";
43-
$skip = false;
44-
$mcnt = 0;
45-
continue;
46-
}
47-
// datetime of commit
48-
if ( strpos( $line , 'Date:' ) === 0 )
49-
{
50-
$line = trim( substr( $line , 5 ) );
51-
$date = strtotime( $line );
52-
continue;
53-
}
54-
// empty lines
55-
if ( trim( $line ) == "" )
56-
continue;
57-
// commit message
58-
if ( str_starts_with( $line , ' ' ) )
59-
{
60-
if ( LOOSE_SKIP_REVCHECK ) // See below, and https://github.com/php/doc-base/pull/132
61-
{
62-
// commits with [skip-revcheck] anywhere commit message flags skip
63-
if ( str_contains( $line, '[skip-revcheck]' ) )
64-
$skip = true;
65-
}
66-
else
67-
{
68-
$mcnt++;
69-
// [skip-revcheck] at start of first line of commit message flags a skip
70-
if ( $mcnt == 1 && str_starts_with( trim( $line ) , '[skip-revcheck]' ) )
71-
$skip = true;
72-
}
73-
continue;
74-
}
75-
// other headers
76-
if ( strpos( $line , ': ' ) > 0 )
77-
continue;
78-
79-
// otherwise, a filename
80-
$filename = trim( $line );
81-
$info = $list->get( $filename );
82-
83-
// untracked file (deleted, renamed)
84-
if ( $info == null )
85-
continue;
86-
87-
$info->addGitLogData( $hash , $date , $skip );
88-
}
89-
90-
pclose( $fp );
91-
}
92-
9324
static function parseDir( string $gdir , RevcheckFileList $list )
9425
{
9526
$gdir = escapeshellarg( $gdir );
@@ -142,19 +73,11 @@ static function parseDir( string $gdir , RevcheckFileList $list )
14273

14374
while ( $proc->live && str_starts_with( $proc->line , ' ' ) )
14475
{
145-
if ( LOOSE_SKIP_REVCHECK ) // https://github.com/php/doc-base/pull/132
146-
{
147-
// Messages that contains [skip-revcheck] flags entire commit as ignored.
148-
if ( str_contains( $proc->line , '[skip-revcheck]' ) )
149-
$skip = true;
150-
}
151-
else
152-
{
153-
// Messages that start with [skip-revcheck] flags entire commit as ignored.
154-
$lcnt++;
155-
if ( $lcnt == 1 && str_starts_with( trim( $line ) , '[skip-revcheck]' ) )
156-
$skip = true;
157-
}
76+
// Messages that start with [skip-revcheck] flags entire commit as ignored.
77+
$lcnt++;
78+
if ( $lcnt == 1 && str_starts_with( trim( $proc->line ) , '[skip-revcheck]' ) )
79+
$skip = true;
80+
15881
$proc->next();
15982
}
16083

scripts/translation/lib/all.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
ini_set( 'display_startup_errors' , 1 );
2222
error_reporting( E_ALL );
2323

24-
require_once __DIR__ . '/backport.php';
2524
require_once __DIR__ . '/CacheFile.php';
2625
require_once __DIR__ . '/CacheUtil.php';
2726
require_once __DIR__ . '/GitLogParser.php';

scripts/translation/lib/backport.php

Lines changed: 0 additions & 149 deletions
This file was deleted.

0 commit comments

Comments
 (0)