From: k@... Date: 2016-04-01T04:30:21+00:00 Subject: [ruby-core:74759] [Ruby trunk Bug#12239] configure script does not detect Git when in a working tree with non-directory .git Issue #12239 has been reported by Kazuki Yamaguchi. ---------------------------------------- Bug #12239: configure script does not detect Git when in a working tree with non-directory .git https://bugs.ruby-lang.org/issues/12239 * Author: Kazuki Yamaguchi * Status: Open * Priority: Normal * Assignee: * ruby -v: * Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN ---------------------------------------- `make up` doesn't work well on a Git working tree created by `git-worktree add`. ~~~sh % git clone https://github.com/ruby/ruby.git ruby-src % cd ruby-src % git worktree add -f test-tree trunk % cd test-tree % autoconf && ./configure % make up # => cannot retrieving mspec ... Cloning into 'spec/mspec'... remote: Counting objects: 5135, done. ... % grep VCS Makefile # => VCS = echo cannot ... ~~~ The current configure script's VCS detection flow is: 1. If `svn into $srcdir` succeeds -> VCS=svn 2. If $srcdir/.git/svn is a directory -> VCS="git svn" 3. If $srcdir/.git is a directory -> VCS=git 4. If none satisfy -> VCS="echo cannot" The 2. and 3. are problematic. When $srcdir is a Git working tree created by `git-worktree add` (or is a submodule), $srcdir/.git is not a directory but a file pointing at the real git directory. I attached a patch which fixes this using `git-rev-parse`: we can get the real git directory (such as .git and .git/worktrees/test-tree) with `git --work-tree="$srcdir" --git-dir="$srcdir/.git" rev-parse --git-dir`. git-worktree is a fairly new command but the --work-tree option exists since Git 1.5.3 (released in 2010). On nmake, the VCS detection is done by checking for the existence of $srcdir/.{svn,git,git/svn} (regardless of the type), so it works for plain Git working trees but not for git-svn trees. However I don't know how to get command output with nmake, so I left win32/Makefile.sub untouched. ---Files-------------------------------- 0001-improve-git-repository-detection.patch (3.11 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: