Skip to content

Commit 8b5be15

Browse files
committed
Fix sentry commits retrieval with local_archive strategy
With update_code_strategy set to local_archive, the release path contains an extracted git archive without a .git directory, and there is no .dep/repo mirror on the host. Run git rev-list locally instead, where the repository actually exists.
1 parent 453cca8 commit 8b5be15

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

contrib/sentry.php

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -258,13 +258,20 @@ function getGitCommitsRefs(): Closure
258258
}
259259

260260
try {
261-
if (get('update_code_strategy') === 'archive') {
262-
cd('{{deploy_path}}/.dep/repo');
261+
$gitLog = sprintf('git rev-list --pretty="%s" %s', 'format:%H#%an#%ae#%at#%s', $commitRange);
262+
263+
if (get('update_code_strategy') === 'local_archive') {
264+
// The git repository only exists on the local machine.
265+
$result = runLocally($gitLog);
263266
} else {
264-
cd('{{release_path}}');
265-
}
267+
if (get('update_code_strategy') === 'archive') {
268+
cd('{{deploy_path}}/.dep/repo');
269+
} else {
270+
cd('{{release_path}}');
271+
}
266272

267-
$result = run(sprintf('git rev-list --pretty="%s" %s', 'format:%H#%an#%ae#%at#%s', $commitRange));
273+
$result = run($gitLog);
274+
}
268275
$lines = array_filter(
269276
// limit number of commits for first release with many commits
270277
array_map('trim', array_slice(explode("\n", $result), 0, 200)),

0 commit comments

Comments
 (0)