@gw-tools/gw 0.12.17 → 0.12.19
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/README.md +11 -0
- package/install.js +10 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -272,6 +272,9 @@ When `gw add` creates a new branch, it automatically configures the branch to tr
|
|
|
272
272
|
**Git Ref Conflict Detection:**
|
|
273
273
|
The command automatically detects and prevents Git ref naming conflicts. For example, you cannot have both a branch named `test` and `test/foo` because Git stores branches as files in `.git/refs/heads/`, and `test` cannot be both a file and a directory. If a conflict is detected, you'll receive a helpful error message with suggestions for resolving it.
|
|
274
274
|
|
|
275
|
+
**Existing Worktree Navigation:**
|
|
276
|
+
If you try to add a worktree that already exists, the command will prompt you to navigate to it instead. Press Enter (default: Yes) to navigate, or type 'n' to cancel. This requires shell integration to be installed (see [install-shell](#install-shell)).
|
|
277
|
+
|
|
275
278
|
#### Arguments
|
|
276
279
|
|
|
277
280
|
- `<worktree-name>`: Name or path for the new worktree
|
|
@@ -301,6 +304,14 @@ gw add feat/new-feature .env secrets/
|
|
|
301
304
|
|
|
302
305
|
# Force create even if branch exists elsewhere
|
|
303
306
|
gw add feat/bugfix -f
|
|
307
|
+
|
|
308
|
+
# If worktree already exists, prompts to navigate to it
|
|
309
|
+
gw add feat/existing-branch
|
|
310
|
+
# Output: Worktree feat/existing-branch already exists at:
|
|
311
|
+
# /path/to/repo/feat/existing-branch
|
|
312
|
+
#
|
|
313
|
+
# Navigate to it? [Y/n]:
|
|
314
|
+
# (Press Enter to navigate, or 'n' to cancel)
|
|
304
315
|
```
|
|
305
316
|
|
|
306
317
|
#### Auto-Copy Configuration
|
package/install.js
CHANGED
|
@@ -109,6 +109,9 @@ async function install() {
|
|
|
109
109
|
// Make binary executable on Unix-like systems
|
|
110
110
|
if (platform() !== 'win32') {
|
|
111
111
|
chmodSync(binaryPath, 0o755);
|
|
112
|
+
// Small delay to prevent ETXTBSY race condition on Linux
|
|
113
|
+
// The file can be "text busy" immediately after chmod
|
|
114
|
+
await new Promise(resolve => setTimeout(resolve, 100));
|
|
112
115
|
}
|
|
113
116
|
|
|
114
117
|
console.log('✓ Installation complete!');
|
|
@@ -134,7 +137,7 @@ async function install() {
|
|
|
134
137
|
/**
|
|
135
138
|
* Install shell integration
|
|
136
139
|
*/
|
|
137
|
-
async function installShellIntegration(binaryPath) {
|
|
140
|
+
async function installShellIntegration(binaryPath, retries = 3) {
|
|
138
141
|
const { spawn } = require('child_process');
|
|
139
142
|
|
|
140
143
|
return new Promise((resolve) => {
|
|
@@ -151,7 +154,12 @@ async function installShellIntegration(binaryPath) {
|
|
|
151
154
|
resolve();
|
|
152
155
|
});
|
|
153
156
|
|
|
154
|
-
child.on('error', (err) => {
|
|
157
|
+
child.on('error', async (err) => {
|
|
158
|
+
// Retry on ETXTBSY (text file busy) error
|
|
159
|
+
if (err.code === 'ETXTBSY' && retries > 0) {
|
|
160
|
+
await new Promise(r => setTimeout(r, 200));
|
|
161
|
+
return installShellIntegration(binaryPath, retries - 1).then(resolve);
|
|
162
|
+
}
|
|
155
163
|
console.log(' (Shell integration can be installed later with: gw install-shell)');
|
|
156
164
|
resolve();
|
|
157
165
|
});
|