Skip to content

Commit c3a68e2

Browse files
authored
Merge pull request #469 from desktop/releases/1.107.0
Release 1.107.0
2 parents d16ff00 + 4d1251e commit c3a68e2

File tree

4 files changed

+17
-7
lines changed

4 files changed

+17
-7
lines changed

lib/errors.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ export enum GitError {
5757
TagAlreadyExists,
5858
MergeWithLocalChanges,
5959
RebaseWithLocalChanges,
60-
MergeCommitNoMainlineOption
60+
MergeCommitNoMainlineOption,
61+
UnsafeDirectory
6162
}
6263

6364
/** A mapping from regexes to the git error they identify. */
@@ -68,7 +69,7 @@ export const GitErrorRegexes: { [regexp: string]: GitError } = {
6869
'fatal: Authentication failed': GitError.SSHAuthenticationFailed,
6970
'fatal: Could not read from remote repository.': GitError.SSHPermissionDenied,
7071
'The requested URL returned error: 403': GitError.HTTPSAuthenticationFailed,
71-
'fatal: The remote end hung up unexpectedly': GitError.RemoteDisconnection,
72+
'fatal: [Tt]he remote end hung up unexpectedly': GitError.RemoteDisconnection,
7273
"fatal: unable to access '(.+)': Failed to connect to (.+): Host is down": GitError.HostDown,
7374
"Cloning into '(.+)'...\nfatal: unable to access '(.+)': Could not resolve host: (.+)":
7475
GitError.HostDown,
@@ -91,7 +92,7 @@ export const GitErrorRegexes: { [regexp: string]: GitError } = {
9192
"Your configuration specifies to merge with the ref '(.+)'\nfrom the remote, but no such ref was fetched.":
9293
GitError.NoExistingRemoteBranch,
9394
'nothing to commit': GitError.NothingToCommit,
94-
"No submodule mapping found in .gitmodules for path '(.+)'": GitError.NoSubmoduleMapping,
95+
"[Nn]o submodule mapping found in .gitmodules for path '(.+)'": GitError.NoSubmoduleMapping,
9596
"fatal: repository '(.+)' does not exist\nfatal: clone of '.+' into submodule path '(.+)' failed":
9697
GitError.SubmoduleRepositoryDoesNotExist,
9798
"Fetched in submodule path '(.+)', but it did not contain (.+). Direct fetching of that commit failed.":
@@ -104,7 +105,7 @@ export const GitErrorRegexes: { [regexp: string]: GitError } = {
104105
GitError.NonFastForwardMergeIntoEmptyHead,
105106
'error: (.+): (patch does not apply|already exists in working directory)':
106107
GitError.PatchDoesNotApply,
107-
"fatal: A branch named '(.+)' already exists.": GitError.BranchAlreadyExists,
108+
"fatal: [Aa] branch named '(.+)' already exists.?": GitError.BranchAlreadyExists,
108109
"fatal: bad revision '(.*)'": GitError.BadRevision,
109110
'fatal: [Nn]ot a git repository \\(or any of the parent directories\\): (.*)':
110111
GitError.NotAGitRepository,
@@ -145,7 +146,8 @@ export const GitErrorRegexes: { [regexp: string]: GitError } = {
145146
GitError.MergeWithLocalChanges,
146147
'error: cannot (pull with rebase|rebase): You have unstaged changes\\.\n\\s*error: [Pp]lease commit or stash them\\.':
147148
GitError.RebaseWithLocalChanges,
148-
'error: commit (.+) is a merge but no -m option was given': GitError.MergeCommitNoMainlineOption
149+
'error: commit (.+) is a merge but no -m option was given': GitError.MergeCommitNoMainlineOption,
150+
"fatal: unsafe repository \\('(.+)' is owned by someone else\\)": GitError.UnsafeDirectory
149151
}
150152

151153
/**

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dugite",
3-
"version": "1.106.0",
3+
"version": "1.107.0",
44
"description": "Elegant bindings for Git",
55
"main": "./build/lib/index.js",
66
"typings": "./build/lib/index.d.ts",

test/fast/errors-test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,12 @@ describe('detects errors', () => {
3131

3232
expect(result).toHaveGitError(GitError.TagAlreadyExists)
3333
})
34+
it('BranchAlreadyExists', async () => {
35+
const path = await initialize('branch-already-exists', 'foo')
36+
await GitProcess.exec(['commit', '-m', 'initial', '--allow-empty'], path)
37+
38+
const result = await GitProcess.exec(['branch', 'foo'], path)
39+
40+
expect(result).toHaveGitError(GitError.BranchAlreadyExists)
41+
})
3442
})

0 commit comments

Comments
 (0)