Skip to content

Differentiate Untracked Files from Added Files in Status Models #6468

Closed

Description

@outofambit

Currently, our status models parse Added files and Untracked files as AppFileStatusKind.New. Unfortunately, this means we lose information in the application about which files are which.

function convertToAppStatus(
path: string,
entry: FileEntry,
filesWithConflictMarkers: ConflictCountsByPath,
oldPath?: string
): AppFileStatus {
if (entry.kind === 'ordinary') {
switch (entry.type) {
case 'added':
return { kind: AppFileStatusKind.New }
case 'modified':
return { kind: AppFileStatusKind.Modified }
case 'deleted':
return { kind: AppFileStatusKind.Deleted }
}
} else if (entry.kind === 'copied' && oldPath != null) {
return { kind: AppFileStatusKind.Copied, oldPath }
} else if (entry.kind === 'renamed' && oldPath != null) {
return { kind: AppFileStatusKind.Renamed, oldPath }
} else if (entry.kind === 'untracked') {
return { kind: AppFileStatusKind.New }
} else if (entry.kind === 'conflicted') {
return parseConflictedState(entry, path, filesWithConflictMarkers)
}
return fatalError(`Unknown file status ${status}`)
}

This issue proposes adding an AppFileStatusKind.Untracked to cover this case.

required to fix #6411

Activity

  1. self-assigned this
    on Dec 20, 2018
  2. added this to the 1.6.0 milestone on Dec 20, 2018
  3. shiftkey commented on Dec 21, 2018

    @shiftkey
    Member

    One thing to keep an eye out for is the cascading effects from this, like in mapStatus and iconForStatus:

    export function mapStatus(status: AppFileStatus): string {

    export function iconForStatus(status: AppFileStatus): OcticonSymbol {

    I think we should still map AppFileStatusKind.Untracked to 'New' and OcticonSymbol.diffAdded in these cases, rather than introduce new terminology or expose the "untracked" concept at this stage.

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions