[PATCH] git-gui: allow opening work trees from the startup dialog

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Mikhail Terekhov <termim@xxxxxxxxx>

In proc _is_git check that supplied path is a valid work tree path.
This allows the choose_repository::pick dialog to accept path to a
work tree directory.

Signed-off-by: Mikhail Terekhov <termim@xxxxxxxxx>
---
    git-gui: allow opening work trees from the startup dialog
    
    Trying to open a working tree from the "Open Existing Repository" link
    of the git-gui startup dialog results in an error: Not a Git repository:
    .... This patch fixes that error.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-644%2Ftermim%2Fgit-gui-open-worktree-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-644/termim/git-gui-open-worktree-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/644

 lib/choose_repository.tcl | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/lib/choose_repository.tcl b/lib/choose_repository.tcl
index e54f3e66d8f..8f911e89fbb 100644
--- a/lib/choose_repository.tcl
+++ b/lib/choose_repository.tcl
@@ -362,8 +362,19 @@ proc _is_git {path {outdir_var ""}} {
 		gets $fp line
 		close $fp
 		if {[regexp "^gitdir: (.+)$" $line line link_target]} {
+			set check_path [file normalize $path]
 			set path [file join [file dirname $path] $link_target]
 			set path [file normalize $path]
+
+			if {[file exists [file join $path gitdir]]} {
+				set fp [open [file join $path gitdir] r]
+				gets $fp worktree_path
+				close $fp
+				if {[string equal $check_path $worktree_path]} {
+					set outdir $path
+					return 1
+				}
+			}
 		}
 	}
 

base-commit: c195247812f8cd38ba7e1c603112e6c1d8d8e71e
-- 
gitgitgadget



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux