jupyterhub / nbgitpuller

Jupyter server extension to sync a git repository one-way to a local path
https://nbgitpuller.readthedocs.io
BSD 3-Clause "New" or "Revised" License
212 stars 86 forks source link

Remove suffix from repo folder #341

Open ctriquet-cs opened 9 months ago

ctriquet-cs commented 9 months ago

When cloning a Git project .git suffix is repository URL is kept what results in the creation of a folder named repository_name.git.

That PR proposes to remove that .git suffix.

welcome[bot] commented 9 months ago

Thanks for submitting your first pull request! You are awesome! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. welcome You can meet the other Jovyans by joining our Discourse forum. There is also a intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada:

yuvipanda commented 8 months ago

Thank you for the PR, @ctriquet-cs!

One question I have now is about backwards compatibility - what would happen in cases when the repo was previously already cloned with the .git prefix, and now that gets stripped out? That may lead to a new clone instead of just updating the currently existing clone, which may be alarming to the user if they have already done some work on the existing clone.

I think we can make this behavior backwards compatible in the following way:

  1. If .git is present in the URL of the repo, but we don't have an existing clone on the filesystem, strip .git
  2. If .git is present in the URL of the repo but we do have an existing clone on the filesystem including the .git suffix, let it be.

We'll probably also need a test added to catch this.

How does that sound, @ctriquet-cs?

ctriquet-cs commented 5 months ago

@yuvipanda Sorry for the delay in my response. Yes, that sounds like a good idea to maintain backwards compatibility. I have made the necessary modifications and added the corresponding unit tests.