Index: head/sys/conf/newvers.sh =================================================================== --- head/sys/conf/newvers.sh +++ head/sys/conf/newvers.sh @@ -96,7 +96,10 @@ COPYRIGHT="$COPYRIGHT " -include_metadata=true +# We expand include_metadata later since we may set it to the +# future value of modified. +include_metadata=yes +modified=no while getopts crRvV: opt; do case "$opt" in c) @@ -104,12 +107,10 @@ exit 0 ;; r) - include_metadata= + include_metadata=no ;; R) - if [ -z "${modified}" ]; then - include_metadata= - fi + include_metadata=if-modified ;; v) # Only put variables that are single lines here. @@ -253,7 +254,7 @@ case "$svn" in [0-9]*[MSP]|*:*) svn=" r${svn}" - modified=true + modified=yes ;; [0-9]*) svn=" r${svn}" @@ -296,7 +297,7 @@ fi if git_tree_modified; then git="${git}-dirty" - modified=true + modified=yes fi fi @@ -312,7 +313,8 @@ fi fi -if [ -z "${include_metadata}" ]; then +[ ${include_metadata} = "if-modified" -a ${modified} = "yes" ] && include_metadata=yes +if [ ${include_metadata} != "yes" ]; then VERINFO="${VERSION}${svn}${git}${hg} ${i}" VERSTR="${VERINFO}\\n" else