Skip to content

Commit 8d832f9

Browse files
committed
update git command
1 parent 0739644 commit 8d832f9

File tree

1 file changed

+6
-23
lines changed

1 file changed

+6
-23
lines changed

cls/SourceControl/Git/Utils.cls

+6-23
Original file line numberDiff line numberDiff line change
@@ -1877,24 +1877,6 @@ ClassMethod RunGitCommandWithInput(command As %String, inFile As %String = "", O
18771877

18781878
set newArgs($increment(newArgs)) = command
18791879

1880-
/*
1881-
if ((..GitRemoteType() = "HTTPS") && ((command = "pull") || (command = "push") || (command = "fetch"))) {
1882-
set token = ##class(SourceControl.Git.Util.CredentialManager).GetToken($username, .err, .code)
1883-
if ((token = "") || (token = "key does not exist")) {
1884-
set errStream = ##class(%Stream.FileCharacter).%New()
1885-
do errStream.Write("Error: Please authenticate your https connection before attempting to use git")
1886-
set errStream.RemoveOnClose = 1
1887-
return 128
1888-
}
1889-
// Need to use token
1890-
set remote = ..GetConfiguredRemote()
1891-
set tokenURL = ##class(SourceControl.Git.OAuth2).SetRemoteURLWithToken(remote)
1892-
if (remote '= tokenURL) {
1893-
do ..SetConfiguredRemote(tokenURL)
1894-
}
1895-
}
1896-
*/
1897-
18981880
set syncIrisWithDiff = 0 // whether IRIS needs to be synced with repo file changes using diff output
18991881
set syncIrisWithCommand = 0 // // whether IRIS needs to be synced with repo file changes using command output
19001882
set diffBase = ""
@@ -2023,17 +2005,18 @@ ClassMethod RunGitCommandWithInput(command As %String, inFile As %String = "", O
20232005

20242006
if ((..GitRemoteType() = "HTTPS") && ((command = "pull") || (command = "push") || (command = "fetch"))) {
20252007
set token = ##class(SourceControl.Git.OAuth2).GetToken()
2026-
if $$$isWINDOWS {
2027-
set env("GIT_ASKPASS") = """cmd /c "_token_""";"
2028-
} else {
2029-
set env("GIT_ASKPASS") = "sh -c ""echo "_token_""""
2008+
if (token) {
2009+
if ($$$isWINDOWS) {
2010+
set env("GIT_ASKPASS") = """cmd /c "_token_""";"
2011+
} else {
2012+
set env("GIT_ASKPASS") = "sh -c ""echo "_token_""""
2013+
}
20302014
}
20312015
}
20322016
try {
20332017
// Inject instance manager directory as global git config home directory
20342018
// On Linux, this avoids trying to use /root/.config/git/attributes for global git config
20352019
set env("XDG_CONFIG_HOME") = ##class(%File).ManagerDirectory()
2036-
set env("GIT_ASKPASS") = """cmd /c "_token_""";"
20372020
set returnCode = $zf(-100,"/ENV=env... "_baseArgs,gitCommand,newArgs...)
20382021
} catch e {
20392022
if $$$isWINDOWS {

0 commit comments

Comments
 (0)