Changeset - r23805:2e9ff516b19f
[Not reviewed]
master
0 2 0
George Koehler - 5 years ago 2019-08-28 21:45:36
kernigh@gmail.com
Fix: Allow git worktree in version detection; drop svn, hg.

If $ROOT_DIR is a linked working tree from git-worktree(1), then
$ROOT_DIR/.git is a regular file instead of a directory. Allow this
when deciding whether to use git to detect OpenTTD's version.

Drop checks for svn and hg in config.lib, because findversion.sh
hasn't used svn nor hg since 192770e6da.
2 files changed with 2 insertions and 12 deletions:
0 comments (0 inline, 0 general)
config.lib
Show inline comments
 
@@ -1056,24 +1056,14 @@ check_params() {
 
			log 1 "configure: error: either select OSX as OS, or deselect ppc970"
 

	
 
			exit 1
 
		fi
 
	fi
 

	
 
	if [ -d "$ROOT_DIR/.svn" ] && [ -n "`svn help 2>/dev/null`" ]; then
 
		log 1 "checking revision... svn detection"
 
	elif [ -d "$ROOT_DIR/../.svn" ] && [ -n "`svn help 2>/dev/null`" ] && [ -n "`LC_ALL=C svn info $ROOT_DIR/.. | grep '^URL:.*tags$'`" ]; then
 
		# subversion changed its behaviour; now not all folders have a .svn folder,
 
		# but only the root folder. Since making tags requires a (sparse) checkout
 
		# of the tags folder, the folder of the tag does not have a .svn folder
 
		# anymore and this fails to detect the subversion repository checkout.
 
		log 1 "checking revision... svn detection (tag)"
 
	elif [ -d "$ROOT_DIR/.git" ] && [ -n "`git help 2>/dev/null`" ]; then
 
	if { [ -d "$ROOT_DIR/.git" ] || [ -f "$ROOT_DIR/.git" ]; } && [ -n "`git help 2>/dev/null`" ]; then
 
		log 1 "checking revision... git detection"
 
	elif [ -d "$ROOT_DIR/.hg" ] && [ -n "`HGPLAIN= hg help 2>/dev/null`" ]; then
 
		log 1 "checking revision... hg detection"
 
	elif [ -f "$ROOT_DIR/.ottdrev" ]; then
 
		log 1 "checking revision... source tarball"
 
	else
 
		log 1 "checking revision... no detection"
 
		log 1 "WARNING: there is no means to determine the version."
 
		log 1 "WARNING: please use a subversion, mercurial, or git checkout of OpenTTD."
findversion.sh
Show inline comments
 
@@ -56,13 +56,13 @@ fi
 
cd `dirname "$0"`
 
ROOT_DIR=`pwd`
 

	
 
# Determine if we are using a modified version
 
# Assume the dir is not modified
 
MODIFIED="0"
 
if [ -d "$ROOT_DIR/.git" ]; then
 
if [ -d "$ROOT_DIR/.git" ] || [ -f "$ROOT_DIR/.git" ]; then
 
	# We are a git checkout
 
	# Refresh the index to make sure file stat info is in sync, then look for modifications
 
	git update-index --refresh >/dev/null
 
	if [ -n "`git diff-index HEAD`" ]; then
 
		MODIFIED="2"
 
	fi
0 comments (0 inline, 0 general)