Skip to content

Commit 86432de

Browse files
Include the current hash in archives when version includes -alpha
1 parent 892531e commit 86432de

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

command.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,14 @@
9696
}
9797
}
9898

99+
if ( false !== stripos( $version, '-alpha' ) && is_dir( $path . '/.git' ) ) {
100+
$response = WP_CLI::launch( "cd {$path}; git log --pretty=format:'%h' -n 1", false, true );
101+
$maybe_hash = trim( $response->stdout );
102+
if ( $maybe_hash && 7 === strlen( $maybe_hash ) ) {
103+
$version .= '-' . $maybe_hash;
104+
}
105+
}
106+
99107
if ( is_null( $archive_file ) ) {
100108
$archive_file = dirname( $path ) . '/' . $archive_base . $version;
101109
if ( 'zip' === $assoc_args['format'] ) {

0 commit comments

Comments
 (0)