A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/npm/cli/commit/1c8d41ddafc5810511d54fd227ce964c503464e0 below:

@npmcli/git@5.0.8 · npm/cli@1c8d41d · GitHub

File tree Expand file treeCollapse file tree 5 files changed

+60

-11

lines changed

Filter options

Expand file treeCollapse file tree 5 files changed

+60

-11

lines changed Original file line number Diff line number Diff line change

@@ -199,6 +199,7 @@ graph LR;

199 199

npmcli-docs-->npmcli-template-oss["@npmcli/template-oss"];

200 200

npmcli-docs-->semver;

201 201

npmcli-fs-->semver;

202 +

npmcli-git-->ini;

202 203

npmcli-git-->npm-pick-manifest;

203 204

npmcli-git-->npmcli-promise-spawn["@npmcli/promise-spawn"];

204 205

npmcli-git-->proc-log;

@@ -643,6 +644,7 @@ graph LR;

643 644

npmcli-docs-->unified;

644 645

npmcli-docs-->yaml;

645 646

npmcli-fs-->semver;

647 +

npmcli-git-->ini;

646 648

npmcli-git-->lru-cache;

647 649

npmcli-git-->npm-pick-manifest;

648 650

npmcli-git-->npmcli-promise-spawn["@npmcli/promise-spawn"];

@@ -801,4 +803,4 @@ packages higher up the chain.

801 803

- @npmcli/git, make-fetch-happen

802 804

- @npmcli/installed-package-contents, @npmcli/map-workspaces, cacache, npm-pick-manifest, promzard

803 805

- @npmcli/docs, @npmcli/fs, npm-bundled, read-package-json-fast, unique-filename, npm-install-checks, npm-package-arg, normalize-package-data, npm-packlist, bin-links, nopt, parse-conflict-json, @npmcli/mock-globals, read

804 -

- @npmcli/eslint-config, @npmcli/template-oss, ignore-walk, semver, npm-normalize-package-bin, @npmcli/name-from-folder, json-parse-even-better-errors, fs-minipass, ssri, unique-slug, @npmcli/promise-spawn, hosted-git-info, proc-log, validate-npm-package-name, @npmcli/node-gyp, @npmcli/redact, @npmcli/agent, minipass-fetch, @npmcli/query, cmd-shim, read-cmd-shim, write-file-atomic, abbrev, proggy, minify-registry-metadata, ini, mute-stream, npm-audit-report, npm-user-validate

806 +

- @npmcli/eslint-config, @npmcli/template-oss, ignore-walk, semver, npm-normalize-package-bin, @npmcli/name-from-folder, json-parse-even-better-errors, fs-minipass, ssri, unique-slug, @npmcli/promise-spawn, ini, hosted-git-info, proc-log, validate-npm-package-name, @npmcli/node-gyp, @npmcli/redact, @npmcli/agent, minipass-fetch, @npmcli/query, cmd-shim, read-cmd-shim, write-file-atomic, abbrev, proggy, minify-registry-metadata, mute-stream, npm-audit-report, npm-user-validate

Original file line number Diff line number Diff line change

@@ -1,12 +1,57 @@

1 +

const fs = require('node:fs')

2 +

const os = require('node:os')

3 +

const path = require('node:path')

4 +

const ini = require('ini')

5 + 6 +

const gitConfigPath = path.join(os.homedir(), '.gitconfig')

7 + 8 +

let cachedConfig = null

9 + 10 +

// Function to load and cache the git config

11 +

const loadGitConfig = () => {

12 +

if (cachedConfig === null) {

13 +

try {

14 +

cachedConfig = {}

15 +

if (fs.existsSync(gitConfigPath)) {

16 +

const configContent = fs.readFileSync(gitConfigPath, 'utf-8')

17 +

cachedConfig = ini.parse(configContent)

18 +

}

19 +

} catch (error) {

20 +

cachedConfig = {}

21 +

}

22 +

}

23 +

return cachedConfig

24 +

}

25 + 26 +

const checkGitConfigs = () => {

27 +

const config = loadGitConfig()

28 +

return {

29 +

sshCommandSetInConfig: config?.core?.sshCommand !== undefined,

30 +

askPassSetInConfig: config?.core?.askpass !== undefined,

31 +

}

32 +

}

33 + 34 +

const sshCommandSetInEnv = process.env.GIT_SSH_COMMAND !== undefined

35 +

const askPassSetInEnv = process.env.GIT_ASKPASS !== undefined

36 +

const { sshCommandSetInConfig, askPassSetInConfig } = checkGitConfigs()

37 + 1 38

// Values we want to set if they're not already defined by the end user

2 39

// This defaults to accepting new ssh host key fingerprints

3 -

const gitEnv = {

4 -

GIT_ASKPASS: 'echo',

5 -

GIT_SSH_COMMAND: 'ssh -oStrictHostKeyChecking=accept-new',

40 +

const finalGitEnv = {

41 +

...(askPassSetInEnv || askPassSetInConfig ? {} : {

42 +

GIT_ASKPASS: 'echo',

43 +

}),

44 +

...(sshCommandSetInEnv || sshCommandSetInConfig ? {} : {

45 +

GIT_SSH_COMMAND: 'ssh -oStrictHostKeyChecking=accept-new',

46 +

}),

6 47

}

48 + 7 49

module.exports = (opts = {}) => ({

8 50

stdioString: true,

9 51

...opts,

10 52

shell: false,

11 -

env: opts.env || { ...gitEnv, ...process.env },

53 +

env: opts.env || { ...finalGitEnv, ...process.env },

12 54

})

55 + 56 +

// Export the loadGitConfig function for testing

57 +

module.exports.loadGitConfig = loadGitConfig

Original file line number Diff line number Diff line change

@@ -1,6 +1,6 @@

1 1

{

2 2

"name": "@npmcli/git",

3 -

"version": "5.0.7",

3 +

"version": "5.0.8",

4 4

"main": "lib/index.js",

5 5

"files": [

6 6

"bin/",

@@ -38,6 +38,7 @@

38 38

},

39 39

"dependencies": {

40 40

"@npmcli/promise-spawn": "^7.0.0",

41 +

"ini": "^4.1.3",

41 42

"lru-cache": "^10.0.1",

42 43

"npm-pick-manifest": "^9.0.0",

43 44

"proc-log": "^4.0.0",

Original file line number Diff line number Diff line change

@@ -162,7 +162,7 @@

162 162

"devDependencies": {

163 163

"@npmcli/docs": "^1.0.0",

164 164

"@npmcli/eslint-config": "^4.0.2",

165 -

"@npmcli/git": "^5.0.7",

165 +

"@npmcli/git": "^5.0.8",

166 166

"@npmcli/mock-globals": "^1.0.0",

167 167

"@npmcli/mock-registry": "^1.0.0",

168 168

"@npmcli/template-oss": "4.22.0",

@@ -1626,13 +1626,14 @@

1626 1626

}

1627 1627

},

1628 1628

"node_modules/@npmcli/git": {

1629 -

"version": "5.0.7",

1630 -

"resolved": "https://registry.npmjs.org/@npmcli/git/-/git-5.0.7.tgz",

1631 -

"integrity": "sha512-WaOVvto604d5IpdCRV2KjQu8PzkfE96d50CQGKgywXh2GxXmDeUO5EWcBC4V57uFyrNqx83+MewuJh3WTR3xPA==",

1629 +

"version": "5.0.8",

1630 +

"resolved": "https://registry.npmjs.org/@npmcli/git/-/git-5.0.8.tgz",

1631 +

"integrity": "sha512-liASfw5cqhjNW9UFd+ruwwdEf/lbOAQjLL2XY2dFW/bkJheXDYZgOyul/4gVvEV4BWkTXjYGmDqMw9uegdbJNQ==",

1632 1632

"inBundle": true,

1633 1633

"license": "ISC",

1634 1634

"dependencies": {

1635 1635

"@npmcli/promise-spawn": "^7.0.0",

1636 +

"ini": "^4.1.3",

1636 1637

"lru-cache": "^10.0.1",

1637 1638

"npm-pick-manifest": "^9.0.0",

1638 1639

"proc-log": "^4.0.0",

Original file line number Diff line number Diff line change

@@ -193,7 +193,7 @@

193 193

"devDependencies": {

194 194

"@npmcli/docs": "^1.0.0",

195 195

"@npmcli/eslint-config": "^4.0.2",

196 -

"@npmcli/git": "^5.0.7",

196 +

"@npmcli/git": "^5.0.8",

197 197

"@npmcli/mock-globals": "^1.0.0",

198 198

"@npmcli/mock-registry": "^1.0.0",

199 199

"@npmcli/template-oss": "4.22.0",

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4