Author: emaste
Date: Fri Jun 29 18:45:29 2018
New Revision: 335800
URL: https://svnweb.freebsd.org/changeset/base/335800

Log:
  newvers.sh: avoid possibly invalid relative directory
  
  Previously newvers.sh passed --work-tree=${VCSDIR}/.. when invoking git.
  When using git worktree .git is actually a file, not a directory, and
  .git/.. is not a valid path.  Although it appears git handles this
  internally (perhaps it normalizes the path first), it is simple enough
  for the script to store both the working tree top-level directory and
  the VCS (.git) directory, so do so.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/conf/newvers.sh

Modified: head/sys/conf/newvers.sh
==============================================================================
--- head/sys/conf/newvers.sh    Fri Jun 29 17:51:35 2018        (r335799)
+++ head/sys/conf/newvers.sh    Fri Jun 29 18:45:29 2018        (r335800)
@@ -65,7 +65,8 @@ findvcs()
        cd ${SYSDIR}/..
        while [ $(pwd) != "/" ]; do
                if [ -e "./$1" ]; then
-                       VCSDIR=$(pwd)"/$1"
+                       VCSTOP=$(pwd)
+                       VCSDIR=${VCSTOP}"/$1"
                        cd ${savedir}
                        return 0
                fi
@@ -239,7 +240,7 @@ if [ -n "$git_cmd" ] ; then
        if [ -n "$git_b" ] ; then
                git="${git}(${git_b})"
        fi
-       if $git_cmd --work-tree=${VCSDIR}/.. diff-index \
+       if $git_cmd --work-tree=${VCSTOP} diff-index \
            --name-only HEAD | read dummy; then
                git="${git}-dirty"
                modified=true
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to