Skip to content

Commit

Permalink
make Pkg check that the installed git version is 1.7.3+
Browse files Browse the repository at this point in the history
  • Loading branch information
jakebolewski committed Nov 3, 2014
1 parent 2414a86 commit 9c95976
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ Building Julia requires that the following software be installed:
- **[GNU make]** — building dependencies.
- **[gcc & g++][gcc]** or **[Clang][clang]** — compiling and linking C, C++ (if clang, need at least v3.1, Xcode 4.3.3 on OS X)
- **[gfortran][gcc]** — compiling and linking fortran libraries
- **[git]** — version control and package management.
- **[git]** — version control and package management (version 1.7.3+ required)
- **[perl]** — preprocessing of header files of libraries.
- **[wget]**, **[curl]**, or **[fetch]** (FreeBSD) — to automatically download external libraries.
- **[m4]** — needed to build GMP.
Expand Down
3 changes: 3 additions & 0 deletions base/pkg/dir.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ end

function init(meta::String=DEFAULT_META, branch::String=META_BRANCH)
dir = path()
if Git.version() < v"1.7.3"
warn("Pkg only works with git versions greater than v1.7.3")
end
info("Initializing package repository $dir")
if isdir(joinpath(dir,"METADATA"))
info("Package directory $dir is already initialized.")
Expand Down
2 changes: 2 additions & 0 deletions base/pkg/git.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ function success(args::Cmd; dir="")
Base.success(`$g $args`)
end

version() = VersionNumber(split(Git.readchomp(`version`), ' ')[3])

modules(args::Cmd; dir="") = readchomp(`config -f .gitmodules $args`, dir=dir)
different(verA::String, verB::String, path::String; dir="") =
!success(`diff-tree --quiet $verA $verB -- $path`, dir=dir)
Expand Down
2 changes: 2 additions & 0 deletions test/git.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import Base.Git
include("gitutils.jl")

@test Git.version() >= v"1.7.3"

dir = string("tmp.",randstring())
@test !ispath(dir)
mkdir(dir)
Expand Down

0 comments on commit 9c95976

Please sign in to comment.