]> git.ipfire.org Git - thirdparty/git.git/commitdiff
git-gui: use git_init to create new repository dir
authorMark Levedahl <mlevedahl@gmail.com>
Fri, 9 Feb 2024 22:58:04 +0000 (17:58 -0500)
committerMark Levedahl <mlevedahl@gmail.com>
Sat, 19 Jul 2025 03:48:06 +0000 (23:48 -0400)
When creating a new repository, git-gui creates a directory, cds to it,
then runs git-init, but git-init learned to create and initialize the
directory in 1.6.5. git-gui requires git version >= 2.36, so teach
git-gui to use git-init's full capability.

Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
lib/choose_repository.tcl

index 5b361cc424a6f659b9a1a2d4915efe28769919cb..1711f7ca554718b58ebbfd8eebfa43ff17201c43 100644 (file)
@@ -323,7 +323,7 @@ method _write_local_path {args} {
 }
 
 method _git_init {} {
-       if {[catch {file mkdir $local_path} err]} {
+       if {[catch {git init $local_path} err]} {
                error_popup [strcat \
                        [mc "Failed to create repository %s:" $local_path] \
                        "\n\n$err"]
@@ -337,13 +337,6 @@ method _git_init {} {
                return 0
        }
 
-       if {[catch {git init} err]} {
-               error_popup [strcat \
-                       [mc "Failed to create repository %s:" $local_path] \
-                       "\n\n$err"]
-               return 0
-       }
-
        _append_recentrepos [pwd]
        set ::_gitdir .git
        set ::_prefix {}