Skip to content

Commit 83ae346

Browse files
authored
Merge pull request #236 from lyda/git-version-bsd-fix
Fix version processing on BSD systems.
2 parents 978b5a8 + b469b65 commit 83ae346

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

vcsh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ clone() {
166166
You should add files to your new repository."
167167
exit
168168
fi
169-
GIT_VERSION_MAJOR=$(git --version | sed -n 's/.* \([0-9]\+\)\..*/\1/p' )
169+
GIT_VERSION_MAJOR=$(git --version | sed -E -n 's/.* ([0-9]+)\..*/\1/p' )
170170
if [ 1 -lt "$GIT_VERSION_MAJOR" ];then
171171
git fetch origin "$VCSH_BRANCH"
172172
else
@@ -482,8 +482,8 @@ write_gitignore() {
482482
use
483483
cd "$VCSH_BASE" || fatal "could not enter '$VCSH_BASE'" 11
484484
local GIT_VERSION="$(git --version)"
485-
local GIT_VERSION_MAJOR=$(echo $GIT_VERSION | sed -n 's/.* \([0-9]\+\)\..*/\1/p')
486-
local GIT_VERSION_MINOR=$(echo $GIT_VERSION | sed -n 's/.* \([0-9]\+\)\.\([0-9]\+\)\..*/\2/p')
485+
local GIT_VERSION_MAJOR=$(echo $GIT_VERSION | sed -E -n 's/.* ([0-9]+)\..*/\1/p')
486+
local GIT_VERSION_MINOR=$(echo $GIT_VERSION | sed -E -n 's/.* ([0-9]+)\.([0-9]+)\..*/\2/p')
487487
OLDIFS=$IFS
488488
IFS=$(printf '\n\t')
489489
gitignores=$(for file in $(git ls-files); do

0 commit comments

Comments
 (0)