chatroom-cli 1.16.3 → 1.16.4
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.
- package/dist/index.js +13 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15543,6 +15543,13 @@ async function getRemotes(cwd) {
|
|
|
15543
15543
|
}
|
|
15544
15544
|
return remotes;
|
|
15545
15545
|
}
|
|
15546
|
+
async function getCommitsAhead(workingDir) {
|
|
15547
|
+
const result = await runGit("rev-list --count @{upstream}..HEAD", workingDir);
|
|
15548
|
+
if ("error" in result)
|
|
15549
|
+
return 0;
|
|
15550
|
+
const count = parseInt(result.stdout.trim(), 10);
|
|
15551
|
+
return Number.isNaN(count) ? 0 : count;
|
|
15552
|
+
}
|
|
15546
15553
|
var execAsync2;
|
|
15547
15554
|
var init_git_reader = __esm(() => {
|
|
15548
15555
|
execAsync2 = promisify2(exec2);
|
|
@@ -15766,11 +15773,12 @@ async function pushSingleWorkspaceGitState(ctx, workingDir) {
|
|
|
15766
15773
|
ctx.lastPushedGitState.set(stateKey, stateHash2);
|
|
15767
15774
|
return;
|
|
15768
15775
|
}
|
|
15769
|
-
const [branchResult, dirtyResult, diffStatResult, commits] = await Promise.all([
|
|
15776
|
+
const [branchResult, dirtyResult, diffStatResult, commits, commitsAhead] = await Promise.all([
|
|
15770
15777
|
getBranch(workingDir),
|
|
15771
15778
|
isDirty(workingDir),
|
|
15772
15779
|
getDiffStat(workingDir),
|
|
15773
|
-
getRecentCommits(workingDir, COMMITS_PER_PAGE)
|
|
15780
|
+
getRecentCommits(workingDir, COMMITS_PER_PAGE),
|
|
15781
|
+
getCommitsAhead(workingDir)
|
|
15774
15782
|
]);
|
|
15775
15783
|
const remotes = await getRemotes(workingDir);
|
|
15776
15784
|
if (branchResult.status === "error") {
|
|
@@ -15795,7 +15803,7 @@ async function pushSingleWorkspaceGitState(ctx, workingDir) {
|
|
|
15795
15803
|
const isDirty2 = dirtyResult;
|
|
15796
15804
|
const diffStat = diffStatResult.status === "available" ? diffStatResult.diffStat : { filesChanged: 0, insertions: 0, deletions: 0 };
|
|
15797
15805
|
const hasMoreCommits = commits.length >= COMMITS_PER_PAGE;
|
|
15798
|
-
const stateHash = createHash3("md5").update(JSON.stringify({ branch, isDirty: isDirty2, diffStat, shas: commits.map((c) => c.sha), prs: openPRs.map((pr) => pr.number), remotes: remotes.map((r) => `${r.name}:${r.url}`) })).digest("hex");
|
|
15806
|
+
const stateHash = createHash3("md5").update(JSON.stringify({ branch, isDirty: isDirty2, diffStat, commitsAhead, shas: commits.map((c) => c.sha), prs: openPRs.map((pr) => pr.number), remotes: remotes.map((r) => `${r.name}:${r.url}`) })).digest("hex");
|
|
15799
15807
|
if (ctx.lastPushedGitState.get(stateKey) === stateHash) {
|
|
15800
15808
|
return;
|
|
15801
15809
|
}
|
|
@@ -15810,7 +15818,8 @@ async function pushSingleWorkspaceGitState(ctx, workingDir) {
|
|
|
15810
15818
|
recentCommits: commits,
|
|
15811
15819
|
hasMoreCommits,
|
|
15812
15820
|
openPullRequests: openPRs,
|
|
15813
|
-
remotes
|
|
15821
|
+
remotes,
|
|
15822
|
+
commitsAhead
|
|
15814
15823
|
});
|
|
15815
15824
|
ctx.lastPushedGitState.set(stateKey, stateHash);
|
|
15816
15825
|
console.log(`[${formatTimestamp()}] \uD83D\uDD00 Git state pushed: ${workingDir} (${branch}${isDirty2 ? ", dirty" : ", clean"})`);
|