@@ -351,9 +351,12 @@ ClassMethod Commit(InternalName As %String, Message As %String = "example commit
351
351
set filename = ..FullExternalName (.InternalName )
352
352
set username = ..GitUserName ()
353
353
set email = ..GitUserEmail ()
354
- set author = username _" <" _email _" >"
354
+ set author = " "
355
+ if ((username '= " " ) && (email '= " " )) {
356
+ set author = username _" <" _email _" >"
357
+ }
355
358
do ..RunGitWithArgs (.errStream , .outStream , " commit" , " --author" , author , " -m" , Message , filename )
356
- do ..PrintStreams (outStream , outStream )
359
+ do ..PrintStreams (errStream , outStream )
357
360
$$$QuitOnError(##class (SourceControl.Git.Change ).RemoveUncommitted (filename ))
358
361
$$$QuitOnError(##class (SourceControl.Git.Change ).RefreshUncommitted (,,,1 ))
359
362
quit $$$OK
@@ -397,7 +400,10 @@ ClassMethod SyncCommit(Msg As %String) As %Status
397
400
set uncommittedFilesWithAction = ##class (SourceControl.Git.Utils ).UncommittedWithAction ().%Get (" user" )
398
401
set username = ..GitUserName ()
399
402
set email = ..GitUserEmail ()
400
- set author = username _" <" _email _" >"
403
+ set author = " "
404
+ if ((username '= " " ) && (email '= " " )) {
405
+ set author = username _" <" _email _" >"
406
+ }
401
407
do ..RunGitWithArgs (.errStream , .outStream , " commit" , " --author" , author , " -m" , Msg )
402
408
do ..PrintStreams (errStream , outStream )
403
409
$$$QuitOnError(..ClearUncommitted (uncommittedFilesWithAction ))
@@ -1672,8 +1678,13 @@ ClassMethod RunGitCommandWithInput(command As %String, inFile As %String = "", O
1672
1678
set newArgs ($increment (newArgs )) = " core.sshCommand=ssh -F /dev/null -o StrictHostKeyChecking=accept-new -i " _privateKeyFile
1673
1679
}
1674
1680
1675
- set username = ..GitUserName ()
1676
- set email = ..GitUserEmail ()
1681
+ set username = " "
1682
+ set email = " "
1683
+
1684
+ if (..GitUserName () '= " " ) && (..GitUserEmail () '= " " ) {
1685
+ set username = ..GitUserName ()
1686
+ set email = ..GitUserEmail ()
1687
+ }
1677
1688
1678
1689
set newArgs ($increment (newArgs )) = " -c"
1679
1690
set newArgs ($increment (newArgs )) = " user.name=" _username
@@ -1689,6 +1700,7 @@ ClassMethod RunGitCommandWithInput(command As %String, inFile As %String = "", O
1689
1700
set diffCompare = " "
1690
1701
set invert = 0
1691
1702
set whichStash = " "
1703
+ set isCommit = 0
1692
1704
1693
1705
// Find / build file list
1694
1706
set hasFileList = 0
@@ -1735,6 +1747,8 @@ ClassMethod RunGitCommandWithInput(command As %String, inFile As %String = "", O
1735
1747
set syncIrisWithDiff = 1
1736
1748
set diffCompare = whichStash
1737
1749
}
1750
+ } elseif (command = " commit" ) {
1751
+ set isCommit = 1
1738
1752
}
1739
1753
1740
1754
// WebUI prefixes with "color.ui=true" so we need to grab the command
@@ -1770,6 +1784,8 @@ ClassMethod RunGitCommandWithInput(command As %String, inFile As %String = "", O
1770
1784
} elseif (args (i ) = " merge" ) || (args (i ) = " rebase" ) || (args (i ) = " pull" ) {
1771
1785
set syncIrisWithCommand = 1
1772
1786
set diffCompare = args (i + 1 )
1787
+ } elseif (args (i ) = " commit" ) {
1788
+ set isCommit = 1
1773
1789
}
1774
1790
}
1775
1791
}
@@ -1813,6 +1829,15 @@ ClassMethod RunGitCommandWithInput(command As %String, inFile As %String = "", O
1813
1829
set errStream = ##class (%Stream.FileCharacter ).%OpenId (errLog ,,.sc )
1814
1830
set outStream = ##class (%Stream.FileCharacter ).%OpenId (outLog ,,.sc )
1815
1831
set outStream .TranslateTable =" UTF8"
1832
+
1833
+ if ((isCommit ) && (returnCode = 128 )){
1834
+ set errStreamLine = errStream .ReadLine ()
1835
+ if (((errStreamLine = " Committer identity unknown" ) || (errStreamLine = " Author identity unknown" ))) {
1836
+ do errStream .Clear ()
1837
+ do errStream .WriteLine (" Commit failed as user identity unknown." _$c (13 ,10 )_$c (13 ,10 )_" Go to the Settings page in the Source Control menu to fix this." _$c (13 ,10 ))
1838
+ }
1839
+ }
1840
+
1816
1841
for stream =errStream ,outStream {
1817
1842
set stream .RemoveOnClose = 1
1818
1843
}
0 commit comments