Project

General

Profile

Actions

Bug #12239

closed

configure script does not detect Git when in a working tree with non-directory .git

Added by rhenium (Kazuki Yamaguchi) almost 8 years ago. Updated almost 8 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:74759]

Description

make up doesn't work well on a Git working tree created by git-worktree add.

% 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) 0001-improve-git-repository-detection.patch rhenium (Kazuki Yamaguchi), 03/31/2016 05:38 PM
Actions

Also available in: Atom PDF

Like0
Like0