Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Can't checkout PR when there are untracked files #1271

@jcansdale

Description

@jcansdale
  • GitHub Extension for Visual Studio version: 2.3.3.38
  • Visual Studio version: Add

The extension often won't let me checkout PR branches.

image

This can be due to trivial things like build artifacts being added to the staging area.

image

This can be caused by build artifacts/tools (NCrunch) adding files to the working directory. Untracked files usually wouldn't be a problem when using Git from the command line, they can be a real nuisance when using the extension.

This is particularly problematic when the untracked files appear in submodules. The Git command line arguments necessary to clean them up aren't at all obvious (to me at least).

The current check is done here:

public IObservable<bool> IsWorkingDirectoryClean(ILocalRepositoryModel repository)

It uses IsDirty, which checks for any differences between the working directory/index and the last comment. By default, command line Git will allow a checkout if there are untracked files in the working directory.

This issue is even more insidious when an untracked file gets added to a submodule. Here I'ved added foo.txt to the splat submodule.

Visual Studio (below) and the Git command line doesn't give much of a clue as to what's going wrong. You can see that something might be up with the splat submodule, but it doesn't give any indication of exactly what.

image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions