mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-15 12:57:22 +01:00
fix(review): pass 1: ahead and diverged labels, diff-scope needs shared history; preflight refreshes origin/<base> and stops on a diff far beyond the PR (GST-462, HARN-15)
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
0d4846cc0a
commit
86b279fcae
8 files changed
+72
-9
No files matched your search
@@ -94,7 +94,7 @@ export function isShallow(cwd: string): boolean {
|
||||
* tracking ref is a fix and not a loop. `local` says why the twin won when the
|
||||
* local branch differs from it.
|
||||
*/
|
||||
export function resolveBase(ref: string, cwd: string, head?: string): { ref: string; sha: string; local?: 'missing' | 'unrelated' | 'behind' | 'diverged' } | null {
|
||||
export function resolveBase(ref: string, cwd: string, head?: string): { ref: string; sha: string; local?: 'missing' | 'unrelated' | 'behind' | 'ahead' | 'diverged' } | null {
|
||||
const related = (sha: string) => !head || mergeBase(sha, head, cwd) !== null;
|
||||
const direct = resolvesToCommit(ref, cwd);
|
||||
if (isBranchName(ref)) {
|
||||
@@ -103,7 +103,8 @@ export function resolveBase(ref: string, cwd: string, head?: string): { ref: str
|
||||
const sha = resolvesToCommit(tracking, cwd);
|
||||
if (!sha || !related(sha)) continue;
|
||||
if (sha === direct) return { ref, sha };
|
||||
const local = !direct ? 'missing' : !related(direct) ? 'unrelated' : mergeBase(direct, sha, cwd) === direct ? 'behind' : 'diverged';
|
||||
const fork = direct && related(direct) ? mergeBase(direct, sha, cwd) : null;
|
||||
const local = !direct ? 'missing' : !fork ? 'unrelated' : fork === direct ? 'behind' : fork === sha ? 'ahead' : 'diverged';
|
||||
return { ref: tracking, sha, local };
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user