Skip to content

Commit

Permalink
handle overwritten untracked files (#281)
Browse files Browse the repository at this point in the history
* handle overwritten untracked files

* fix regex for untracked overwritten files
  • Loading branch information
mathieudutour authored and shiftkey committed Feb 14, 2019
1 parent f975c07 commit 78fa7e9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export const GitErrorRegexes = {
'Another git process seems to be running in this repository, e.g.':
GitError.LockFileAlreadyExists,
'fatal: There is no merge to abort': GitError.NoMergeToAbort,
'error: Your local changes to the following files would be overwritten by checkout:':
'error: (?:Your local changes to the following|The following untracked working tree) files would be overwritten by checkout:':
GitError.LocalChangesOverwritten,
// GitHub-specific errors
'error: GH001: ': GitError.PushWithFileSizeExceedingLimit,
Expand Down
10 changes: 8 additions & 2 deletions test/fast/git-process-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -402,10 +402,16 @@ remove the file manually to continue.`
})

it('can parse the local files overwritten error', () => {
const stderr =
let stderr =
'error: Your local changes to the following files would be overwritten by checkout:\n'

const error = GitProcess.parseError(stderr)
let error = GitProcess.parseError(stderr)
expect(error).toBe(GitError.LocalChangesOverwritten)

stderr =
'error: The following untracked working tree files would be overwritten by checkout:\n'

error = GitProcess.parseError(stderr)
expect(error).toBe(GitError.LocalChangesOverwritten)
})
})
Expand Down

0 comments on commit 78fa7e9

Please sign in to comment.