Skip to content

Create new branch in new repo #1363

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions jupyterlab_git/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -1323,6 +1323,15 @@ async def init(self, path):
}
return {"code": code, "actions": actions}

async def _empty_commit_for_init(self, path):
cmd = ["git", "commit", "--allow-empty", "-m", '"First Commit"']

code, _, error = await self.__execute(cmd, cwd=path)

if code != 0:
return {"code": code, "command": " ".join(cmd), "message": error}
return {"code": code}

async def _maybe_run_actions(self, name, cwd):
code = 0
actions = None
Expand Down
3 changes: 3 additions & 0 deletions jupyterlab_git/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,9 @@ async def post(self, path: str = ""):
"""
body = await self.git.init(self.url2localpath(path))

if body["code"] == 0:
body = await self.git._empty_commit_for_init(self.url2localpath(path))

if body["code"] != 0:
self.set_status(500)

Expand Down
Loading