@snapcommit/cli 3.9.19 → 3.9.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -817,10 +817,11 @@ async function executeGitHubCommand(intent) {
|
|
|
817
817
|
catch (branchError) {
|
|
818
818
|
// If we can't determine branch, show generic error
|
|
819
819
|
}
|
|
820
|
-
// Check if there are no commits to
|
|
820
|
+
// Check if there are no commits compared to main/master
|
|
821
821
|
try {
|
|
822
|
-
const
|
|
823
|
-
|
|
822
|
+
const defaultBranch = (0, child_process_1.execSync)('git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null || echo refs/remotes/origin/main', { encoding: 'utf-8' }).trim().replace('refs/remotes/origin/', '');
|
|
823
|
+
const commitsAhead = (0, child_process_1.execSync)(`git rev-list --count origin/${defaultBranch}..HEAD 2>/dev/null || echo 0`, { encoding: 'utf-8' }).trim();
|
|
824
|
+
if (commitsAhead === '0' || commitsAhead === '') {
|
|
824
825
|
console.log(chalk_1.default.yellow('⚠️ No new commits on this branch!\n'));
|
|
825
826
|
console.log(chalk_1.default.white('Why this fails:'));
|
|
826
827
|
console.log(chalk_1.default.gray(' • PRs need at least 1 commit that\'s not in main'));
|