Read-only mirror — the public repositories of the Forgejo instance, refreshed every 10 minutes. The live instance (fg.dieschoenewolke.de) is reachable only over the VPN; clone here with https://git.dieschoenewolke.de/git/<owner>/<repo>.git.
summaryrefslogtreecommitdiff
path: root/src/git-source-provider.ts
diff options
context:
space:
mode:
authoreric sciple <ericsciple@users.noreply.github.com>2020-01-27 10:21:50 -0500
committerGitHub <noreply@github.com>2020-01-27 10:21:50 -0500
commit6b1b6c741dcd8f11b27c42c369fe515856be8dc3 (patch)
tree575c354c64632b256e1e1689ee4a65deec221e1a /src/git-source-provider.ts
parent12bd1637c11cfa549d99e323740931f7481924d7 (diff)
follow proxy settings (#144)
Diffstat (limited to 'src/git-source-provider.ts')
-rw-r--r--src/git-source-provider.ts24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/git-source-provider.ts b/src/git-source-provider.ts
index 8c7aa15..e0dd58e 100644
--- a/src/git-source-provider.ts
+++ b/src/git-source-provider.ts
@@ -9,7 +9,8 @@ import * as refHelper from './ref-helper'
import * as stateHelper from './state-helper'
import {IGitCommandManager} from './git-command-manager'
-const authConfigKey = `http.https://github.com/.extraheader`
+const serverUrl = 'https://github.com/'
+const authConfigKey = `http.${serverUrl}.extraheader`
export interface ISourceSettings {
repositoryPath: string
@@ -95,7 +96,7 @@ export async function getSource(settings: ISourceSettings): Promise<void> {
await removeGitConfig(git, authConfigKey)
try {
- // Config auth token
+ // Config extraheader
await configureAuthToken(git, settings.authToken)
// LFS install
@@ -136,16 +137,21 @@ export async function getSource(settings: ISourceSettings): Promise<void> {
export async function cleanup(repositoryPath: string): Promise<void> {
// Repo exists?
- if (!fsHelper.fileExistsSync(path.join(repositoryPath, '.git', 'config'))) {
+ if (
+ !repositoryPath ||
+ !fsHelper.fileExistsSync(path.join(repositoryPath, '.git', 'config'))
+ ) {
return
}
- fsHelper.directoryExistsSync(repositoryPath, true)
- // Remove the config key
- const git = await gitCommandManager.CreateCommandManager(
- repositoryPath,
- false
- )
+ let git: IGitCommandManager
+ try {
+ git = await gitCommandManager.CreateCommandManager(repositoryPath, false)
+ } catch {
+ return
+ }
+
+ // Remove extraheader
await removeGitConfig(git, authConfigKey)
}