git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/2] Fixes chooser not accepting gitfiles

From
Remi Rampin <remirampin@gmail.com>
Date
Mar 6, 2015, 16:21 UTC
Message-ID
<1425658913-2721-2-git-send-email-remirampin@gmail.com>
In-Reply-To
<1425658913-2721-1-git-send-email-remirampin@gmail.com>
Makes _is_git handle the case where the path is a "gitdir: ..." file.
Signed-off-by: Remi Rampin <remirampin@gmail.com>
---
 lib/choose_repository.tcl | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff --git a/lib/choose_repository.tcl b/lib/choose_repository.tcl
index 92d6022..abc6b1d 100644
--- a/lib/choose_repository.tcl
+++ b/lib/choose_repository.tcl
@@ -339,6 +339,16 @@ method _git_init {} {
 }
 
 proc _is_git {path} {
+	if {[file isfile $path]} {
+		set fp [open $path r]
+		gets $fp line
+		close $fp
+		if {[regexp "^gitdir: (.+)$" $line line link_target]} {
+			set path [file join [file dirname $path] $link_target]
+			set path [file normalize $path]
+		}
+	}
+
 	if {[file exists [file join $path HEAD]]
 	 && [file exists [file join $path objects]]
 	 && [file exists [file join $path config]]} {
-- 
1.9.5.msysgit.0
Previous: Remi RampinNext: Remi Rampin
Message 2 of 4 in “[git-gui] "Open existing repository" with submodules”
  1. 0/2 [git-gui] "Open existing repository" with submodulesRemi Rampin, Mar 6, 2015
  2. 1/2 Fixes chooser not accepting gitfilesRemi Rampin, Mar 6, 2015
  3. 2/2 Makes chooser set 'gitdir' to the resolved pathRemi Rampin, Mar 6, 2015
  4. Pat ThoytsMar 12, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.