Skip to content

Commit 5542797

Browse files
committed
Add backend support for branching from an arbitrary branch
1 parent a756c3f commit 5542797

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

jupyterlab_git/git.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,12 +606,13 @@ def reset_to_commit(self, commit_id, top_repo_path):
606606
)
607607
return my_output
608608

609-
def checkout_new_branch(self, branchname, current_path):
609+
def checkout_new_branch(self, branchname, startpoint, current_path):
610610
"""
611611
Execute git checkout <make-branch> command & return the result.
612612
"""
613+
cmd = ["git", "checkout", "-b", branchname, startpoint]
613614
p = Popen(
614-
["git", "checkout", "-b", branchname],
615+
cmd,
615616
stdout=PIPE,
616617
stderr=PIPE,
617618
cwd=os.path.join(self.root_dir, current_path),

jupyterlab_git/handlers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ def post(self):
320320
if data["checkout_branch"]:
321321
if data["new_check"]:
322322
my_output = self.git.checkout_new_branch(
323-
data["branchname"], top_repo_path
323+
data["branchname"], data["startpoint"], top_repo_path
324324
)
325325
else:
326326
my_output = self.git.checkout_branch(data["branchname"], top_repo_path)

0 commit comments

Comments
 (0)