Skip to content

Commit

Permalink
Update packages/mermaid/src/diagrams/git/gitGraphAst.ts
Browse files Browse the repository at this point in the history
Co-authored-by: Sidharth Vinod <github@sidharth.dev>
  • Loading branch information
Austin-Fulbright and sidharthv96 authored Jul 27, 2024
1 parent 6c1e5aa commit ef25160
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/mermaid/src/diagrams/git/gitGraphAst.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,16 @@ export const commit = function (msg: string, id: string, type: number, tags?: st

export const branch = function (name: string, order?: number) {
name = common.sanitizeText(name, getConfig());
if (!state.records.branches.has(name)) {
if (state.records.branches.has(name)) {
throw new Error(
`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${name}")`
);
}

state.records.branches.set(name, state.records.head != null ? state.records.head.id : null);
state.records.branchConfig.set(name, { name, order });
checkout(name);
log.debug('in createBranch');
} else {
throw new Error(
`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${name}")`
);
}
};

export const merge = (
Expand Down

0 comments on commit ef25160

Please sign in to comment.