[Intel-gfx] [maintainer-tools PATCH 4/4] dim: unify repo clean checks to a single assert_repo_clean helper
Jani Nikula
jani.nikula at intel.com
Tue Mar 15 09:20:38 UTC 2016
Moreover, 'git diff-index --quiet HEAD' kept failing on me even though
the repo was clean (merely running 'git status' always fixed this). So
use the other one.
Signed-off-by: Jani Nikula <jani.nikula at intel.com>
---
dim | 27 +++++++++++----------------
1 file changed, 11 insertions(+), 16 deletions(-)
diff --git a/dim b/dim
index 83cc5161c767..9c8ae1098977 100755
--- a/dim
+++ b/dim
@@ -411,11 +411,7 @@ function dim_apply_branch
local file=`mktemp`
assert_branch $branch
-
- if [[ -n `git status --porcelain --untracked-files=no` ]] ; then
- echo Repository not clean, aborting
- exit 2
- fi
+ assert_repo_clean
cat > $file
@@ -676,16 +672,6 @@ function dim_conf
dim_checkout drm-intel-next-fixes "$@"
}
-function check_repo_clean
-{
- cd $1
- if ! git diff-index --quiet HEAD ; then
- echo $2 repo not clean, aborting
- exit 1
- fi
-
-}
-
# $1 is the git sha1 to check
function checkpatch_commit
{
@@ -986,7 +972,8 @@ function dim_update_branches
for remote in $DIM_DRM_INTEL_REMOTE $DIM_DRM_UPSTREAM_REMOTE origin; do
git fetch $remote
done
- check_repo_clean $DIM_PREFIX/$DIM_DRM_INTEL Kernel
+
+ assert_repo_clean
for branch in $dim_branches ; do
dim_checkout $branch
@@ -1110,6 +1097,14 @@ function assert_branch
fi
}
+function assert_repo_clean
+{
+ if [[ -n "$(git status --porcelain --untracked-files=no)" ]]; then
+ echo "Repository not clean, aborting."
+ exit 1
+ fi
+}
+
# Note: used by bash completion
function dim_list_commands
{
--
2.1.4
More information about the Intel-gfx
mailing list