Skip to content

Commit 0664fe5

Browse files
Resolve compatibility issue with Git 2.4
Git 2.4 (once again!) changes output when current state is a detached branch, it is now: * (HEAD detached at arc-2014.12) This patch adds support for this new format as well. Has been reported as Issue #60. Signed-off-by: Anton Kolesov <[email protected]>
1 parent 4d005f0 commit 0664fe5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

arc-versions.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,11 @@ do
156156
then
157157
# Only update to latest if we are not in detached HEAD mode.
158158
# If tree is in detahed state, output differs between Git versions:
159-
# Git 1.8 prints: * (detached from <tag_name>>)
159+
# Git >=2.4 prints: *(HEAD detached at <tag_name>)
160+
# Git 1.8-2.3 prints: * (detached from <tag_name>)
160161
# Git <1.8 prints: * (no branch)
161-
if ! git branch | grep -q -e '\* (detached from .*)' -e '\* (no branch)'
162+
if ! git branch | grep -q -e '\* (HEAD detached at .*)' \
163+
-e '\* (detached from .*)' -e '\* (no branch)'
162164
then
163165
echo " pulling latest version"
164166
if ! git pull

0 commit comments

Comments
 (0)