javascript-solid-server 0.0.43 → 0.0.45
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.
- package/.claude/settings.local.json +3 -1
- package/package.json +1 -1
- package/src/handlers/git.js +10 -22
|
@@ -137,7 +137,9 @@
|
|
|
137
137
|
"Bash(git checkout:*)",
|
|
138
138
|
"Bash(gh gist edit:*)",
|
|
139
139
|
"Bash(gh gist view:*)",
|
|
140
|
-
"Bash(./bin/git-credential-nostr acl:*)"
|
|
140
|
+
"Bash(./bin/git-credential-nostr acl:*)",
|
|
141
|
+
"Bash(DATA_ROOT=/tmp/jss-git-test/data node:*)",
|
|
142
|
+
"Bash(git remote set-url:*)"
|
|
141
143
|
]
|
|
142
144
|
}
|
|
143
145
|
}
|
package/package.json
CHANGED
package/src/handlers/git.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { spawn } from 'child_process';
|
|
2
2
|
import { existsSync, statSync } from 'fs';
|
|
3
|
-
import { join } from 'path';
|
|
3
|
+
import { join, resolve } from 'path';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Check if a URL path is a Git protocol request
|
|
@@ -85,7 +85,7 @@ export async function handleGit(request, reply) {
|
|
|
85
85
|
dataRoot = join(dataRoot, request.podName);
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
const repoAbs =
|
|
88
|
+
const repoAbs = resolve(dataRoot, repoRelative);
|
|
89
89
|
|
|
90
90
|
// Find git directory
|
|
91
91
|
const gitInfo = findGitDir(repoAbs);
|
|
@@ -93,6 +93,14 @@ export async function handleGit(request, reply) {
|
|
|
93
93
|
return reply.code(404).send({ error: 'Not a git repository' });
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
+
// Auto-configure non-bare repos to accept pushes and update working directory
|
|
97
|
+
if (gitInfo.isRegular && isGitWriteOperation(urlPath)) {
|
|
98
|
+
spawn('git', ['config', 'receive.denyCurrentBranch', 'updateInstead'], {
|
|
99
|
+
cwd: repoAbs,
|
|
100
|
+
env: { ...process.env, GIT_DIR: gitInfo.gitDir }
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
96
104
|
// Build CGI environment
|
|
97
105
|
const env = {
|
|
98
106
|
...process.env,
|
|
@@ -202,26 +210,6 @@ export async function handleGit(request, reply) {
|
|
|
202
210
|
reply.code(500).send({ error: 'Git operation failed' });
|
|
203
211
|
}
|
|
204
212
|
|
|
205
|
-
// Auto-checkout working directory after successful push to non-bare repo
|
|
206
|
-
if (code === 0 && isGitWriteOperation(urlPath) && gitInfo.isRegular) {
|
|
207
|
-
const checkout = spawn('git', ['checkout', '-f'], {
|
|
208
|
-
cwd: repoAbs,
|
|
209
|
-
env: {
|
|
210
|
-
...process.env,
|
|
211
|
-
GIT_DIR: gitInfo.gitDir,
|
|
212
|
-
GIT_WORK_TREE: repoAbs
|
|
213
|
-
}
|
|
214
|
-
});
|
|
215
|
-
checkout.on('error', (err) => {
|
|
216
|
-
console.error('Auto-checkout failed:', err.message);
|
|
217
|
-
});
|
|
218
|
-
checkout.on('close', (checkoutCode) => {
|
|
219
|
-
if (checkoutCode !== 0) {
|
|
220
|
-
console.error('Auto-checkout exited with code:', checkoutCode);
|
|
221
|
-
}
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
|
|
225
213
|
resolve();
|
|
226
214
|
});
|
|
227
215
|
});
|