import { describe, expect, it } from 'vitest' import { isNoUpstreamError } from './git-remote-error' describe('isNoUpstreamError', () => { it('treats a missing HEAD@{u} tracking ref as no upstream', () => { const error = new Error( "fatal: ambiguous argument 'HEAD@{u}': unknown revision or path not in the working tree.\n" + "Use '--' to separate paths from revisions, like this:\n" + "'git [...] -- [...]'" ) expect(isNoUpstreamError(error)).toBe(true) }) it('does not treat unrelated ambiguous refs as no upstream', () => { const error = new Error( "fatal: ambiguous argument 'feature': unknown revision or path not in the working tree." ) expect(isNoUpstreamError(error)).toBe(false) }) })