gitbutlerapp / gitbutler

The GitButler version control client, backed by Git, powered by Tauri/Rust/Svelte
https://gitbutler.com
Other
13.49k stars 534 forks source link

Clone Repository does not support custom target directories #5732

Open FarrisPandell opened 1 day ago

FarrisPandell commented 1 day ago

Version

0.14.1

Operating System

Windows

Distribution Method

msi (Windows)

Describe the issue

When cloning a respository using Clone repository, the repository is cloned into a directory with the same name as the repository. This necessitates manually renaming and moving the directory if a directory with that name already exists.

How to reproduce

  1. Select Clone repository.
  2. Enter the URL for the repository in Clone URL.
  3. Enter the parent directory in Where to clone.
  4. Click Clone >.
  5. If a child directory with the repository name already exist in the parent directory, GitButler responds with Error: Refusing to initialize the non-empty directory as '<parent directory>\<repository>'.

Expected behavior

I often have multiple clones of repositories in a single directory for comparison purposes and experimentation. It would be useful if GitButler would allow cloning to a different directory than <parent directory>\<repository> or at least override the repository directory so one could clone to a custom diretory like <parent directory>\<custom>.

Relevant log output

No response

Byron commented 11 hours ago

Thanks for reporting!

I also think that it would be nice to at least pre-empt this error, and provide a way to enter an alternative name while indicating that it indeed doesn't yet exist on disk.

This is definitely a UX question, so CC @PavelLaptev, as in theory it would be nice to have a preview of the final directory path which would contain the clone, along with an indication if it exists or not. If it does exist, one could have an extra field that allows to change the target directory until there is no conflict anymore, i.e. the directory doesn't exist yet.

Screenshot 2024-12-04 at 08 09 31

CC @ndom91 as this error message showed up right after entering the clone pane, and it seems to reproduce immediately after entering the clone-pane the second time, after cancelling the first time.