-
Bug
-
Resolution: Unresolved
-
P4
-
None
-
None
When creating the vcs.xml file, the script attempts to determine if the directory is a "git repository" by doing:
if [ -d "$TOPLEVEL_DIR/.git" ] ; then
VCS_TYPE="Git"
fi
However, in a worktree, while a '.git' file exists, it's a normal file.
The simplest (but heuristic) way to improve this would be to change this test to:
if [ -f "$TOPLEVEL_DIR/.git" ] ; then ...
Since that covers both files and directories, but a less heuristic approach (if amenable to this cross platform script) would be to test the directory using git itself (if installed).
GITCMD="$(which git 2> /dev/null)"
if [[ -n "$GITCMD" && -x "$GITCMD" ]] && "$GITCMD" 'rev-parse' '--git-dir' > /dev/null 2>&1 ; then
VCS_TYPE="Git"
fi
This code does the "right thing" on Fedora Linux, but obviously Cygwin and MaxOS etc. need checking in order to be happy it.
if [ -d "$TOPLEVEL_DIR/.git" ] ; then
VCS_TYPE="Git"
fi
However, in a worktree, while a '.git' file exists, it's a normal file.
The simplest (but heuristic) way to improve this would be to change this test to:
if [ -f "$TOPLEVEL_DIR/.git" ] ; then ...
Since that covers both files and directories, but a less heuristic approach (if amenable to this cross platform script) would be to test the directory using git itself (if installed).
GITCMD="$(which git 2> /dev/null)"
if [[ -n "$GITCMD" && -x "$GITCMD" ]] && "$GITCMD" 'rev-parse' '--git-dir' > /dev/null 2>&1 ; then
VCS_TYPE="Git"
fi
This code does the "right thing" on Fedora Linux, but obviously Cygwin and MaxOS etc. need checking in order to be happy it.