Commit e39b9279 authored by Vitaly Lipatov's avatar Vitaly Lipatov

move get_root_git_dir to common module,

add in is_gear file path support
parent dd6a203d
......@@ -59,10 +59,24 @@ print_list()
done
}
get_root_git_dir()
{
local DIR="$1"
[ -n "$DIR" ] || DIR=$(pwd)
[ "$DIR" = "/" ] && return 1
if [ -d "$DIR/.git" ] ; then
readlink -f "$DIR"
return
fi
get_root_git_dir $(dirname "$DIR") || return 1
}
# Usage: is_gear [path_to_spec|dir_inside_git]
is_gear()
{
local DIR=$1
local DIR="$1"
[ -z "$IGNOREGEAR" ] || return 1
[ -f "$DIR" ] && DIR=$(dirname "$DIR")
local GITDIR=$(get_root_git_dir "$DIR")
[ -d "$GITDIR/.gear" ] && return 0
[ -r "$GITDIR/.gear-rules" ] && return 0
......
......@@ -20,18 +20,6 @@ get_current_branch()
git branch | grep '^\*' | sed 's/^..//' | tr -d "\n"
}
get_root_git_dir()
{
local DIR="$1"
[ -n "$DIR" ] || DIR=$(pwd)
[ "$DIR" = "/" ] && return 1
if [ -d "$DIR/.git" ] ; then
readlink -f "$DIR"
return
fi
get_root_git_dir $(dirname "$DIR") || return 1
}
get_remote_git_list()
{
local i
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment