Skip to content

Commit

Permalink
Make version.sh use VERSION file
Browse files Browse the repository at this point in the history
Hardcoding the version means it will often be out of date.
  • Loading branch information
nalimilan committed Feb 17, 2016
1 parent 4c5f0ce commit 1fac025
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,10 @@ Currently, the `@compat` macro supports the following syntaxes:
If you're adding additional compatibility code to this package, the [`bin/version.sh` script is useful for extracting the version number from a git commit SHA. For example, from the git repository of `julia`, run something like this:

```sh
bash $ /path/to/Compat/bin/version.sh e3aa57efbc6542efbcc7feac9b1309d628ac6f12
2418
bash $ /path/to/Compat/bin/version.sh a378b60fe483130d0d30206deb8ba662e93944da
0.5.0-dev+2023
```

This prints a number `XXXX`, and you can then test whether Julia
is at least this version by `VERSION >= v"0.4.0-dev+XXXX"` (assuming
it is a commit from the 0.4 development cycle).
is at least this version by `VERSION >= v"0.Y.0-dev+XXXX"` (assuming
it is a commit from the 0.Y development cycle).
5 changes: 3 additions & 2 deletions bin/version.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
last_tag=$(git describe --tags --abbrev=0)
echo -n "0.4.0-dev+"
git rev-list $1 ^$last_tag | wc -l | sed -e 's/[^[:digit:]]//g'
ver=$(cat VERSION)
nb=$(git rev-list $1 ^$last_tag | wc -l | sed -e 's/[^[:digit:]]//g')
echo "$ver+$nb"

0 comments on commit 1fac025

Please sign in to comment.