File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,11 @@ usage() {
1818 EOF
1919}
2020
21- detect_version () {
21+ # This should always run in a subshell because it manipulates the environment
22+ detect_version () (
23+ # Do not allow git to walk past the ZFSBootMenu tree to find a repository
24+ export GIT_CEILING_DIRECTORIES=" ${PWD} /.."
25+
2226 # If git-describe does the job, the job is done
2327 version=" $( git describe --tags HEAD 2> /dev/null) " || version=" "
2428
@@ -32,7 +36,7 @@ detect_version() {
3236 fi
3337
3438 # Otherwise, use git-rev-parse if possible
35- if branch=" $( git rev-parse --abbrev-rev HEAD 2> /dev/null) " ; then
39+ if branch=" $( git rev-parse --abbrev-ref HEAD 2> /dev/null) " ; then
3640 case " ${branch} " in
3741 v[0-9]* ) branch=" ${branch# v} "
3842 esac
@@ -75,7 +79,7 @@ detect_version() {
7579 # There is apparently no version
7680 echo " UNKNOWN"
7781 return 1
78- }
82+ )
7983
8084update_version () {
8185 version=" ${1?a version is required} "
You can’t perform that action at this time.
0 commit comments