Skip to content

Commit 151df5a

Browse files
committed
Propagate git failures from refresh-repository.php
The refresh helper ignored the exit status of both `git checkout` and `git pull` and always exited 0. Now that sync-repository.sh execs it and peek.php shows one status per repository, a failed refresh was rendered as a success and the git error was hidden. Exit with the failing git command's status instead, so the lane shows the failure and xargs and Composer see it too.
1 parent d4e34d2 commit 151df5a

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎.maintenance/refresh-repository.php‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@
1010
printf( "--- Refreshing repository \033[32m{$repository}\033[0m ---\n" );
1111

1212
printf( "Switching to latest \033[33mdefault\033[0m branch...\n" );
13-
system( "git --git-dir={$path}/.git --work-tree={$path} checkout $(git --git-dir={$path}/.git remote show origin | grep 'HEAD branch' | cut -d' ' -f5)" );
13+
system( "git --git-dir={$path}/.git --work-tree={$path} checkout $(git --git-dir={$path}/.git remote show origin | grep 'HEAD branch' | cut -d' ' -f5)", $status );
14+
if ( 0 !== $status ) {
15+
exit( $status );
16+
}
1417

1518
printf( "Pulling latest changes...\n" );
16-
system( "git --git-dir={$path}/.git --work-tree={$path} pull" );
19+
system( "git --git-dir={$path}/.git --work-tree={$path} pull", $status );
20+
if ( 0 !== $status ) {
21+
exit( $status );
22+
}

0 commit comments

Comments
 (0)