git-gui: use git_init to create new repository dir

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>

Mark Levedahl committed Feb 9, 2024 at 17:58 UTC c85557098f90801583866d9829719b6e2cf4cd49
1 file changed +1 -8
lib/choose_repository.tcl
+1 -8
@@ -323,7 +323,7 @@ method _write_local_path {args} {
323 }
324
325 method _git_init {} {
326 - if {[catch {file mkdir $local_path} err]} {
326 + if {[catch {git init $local_path} err]} {
327 error_popup [strcat \
328 [mc "Failed to create repository %s:" $local_path] \
329 "\n\n$err"]
@@ -337,13 +337,6 @@ method _git_init {} {
337 return 0
338 }
339
340 - if {[catch {git init} err]} {
341 - error_popup [strcat \
342 - [mc "Failed to create repository %s:" $local_path] \
343 - "\n\n$err"]
344 - return 0
345 - }
346 -
340 _append_recentrepos [pwd]
341 set ::_gitdir .git
342 set ::_prefix {}