Skip to content

Propagating a file to a sibling that isn't cloned reports success but creates a stray folder at its clone path, so Clone then fails #453

Description

@matt-edmondson

What's wrong

The Propagate popup lists every key in repo.SimilarRepoDiffs (ProjectDirector/PopupPropagateFile.cs:41-56). DiffAgainstAll adds a key for every known sibling, including ones that are not cloned (DiffRepos returns an empty dictionary for those). An uncloned repo therefore appears in the popup and can be checked. When it is:

  1. FilePropagation.ResolveDestinations targets <LocalPath>/<file> (FilePropagation.cs:96).
  2. Copy runs Directory.CreateDirectory(directory) (FilePropagation.cs:159), which creates <dev>/<owner>/<repo>/... from nothing.
  3. The copy succeeds and is logged as a success.

The new folder is not a repository:

  • UpdateClonedStatus still treats the repo as not cloned (GitCli.IsRepository is false), so the top panel still offers Clone.
  • git clone refuses the non-empty directory.
  • GitRepository.IsCloned (GitRepository.cs:22, which checks Directory.Exists) now wrongly returns true.

Evidence

Probe with a real base repo and an uncloned sibling:

popup would list: ktsu-dev.Uncloned
Propagated .../ktsu-dev/Base/.editorconfig to 1 of 1 repos
IsCloned=True IsRepository=False
clone exit 128: fatal: destination path '.../ktsu-dev/Uncloned' already exists and is not an empty directory.

Suggested fix

  • Leave uncloned repos out of the propagate list by filtering on GitCli.IsRepository(LocalPath) or Options.ClonedRepos.ContainsKey(LocalPath).
  • In FilePropagation.Propagate, refuse any destination whose repository root is not a git working tree and report it as a per-repo failure ("not cloned"). Covering that rule in FilePropagationTests keeps it from regressing.
  • Consider making IsCloned use GitCli.IsRepository instead of Directory.Exists.

Acceptance criteria

  • Uncloned siblings are either not offered or are reported as "not cloned" failures.
  • No directory is created under an uncloned repo's LocalPath.
  • Clone still works afterwards.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions