Skip to content

Commit

Permalink
git-gui: Fixes chooser not accepting gitfiles
Browse files Browse the repository at this point in the history
Support the case where .git is a platform independent symbolic link
and not a directory. This occurs when --separate-git-dir is used when
creating the local repository to store the .git directory elsewhere.

git-gui does not support such repositories when using the repository
chooser as the test to determine that the chosen directory is a git
repository fails for such repositories.

This commit enables _is_git to read the real location from the
symbolic link file.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Signed-off-by: Remi Rampin <remirampin@gmail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
  • Loading branch information
Remi Rampin authored and Pat Thoyts committed Mar 7, 2015
1 parent ce3e848 commit cc6825e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/choose_repository.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -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]]} {
Expand Down

0 comments on commit cc6825e

Please sign in to comment.