[maintainer-tools PATCH 4/4] dim: unify repo clean checks to a single assert_repo_clean helper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux