Skip to content

Commit

Permalink
check for valid git version number in pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
jakebolewski committed Nov 20, 2014
1 parent 0271941 commit 1c238cd
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]** (>= 4.4) or **[Clang][clang]** (>= 3.1, Xcode 4.3.3 on OS X) — compiling and linking C, C++
- **[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::AbstractString=DEFAULT_META, branch::AbstractString=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::AbstractString, verB::AbstractString, path::AbstractString; 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 1c238cd

Please sign in to comment.