Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: report errors creating new branches #572

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix branches with special characters not showing in GitUI (#523)
- Fix filenames with spaces not showing correctly in workspace view (#551)
- Removed inaccurate placeholder text for commit message in UI (#406)
- Report error more clearly if you try to create a branch with an invalid name (#534)

## [2.6.0] - 2024-10-07

Expand Down
14 changes: 8 additions & 6 deletions cls/SourceControl/Git/Utils.cls
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ ClassMethod UserAction(InternalName As %String, MenuName As %String, ByRef Targe

ClassMethod AfterUserAction(Type As %Integer, Name As %String, InternalName As %String, Answer As %Integer, Msg As %String = "", ByRef Reload As %Boolean) As %Status
{
set status = $$$OK
#dim menuName as %String = $piece(Name,",")
#dim menuItemName as %String = $piece(Name,",",2)
if (menuItemName = "Revert") || (menuItemName [ "Import") {
Expand All @@ -331,15 +332,12 @@ ClassMethod AfterUserAction(Type As %Integer, Name As %String, InternalName As %
}
} elseif (menuItemName = "NewBranch") {
if (Answer = 1) {
do ..NewBranch(Msg)
set status = ..NewBranch(Msg)
set Reload = 1
}
} elseif (menuItemName = "SwitchBranch") {
if (Answer = 1) {
set status = ..SwitchBranch(Msg)
if $$$ISERR(status) {
Quit status
}
set Reload = 1
}
} elseif (menuItemName = "Sync") {
Expand All @@ -356,7 +354,7 @@ ClassMethod AfterUserAction(Type As %Integer, Name As %String, InternalName As %
// Always force reload as many things could have possibly changed.
set Reload = 1
}
quit $$$OK
quit status
}

ClassMethod Init() As %Status
Expand Down Expand Up @@ -405,8 +403,12 @@ ClassMethod NewBranch(newBranchName As %String) As %Status
kill errStream, outStream
}

do ..RunGitWithArgs(.errStream, .outStream, "checkout", "-b", newBranchName)
set err = ..RunGitWithArgs(.errStream, .outStream, "checkout", "-b", newBranchName)
do ..PrintStreams(errStream, outStream)
if err {
do errStream.Rewind()
quit $$$ERROR($$$GeneralError,errStream.Read()_$c(10)_"Current branch is: "_..GetCurrentBranch())
}
quit $$$OK
}

Expand Down
Loading