Minimum supported git version?

209 views
Skip to first unread message

Miles Gould

unread,
Mar 5, 2014, 4:31:15 PM3/5/14
to juli...@googlegroups.com
I've just cloned and built Julia for the first time (it looks very cool! I'm keen to get involved). While running `make` and `make test` I got the following errors:

usage: git rev-list [OPTION] <commit-id>... [ -- paths... ]
  limiting output:
    --max-count=nr
    --max-age=epoch
[snip]

and

fatal: bad revision '^upstream/master'
fatal: Not a valid object name upstream/master

Further investigation revealed that these errors were coming from `base/version_git.sh` lines 36 and 49. The first error was occurring because the version of git on my machine (v1.7.1) doesn't support the --count option to git-rev-list, which was added some time later in the 1.7.x series. It's easy enough to fix: see https://github.com/pozorvlak/julia/commit/3acbf28bd430996cfa470b1ae4bdec7ca71f4ddb.

The second error occurred because I'd cloned my fork, added an "upstream" remote and then run `git pull upstream master` rather than cloning the JuliaLang/julia.git repository directly; running `git fetch upstream` made it go away. I mention it here in case someone else has the same problem and is searching for the error message.

Note that these errors didn't merely clutter up `make` output - they were also causing an incorrect base/version_git.jl to be generated.

Anyway, is the patch above of any interest? If so, I'll submit a pull request. I ask because I see that the current version of git is now 1.9.0. If git v1.7.1 is too old to be worth supporting, what's the minimum supported version of git? I looked to see if this was documented anywhere but couldn't find it - CONTRIBUTING.md would be the obvious place for that information.

Miles

Stefan Karpinski

unread,
Mar 5, 2014, 4:38:15 PM3/5/14
to Julia Dev
I've had issues with 1.7.1 too but I'm pretty sure that 1.7.3 works ok.

Tony Kelman

unread,
Mar 5, 2014, 5:13:59 PM3/5/14
to juli...@googlegroups.com
I was seeing some strange errors in version_git.sh as well, with Windows git 1.8.5.2.msysgit.0. Maybe a bit different issue.

fatal: No names found, cannot describe anything.
fatal: bad revision '^'
fatal: bad revision '^master'
fatal: Not a valid object name master

Miles Gould

unread,
Mar 5, 2014, 6:10:31 PM3/5/14
to juli...@googlegroups.com
I had a theory that maybe you didn't have a remote pointing to github.com/JuliaLang/julia.git and that was causing the error you were seeing, but I just tried removing mine and I don't get the same error. It looks like you don't have a local "master" branch, which would be surprising. What's the output of "git remote -v" and "git branch"? And can you run "sh -x base/version_git.sh" to find out which lines are producing the error messages?

Miles

Tony Kelman

unread,
Mar 5, 2014, 6:30:53 PM3/5/14
to juli...@googlegroups.com
Aha. I'm seeing this in an AppVeyor CI environment, where indeed I don't have a local master branch. I'm apparently in a detached state, since AppVeyor checks out a specific commit, then I had to make some local modifications to fix line endings. Can/should this situation be fixed in version_git.sh?


```
5git clone --depth=50 --branch=appveyor https://github.com/tkelman/julia.git C:\projects\julia
6git checkout -qf 45f02b6633a0081b875cfa71c238fb3e6a7eda7c

251git --version
252git version 1.8.5.2.msysgit.0
253git remote -v
256git branch
257* (detached from 45f02b6)
258 appveyor
259sh -x base/version_git.sh
260+ echo '# This file was autogenerated in base/version_git.sh'
261# This file was autogenerated in base/version_git.sh
262+ echo 'immutable GitVersionInfo'
263immutable GitVersionInfo
264+ echo ' commit::String'
265 commit::String
266+ echo ' commit_short::String'
267 commit_short::String
268+ echo ' branch::String'
269 branch::String
270+ echo ' build_number::Int'
271 build_number::Int
272+ echo ' date_string::String'
273 date_string::String
274+ echo ' tagged_commit::Bool'
275 tagged_commit::Bool
276+ echo ' fork_master_distance::Int'
277 fork_master_distance::Int
278+ echo ' fork_master_timestamp::Float64'
279 fork_master_timestamp::Float64
280+ echo end
281end
282+ echo ''
284+ '[' 0 = 1 -a '' = NO_GIT ']'
285++ git config -l
286++ grep 'remote\.\w*\.url.*JuliaLang/julia.git'
287++ sed -n 's/remote\.\([a-zA-Z]*\)\..*/\1\//p'
288+ origin=
289++ git describe --tags --abbrev=0
290fatal: No names found, cannot describe anything.
291+ last_tag=
292++ git log -1 --pretty=format:%ct
293+ git_time=1394061473
294++ git rev-parse HEAD
295+ commit=45f02b6633a0081b875cfa71c238fb3e6a7eda7c
296++ git rev-parse --short HEAD
297+ commit_short=45f02b6
298++ git status --porcelain
299+ '[' -n ' M base/version_git.sh
300 M contrib/relative_path.sh
301 M deps/find_python_for_llvm
302 M deps/jldownload
303 M deps/libuv
304?? cyg-get.log
305?? get-deps.log
306?? llvm-3.3-w64-bin-x86_64-20130804.7z
307?? llvm/
308?? mingw64-pcre-8.34-1.fc21.noarch.rpm
309?? mingw64-readline-6.2-3.fc20.noarch.rpm
310?? mingw64-termcap-1.3.1-16.fc20.noarch.rpm' ']'
311+ commit_short='45f02b6*'
312++ git branch
313++ sed -n '/\* /s///p'
314+ branch='(detached from 45f02b6)'
315++ git rev-list --count HEAD '^'
316fatal: bad revision '^'
317+ build_number=
318+ date_string=1394061473
319++ uname
320+ '[' CYGWIN_NT-6.2 = Darwin ']'
321++ uname
322+ '[' CYGWIN_NT-6.2 = FreeBSD ']'
323++ /bin/date --date=@1394061473 -u '+%Y-%m-%d %H:%M %Z'
324+ date_string='2014-03-05 23:17 UTC'
325++ git describe --tags --exact-match
326+ '[' ']'
327+ tagged_commit=false
328+++ echo
329++ git rev-list --count HEAD '^master'
330fatal: bad revision '^master'
331+ fork_master_distance=
332++++ echo
333+++ git merge-base HEAD master
334fatal: Not a valid object name master
335++ git show -s --format=format:%ct
336+ fork_master_timestamp=1394061473
337+ '[' -z '' ']'
338+ build_number=0
339+ '[' -z '' ']'
340+ fork_master_distance=-1
341+ '[' -z 1394061473 ']'
342+ echo 'const GIT_VERSION_INFO = GitVersionInfo('
343const GIT_VERSION_INFO = GitVersionInfo(
344+ echo ' "45f02b6633a0081b875cfa71c238fb3e6a7eda7c",'
345 "45f02b6633a0081b875cfa71c238fb3e6a7eda7c",
346+ echo ' "45f02b6*",'
347 "45f02b6*",
348+ echo ' "(detached from 45f02b6)",'
349 "(detached from 45f02b6)",
350+ echo ' 0,'
351 0,
352+ echo ' "2014-03-05 23:17 UTC",'
353 "2014-03-05 23:17 UTC",
354+ echo ' false,'
355 false,
356+ echo ' -1,'
357 -1,
358+ echo ' 1394061473.'
359 1394061473.
360+ echo ')'
```

Ivar Nesje

unread,
Mar 6, 2014, 5:52:09 AM3/6/14
to juli...@googlegroups.com
Thanks for the reports. The ancient git version not having --count has actually come up before in #5587. There was one objection about depending on wc, but I do not think that should be a problem. Feel free to submit a PR.

If version_git.sh could be written in a more compatible way, it should definelty be. I did not do anything to hide unknown errors, but I tried to make it so that the generated file would be syntactically valid, and that error should not break the build. (the version info is definitely not that important).


@Tony Kelman I do not know anything about the build procedure on windows nor AppVeyor, but in a CI enviorment you are probably not depending on
`versioninfo()` to return correct info. One solution (that will save you 1-10 seconds on the build time) is to add NO_GIT=1 to the Make.user file or in the build script.
That will prevent the make process to do anything with git, but depending on how you deal with dependencies, you might have to run `git submodule update --init`
manually.

The problem you have is that I try to calculate the number of parent commits to your currently checked out state that is not in the official master repository.
I parse the config to find the right remote name, and try to fall back to the local master branch. If everything fails, it should set fork_master_distance to -1
and that seems to work for you.
Reply all
Reply to author
Forward
0 new messages