@@ -262,6 +262,7 @@ ClassMethod UserAction(InternalName As %String, MenuName As %String, ByRef Targe
262
262
set Action = 7
263
263
quit $$$OK
264
264
} elseif (menuItemName = " Commit" ) {
265
+ do ..CheckUserIdentity ()
265
266
set Target = " Please enter a commit message"
266
267
set Action = 7
267
268
quit $$$OK
@@ -350,9 +351,12 @@ ClassMethod Commit(InternalName As %String, Message As %String = "example commit
350
351
set filename = ..FullExternalName (.InternalName )
351
352
set username = ..GitUserName ()
352
353
set email = ..GitUserEmail ()
353
- set author = username _" <" _email _" >"
354
+ set author = " "
355
+ if ((username '= " " ) && (email '= " " )) {
356
+ set author = username _" <" _email _" >"
357
+ }
354
358
do ..RunGitWithArgs (.errStream , .outStream , " commit" , " --author" , author , " -m" , Message , filename )
355
- do ..PrintStreams (outStream , outStream )
359
+ do ..PrintStreams (errStream , outStream )
356
360
$$$QuitOnError(##class (SourceControl.Git.Change ).RemoveUncommitted (filename ))
357
361
$$$QuitOnError(##class (SourceControl.Git.Change ).RefreshUncommitted (,,,1 ))
358
362
quit $$$OK
@@ -1659,6 +1663,7 @@ ClassMethod RunGitCommandWithInput(command As %String, inFile As %String = "", O
1659
1663
set diffCompare = " "
1660
1664
set invert = 0
1661
1665
set whichStash = " "
1666
+ set isCommit = 0
1662
1667
1663
1668
// Find / build file list
1664
1669
set hasFileList = 0
@@ -1705,6 +1710,8 @@ ClassMethod RunGitCommandWithInput(command As %String, inFile As %String = "", O
1705
1710
set syncIrisWithDiff = 1
1706
1711
set diffCompare = whichStash
1707
1712
}
1713
+ } elseif (command = " commit" ) {
1714
+ set isCommit = 1
1708
1715
}
1709
1716
1710
1717
// WebUI prefixes with "color.ui=true" so we need to grab the command
@@ -1740,6 +1747,8 @@ ClassMethod RunGitCommandWithInput(command As %String, inFile As %String = "", O
1740
1747
} elseif (args (i ) = " merge" ) || (args (i ) = " rebase" ) || (args (i ) = " pull" ) {
1741
1748
set syncIrisWithCommand = 1
1742
1749
set diffCompare = args (i + 1 )
1750
+ } elseif (args (i ) = " commit" ) {
1751
+ set isCommit = 1
1743
1752
}
1744
1753
}
1745
1754
}
@@ -1783,6 +1792,15 @@ ClassMethod RunGitCommandWithInput(command As %String, inFile As %String = "", O
1783
1792
set errStream = ##class (%Stream.FileCharacter ).%OpenId (errLog ,,.sc )
1784
1793
set outStream = ##class (%Stream.FileCharacter ).%OpenId (outLog ,,.sc )
1785
1794
set outStream .TranslateTable =" UTF8"
1795
+
1796
+ if ((isCommit ) && (returnCode = 128 )){
1797
+ set errStreamLine = errStream .ReadLine ()
1798
+ if (((errStreamLine = " Committer identity unknown" ) || (errStreamLine = " Author identity unknown" ))) {
1799
+ do errStream .Clear ()
1800
+ 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 ))
1801
+ }
1802
+ }
1803
+
1786
1804
for stream =errStream ,outStream {
1787
1805
set stream .RemoveOnClose = 1
1788
1806
}
@@ -2692,4 +2710,14 @@ ClassMethod BaselineExport(pCommitMessage = "", pPushToRemote = "") As %Status
2692
2710
return sc
2693
2711
}
2694
2712
2713
+ ClassMethod CheckUserIdentity ()
2714
+ {
2715
+ if ..GitUserName () = " " {
2716
+ write !, " WARNING: Git committer name is not configured. Go to settings to configure the committer name."
2717
+ }
2718
+ if ..GitUserEmail () = " " {
2719
+ write !, " WARNING: Git committer email is not configured. Go to settings to configure the committer email."
2720
+ }
2721
+ }
2722
+
2695
2723
}
0 commit comments