From 8b5be15d680f72b000fef678f30db49f1af7cb07 Mon Sep 17 00:00:00 2001 From: Adrien Peyre Date: Thu, 23 Jul 2026 17:11:09 +0200 Subject: [PATCH] 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. --- contrib/sentry.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/contrib/sentry.php b/contrib/sentry.php index 516c16557..13a3568ff 100644 --- a/contrib/sentry.php +++ b/contrib/sentry.php @@ -258,13 +258,20 @@ function getGitCommitsRefs(): Closure } try { - if (get('update_code_strategy') === 'archive') { - cd('{{deploy_path}}/.dep/repo'); + $gitLog = sprintf('git rev-list --pretty="%s" %s', 'format:%H#%an#%ae#%at#%s', $commitRange); + + if (get('update_code_strategy') === 'local_archive') { + // The git repository only exists on the local machine. + $result = runLocally($gitLog); } else { - cd('{{release_path}}'); - } + if (get('update_code_strategy') === 'archive') { + cd('{{deploy_path}}/.dep/repo'); + } else { + cd('{{release_path}}'); + } - $result = run(sprintf('git rev-list --pretty="%s" %s', 'format:%H#%an#%ae#%at#%s', $commitRange)); + $result = run($gitLog); + } $lines = array_filter( // limit number of commits for first release with many commits array_map('trim', array_slice(explode("\n", $result), 0, 200)),