Skip to content

VCS remote status fails in newly initialized repositories with no commits #3045

@zzjin

Description

@zzjin

Summary

When t3code opens a repository that has been initialized with Git but does not have any commits yet, the VCS remote status refresh can fail repeatedly while trying to read the current branch.

Reproduction

  1. Create or open a directory.
  2. Initialize it as a Git repository.
  3. Do not create an initial commit.
  4. Open the directory in t3code and wait for the VCS remote status refresh.

Actual behavior

t3code logs repeated warnings from GitVcsDriver.statusDetailsRemote.branch because git rev-parse --abbrev-ref HEAD can fail in an unborn repository:

fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.

Expected behavior

The VCS remote status refresh should treat the repository as a valid Git repository on its current unborn branch, report no upstream/ahead/behind state, and avoid repeated warning logs.

Notes

git symbolic-ref --quiet --short HEAD works for unborn branches because Git still has a symbolic HEAD pointing at the current branch name before the first commit. Detached HEAD can continue to be handled separately.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions