Skip to content
Snippets Groups Projects
Commit 30f7207b authored by Simona Vetter's avatar Simona Vetter
Browse files

dim: Add git_is_current_branch helper


And use it everywhere. Found a few more places that don't use the
usual style.

Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
parent 96f998a1
No related branches found
No related tags found
No related merge requests found
...@@ -302,6 +302,11 @@ function git_fetch_helper # remote ...@@ -302,6 +302,11 @@ function git_fetch_helper # remote
fi fi
} }
function git_is_current_branch # branch
{
git branch --list $1 | grep -q '\*'
}
if [[ "$((`date +%s` % 100))" -eq "0" ]] ; then if [[ "$((`date +%s` % 100))" -eq "0" ]] ; then
dim_uptodate dim_uptodate
fi fi
...@@ -439,7 +444,7 @@ function dim_rebuild_tip ...@@ -439,7 +444,7 @@ function dim_rebuild_tip
echo "Done." echo "Done."
cd $DIM_PREFIX/$integration_branch cd $DIM_PREFIX/$integration_branch
if ! git branch --list $integration_branch | grep -q '\*' ; then if ! git_is_current_branch $integration_branch ; then
echo "Branch setup for the integration repo is borked" echo "Branch setup for the integration repo is borked"
exit 1 exit 1
fi fi
...@@ -517,7 +522,7 @@ function dim_rebuild_tip ...@@ -517,7 +522,7 @@ function dim_rebuild_tip
echo -n "Updating rerere cache... " echo -n "Updating rerere cache... "
cd $rerere cd $rerere
if git branch --list rerere-cache | grep -q '\*' ; then if git_is_current_branch rerere-cache ; then
remote=`branch_to_remote rerere-cache` remote=`branch_to_remote rerere-cache`
git pull >& /dev/null git pull >& /dev/null
...@@ -1310,7 +1315,7 @@ function dim_update_branches ...@@ -1310,7 +1315,7 @@ function dim_update_branches
$DRY git reset --hard $DIM_DRM_INTEL_REMOTE/drm-intel-next $DRY git reset --hard $DIM_DRM_INTEL_REMOTE/drm-intel-next
cd $DIM_PREFIX/maintainer-tools cd $DIM_PREFIX/maintainer-tools
if git branch | grep maintainer-tools | grep '\*' ; then if git_is_current_branch maintainer-tools ; then
echo "Updating maintainer-tools ..." echo "Updating maintainer-tools ..."
git pull --rebase git pull --rebase
fi fi
...@@ -1425,7 +1430,7 @@ function assert_branch ...@@ -1425,7 +1430,7 @@ function assert_branch
dim_cd $branch dim_cd $branch
if git branch | grep $branch | grep '\*' ; then if git_is_current_branch $branch ; then
return 0 return 0
else else
echo "You're on the wrong branch, expected $branch in $PWD" echo "You're on the wrong branch, expected $branch in $PWD"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment