pinokiod 5.0.5 → 5.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1498,14 +1498,11 @@ class Api {
1498
1498
  // let keypath = path.resolve(this.kernel.homedir, "key.json")
1499
1499
  // this.kernel.keys = (await this.loader.load(keypath)).resolved
1500
1500
 
1501
- // ensure gitconfig defaults and clear stale git locks before any shell commands run
1501
+ // ensure gitconfig defaults before any shell commands run
1502
1502
  if (this.kernel.git) {
1503
1503
  if (typeof this.kernel.git.ensureDefaults === "function") {
1504
1504
  await this.kernel.git.ensureDefaults()
1505
1505
  }
1506
- if (typeof this.kernel.git.clearStaleLock === "function") {
1507
- await this.kernel.git.clearStaleLock()
1508
- }
1509
1506
  }
1510
1507
  // init shell before running just to make sure the environment variables are fresh
1511
1508
  await this.kernel.shell.init()
package/kernel/bin/git.js CHANGED
@@ -52,8 +52,8 @@ class Git {
52
52
  async uninstall(req, ondata) {
53
53
  await this.kernel.bin.exec({ message: "conda remove git gh" }, ondata)
54
54
  }
55
- env() {
56
- let gitconfig_path = path.resolve(this.kernel.homedir, "gitconfig")
55
+ env(cwd) {
56
+ const gitconfig_path = path.resolve(this.kernel.homedir, "gitconfig")
57
57
  return {
58
58
  GIT_CONFIG_GLOBAL: gitconfig_path,
59
59
  GH_CONFIG_DIR: this.kernel.path("config/gh")
package/kernel/git.js CHANGED
@@ -105,10 +105,9 @@ class Git {
105
105
  await fs.promises.writeFile(gitconfigPath, ini.stringify(config))
106
106
  }
107
107
  }
108
- async clearStaleLock(homeOverride) {
109
- const home = homeOverride || this.kernel.homedir
110
- if (!home) return
111
- const lockPath = path.resolve(home, ".git", "index.lock")
108
+ async clearStaleLock(repoPath) {
109
+ if (!repoPath) return
110
+ const lockPath = path.resolve(repoPath, ".git", "index.lock")
112
111
  try {
113
112
  await fs.promises.access(lockPath, fs.constants.F_OK)
114
113
  } catch (_) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "5.0.5",
3
+ "version": "5.0.6",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/server/index.js CHANGED
@@ -62,10 +62,22 @@ const Info = require("../kernel/info")
62
62
 
63
63
  const Setup = require("../kernel/bin/setup")
64
64
 
65
- function normalize(str) {
66
- if (!str) return '';
67
- return (str.endsWith('\n') ? str : str + '\n').replace(/\r\n/g, '\n');
68
- }
65
+ function normalize(str) {
66
+ if (!str) return '';
67
+ return (str.endsWith('\n') ? str : str + '\n').replace(/\r\n/g, '\n');
68
+ }
69
+
70
+ this.gitEnv = (repoPath) => {
71
+ const gitBin = this.kernel.bin && this.kernel.bin.git ? this.kernel.bin.git : null
72
+ if (gitBin && typeof gitBin.env === 'function') {
73
+ const env = gitBin.env(repoPath)
74
+ if (this.kernel.git && typeof this.kernel.git.clearStaleLock === "function" && repoPath) {
75
+ this.kernel.git.clearStaleLock(repoPath).catch(() => {})
76
+ }
77
+ return env
78
+ }
79
+ return {}
80
+ }
69
81
 
70
82
  class Server {
71
83
  constructor(config) {