Skip to content

Commit 6ff8d68

Browse files
committed
git-gui: use git-clone
git-gui clones a repository by invoking git-plumbing commands, in proc do_clone, rather than using git-clone. The justification was that the low-level commands are guaranteed to provide a stable interface, while the higher level commands such as git-clone may not be stable. This approach requires git-gui to continually evolve by mirroring new features in git itself, which has not happened, while the user interface in git-clone has proven very stable. Also, git-gui does directly call many other non-plumbing commands in git's repertoire. do_clone's last significant functionality change was in 2015, and updates are required for shallow clones, the reftable backend, cloning from linked worktrees, and perhaps other features and bugs. For instance, I had reports of git-gui failing to correctly clone repositories prior to 2015, resulting in essentially the patch given here. The only significant work was supporting .gitfile linked worktrees unknown to do_clone, but supported by git-clone, and none regarding the interface to git-clone itself. That interface is clearly stable enough to not be a problem. Supporting new use-cases with this requires exposing new options in the clone dialog, then passing flags to git-clone. This avoids updating do_clone to understand those options, reducing the maintenance burdens. So, teach git-gui to use git-clone. This change is in one patch as there is no obvious incremental path to migration. The existing dialog / options / status screen are unchanged, the known user-visible changes are that cloning from a working directory linked by a gitfile now works, there is no auto-fallback to a full copy when cloning linked workdirs and worktrees (meaning git-clone fails unless a full or shared copy is selected), and messages displayed are from git-clone. Signed-off-by: Mark Levedahl <[email protected]>
1 parent c939344 commit 6ff8d68

File tree

2 files changed

+34
-435
lines changed

2 files changed

+34
-435
lines changed

git-gui.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,6 +1215,9 @@ if {[catch {
12151215
load_config 1
12161216
apply_config
12171217
choose_repository::pick
1218+
if {![file isdirectory $_gitdir]} {
1219+
exit 1
1220+
}
12181221
set picked 1
12191222
}
12201223

0 commit comments

Comments
 (0)