Commit 988bf45c authored by Alban Bruder's avatar Alban Bruder

Check for updates on curent branch

parent 24481786
......@@ -274,15 +274,16 @@ is_var_set() {
### Check if the git repository in CWD has unpulled commits on the
### master branch, without actually fetching anything.
### current branch, without actually fetching anything.
###
### \params $1 remote (default: origin)
### \params $2 branch (default: master)
### \params $2 branch (default: current)
git_repo_has_updates() {
(
cd "$WEBIS_CMD_ROOT_PATH"
branch="$(git branch --show-current)"
local_ref="$(git rev-parse HEAD)"
remote_ref="$(git ls-remote "${1:-origin}" | grep "refs/heads/${2:-master}" | cut -f1)"
remote_ref="$(git ls-remote "${1:-origin}" | grep "refs/heads/${2:-$branch}" | cut -f1)"
[ "$local_ref" != "$remote_ref" ] && git merge-base --is-ancestor "${1:-origin}/${2:-master}" HEAD
)
}
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