@shivanshshrivas/gwit 0.1.2 → 0.1.3
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/dist/index.cjs +7 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -210,6 +210,9 @@ function branchExistsRemote(branch) {
|
|
|
210
210
|
const result = runArgsSafe("git", ["ls-remote", "--heads", "origin", branch]);
|
|
211
211
|
return result.success && result.stdout.length > 0;
|
|
212
212
|
}
|
|
213
|
+
function fetchOrigin() {
|
|
214
|
+
runArgsInherited("git", ["fetch", "origin"]);
|
|
215
|
+
}
|
|
213
216
|
function addWorktree(worktreePath, branch, isNew) {
|
|
214
217
|
const args = isNew ? ["worktree", "add", "-b", branch, worktreePath] : ["worktree", "add", worktreePath, branch];
|
|
215
218
|
runArgsInherited("git", args);
|
|
@@ -624,6 +627,10 @@ async function createCommand(branch, options) {
|
|
|
624
627
|
);
|
|
625
628
|
}
|
|
626
629
|
assertBranchResolvable(branch, isNew);
|
|
630
|
+
if (!isNew && !branchExistsLocal(branch)) {
|
|
631
|
+
ui.step("Fetching from origin\u2026");
|
|
632
|
+
fetchOrigin();
|
|
633
|
+
}
|
|
627
634
|
const config = await ensureConfig();
|
|
628
635
|
const mainPath = getMainWorktreePath();
|
|
629
636
|
const slug = toSlug(branch);
|