classification
Title: git doesn't support "-C" args under 1.8.5 occurs in configure.ac
Type: Stage: patch review
Components: Build Versions: Python 3.8, Python 3.7, Python 3.6, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Yuan Liu, eitan.adler, ned.deily, xiang.zhang
Priority: normal Keywords: patch

Created on 2017-05-20 09:29 by Yuan Liu, last changed 2018-08-12 09:20 by xiang.zhang.

Pull Requests
URL Status Linked Edit
PR 1679 closed python-dev, 2017-05-20 09:46
PR 1680 closed python-dev, 2017-05-20 10:09
PR 8744 open xiang.zhang, 2018-08-12 09:20
Messages (3)
msg294021 - (view) Author: Yuan Liu (Yuan Liu) * Date: 2017-05-20 09:29
git doesn't support "-C" args under 1.8.5 occurs in configure.ac

as I noticed from git release notes in 1.8.5: 

 * Just like "make -C <directory>", "git -C <directory> ..." tells Git
   to go there before doing anything else.

So we should have some conditional statements in configure.ac around git checkpoint, otherwise we got error message which is :

Unknown option: -C
usage: git [--version] [--help] [-c name=value]
           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           <command> [<args>]
msg320032 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2018-06-20 07:40
Encounter the same problem on centos7 and git version is 1.8.3. Instead of checking the version to use -C option, maybe we could just use --git-dir for the same purpose?

--- a/configure
+++ b/configure
@@ -2749,9 +2749,9 @@ HAS_GIT=no-repository
 fi
 if test $HAS_GIT = found
 then
-    GITVERSION="git -C \$(srcdir) rev-parse --short HEAD"
-    GITTAG="git -C \$(srcdir) describe --all --always --dirty"
-    GITBRANCH="git -C \$(srcdir) name-rev --name-only HEAD"
+    GITVERSION="git --git-dir \$(srcdir)/.git rev-parse --short HEAD"
+    GITTAG="git --git-dir \$(srcdir)/.git describe --all --always --dirty"
+    GITBRANCH="git --git-dir \$(srcdir)/.git name-rev --name-only HEAD"
 else
     GITVERSION=""
     GITTAG=""
diff --git a/configure.ac b/configure.ac
index b13728e..278ed9f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -39,9 +39,9 @@ HAS_GIT=no-repository
 fi
 if test $HAS_GIT = found
 then
-    GITVERSION="git -C \$(srcdir) rev-parse --short HEAD"
-    GITTAG="git -C \$(srcdir) describe --all --always --dirty"
-    GITBRANCH="git -C \$(srcdir) name-rev --name-only HEAD"
+    GITVERSION="git --git-dir \$(srcdir)/.git rev-parse --short HEAD"
+    GITTAG="git --git-dir \$(srcdir)/.git describe --all --always --dirty"
+    GITBRANCH="git --git-dir \$(srcdir)/.git name-rev --name-only HEAD"
 else
     GITVERSION=""
     GITTAG=""

This could give me the right sys._git info.
msg320290 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-06-22 22:55
Thanks for the PR.  I agree with Xiang Zhang that using --git-dir appears to be a better solution.  See other review comments on the PR.
History
Date User Action Args
2018-08-12 09:20:19xiang.zhangsetkeywords: + patch
stage: patch review
pull_requests: + pull_request8227
2018-06-22 22:55:13ned.deilysetmessages: + msg320290
2018-06-20 07:40:03xiang.zhangsetversions: + Python 2.7, Python 3.6, Python 3.8
nosy: + xiang.zhang, ned.deily

messages: + msg320032

components: + Build
2018-05-16 07:44:14eitan.adlersetnosy: + eitan.adler
2017-05-20 10:09:03python-devsetpull_requests: + pull_request1775
2017-05-20 09:46:27python-devsetpull_requests: + pull_request1774
2017-05-20 09:29:22Yuan Liucreate