Skip to content

Commit

Permalink
make Git versioning resilient to non-git tarballs
Browse files Browse the repository at this point in the history
closes nrnrnr#24
  • Loading branch information
nrnrnr authored and dbosk committed Mar 6, 2024
1 parent 78cba42 commit 1bbe2df
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 2 deletions.
Empty file added .gitversionmark
Empty file.
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
CHANGES FOR VERSION 2.13
binaries now track which git version they are
support for LaTeX is updated to use \rmfamily, \bfseries, and so on
Fixed indentation issue https://github.com/nrnrnr/noweb/issues/24
add \@nwbegincodelinewidth to help typeset code chunks in list items
Expand Down
7 changes: 7 additions & 0 deletions src/INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ either Icon or Awk, but Icon is better:
(This breaking change was put in to enable the Awk and Icon codes
to generate *identical* outputs, for regression testing.)

- As of version 2.13, the `c/Makefile` contains a GNU-ism.
If you don't have GNU Make, you'll need to find the use of
`$(wildcard ...)` and expand it manually. If you're not using
`git`, remove the dependency. If you are using git,
change the invocation of `wildcard` to hold just the path
name to `master`.


To build noweb:

Expand Down
2 changes: 1 addition & 1 deletion src/c/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ doc.ps: doc.dvi
markup.ps: markmain.nw
notangle -Rmarkup.dot markmain.nw | dot -Tps > $@

gitversion.c: ../gitversion ../../.git/refs/heads/master
gitversion.c: ../gitversion $(wildcard ../../.git/refs/heads/master)
echo 'const char gitversion[] = "'"$$(../gitversion -prefix)"'";' > $@


Expand Down
20 changes: 19 additions & 1 deletion src/gitversion
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,22 @@ case $1 in
*) prefix="" ;;
esac

echo "$prefix$(git describe --abbrev=20 --dirty --always --tags)"
notversioned="${prefix}Not under Git versioning"

search=.

while [ ! -r "$search/.gitversionmark" ]; do
search="$search/.."
case $search in
./../../../../../../..*) echo "$0: Cannot find git version mark"
echo "$notversioned"
exit
;;
esac
done

if [ -r "$search/.git/refs/heads/master" ]; then
echo "$prefix$(git describe --abbrev=20 --dirty --always --tags)"
else
echo "$notversioned"
fi

0 comments on commit 1bbe2df

Please sign in to comment.