Skip to content

Improved behavior for commits when attribution settings are not configured #512

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

Merged
merged 5 commits into from
Oct 3, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Added author check for sync
  • Loading branch information
isc-akadoo committed Oct 2, 2024
commit e7ade4f7e8ab94e93f8a53efeb8812bf674bcbc5
18 changes: 5 additions & 13 deletions cls/SourceControl/Git/Utils.cls
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ ClassMethod UserAction(InternalName As %String, MenuName As %String, ByRef Targe
set Action = 7
quit $$$OK
} elseif (menuItemName = "Commit") {
do ..CheckUserIdentity()
set Target = "Please enter a commit message"
set Action = 7
quit $$$OK
Expand Down Expand Up @@ -401,7 +400,10 @@ ClassMethod SyncCommit(Msg As %String) As %Status
set uncommittedFilesWithAction = ##class(SourceControl.Git.Utils).UncommittedWithAction().%Get("user")
set username = ..GitUserName()
set email = ..GitUserEmail()
set author = username_" <"_email_">"
set author = ""
if ((username '= "") && (email '= "")) {
set author = username_" <"_email_">"
}
do ..RunGitWithArgs(.errStream, .outStream, "commit", "--author", author, "-m", Msg)
do ..PrintStreams(errStream, outStream)
$$$QuitOnError(..ClearUncommitted(uncommittedFilesWithAction))
Expand Down Expand Up @@ -1798,7 +1800,7 @@ ClassMethod RunGitCommandWithInput(command As %String, inFile As %String = "", O
set errStreamLine = errStream.ReadLine()
if (((errStreamLine = "Committer identity unknown") || (errStreamLine = "Author identity unknown"))) {
do errStream.Clear()
do errStream.WriteLine("Commit failed as user identity unknown."_$c(13,10)_$c(13,10)_"Go to settings to configure Git committer name and email."_$c(13,10))
do errStream.WriteLine("Commit failed as user identity unknown."_$c(13,10)_$c(13,10)_"Go to settings."_$c(13,10))
}
}

Expand Down Expand Up @@ -2711,14 +2713,4 @@ ClassMethod BaselineExport(pCommitMessage = "", pPushToRemote = "") As %Status
return sc
}

ClassMethod CheckUserIdentity()
{
if ..GitUserName() = "" {
write !, "WARNING: Git committer name is not configured. Go to settings to configure the committer name."
}
if ..GitUserEmail() = "" {
write !, "WARNING: Git committer email is not configured. Go to settings to configure the committer email."
}
}

}
Loading