ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [1/5] incubator-ignite git commit: # gg-9869: test on uncommitted changes
Date Thu, 05 Mar 2015 11:35:03 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/gg-9869 03f890ad9 -> adedd6ac1


# gg-9869: test on uncommitted changes


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/46c33b27
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/46c33b27
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/46c33b27

Branch: refs/heads/gg-9869
Commit: 46c33b270bed90e4c20789bdf5a5e65deb29cd9b
Parents: 03f890a
Author: Artem Shutak <ashutak@gridgain.com>
Authored: Thu Mar 5 13:55:29 2015 +0300
Committer: Artem Shutak <ashutak@gridgain.com>
Committed: Thu Mar 5 13:55:29 2015 +0300

----------------------------------------------------------------------
 scripts/git-format-patch.sh    |  2 +-
 scripts/git-patch-functions.sh | 42 +++++++++++++++++++++++++++++++------
 2 files changed, 37 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/46c33b27/scripts/git-format-patch.sh
----------------------------------------------------------------------
diff --git a/scripts/git-format-patch.sh b/scripts/git-format-patch.sh
index 3e784db..b7642b0 100644
--- a/scripts/git-format-patch.sh
+++ b/scripts/git-format-patch.sh
@@ -50,7 +50,7 @@ echo
 # Main script logic.
 #
 
-#exitIfThereAreUncommittedChanges
+require_clean_work_tree ${IGNITE_HOME}
 #
 #checkBranchExists ${IGNITE_HOME} ${CURRENT_BRANCH}
 #

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/46c33b27/scripts/git-patch-functions.sh
----------------------------------------------------------------------
diff --git a/scripts/git-patch-functions.sh b/scripts/git-patch-functions.sh
index 8f5b2bb..afc5d80 100644
--- a/scripts/git-patch-functions.sh
+++ b/scripts/git-patch-functions.sh
@@ -96,11 +96,9 @@ exitIfBranchDoesNotExist () {
 
     if [ -z "$BRANCH_EXISTS" ] # If not.
     then
-        echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-        echo ">>>>>>>>>>>>>>>>>>>>>>>>>>
ERROR >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-        echo ">>> Expected branch ${BRANCH} does not exist at ${GIT_HOME}"
-        echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
-        
+        echo $0", ERROR:"
+        echo "Expected branch ${BRANCH} does not exist at ${GIT_HOME}"
+
         exit
     fi
 }
@@ -113,4 +111,36 @@ determineCurrentBranch () {
     CURRENT_BRANCH=`git rev-parse --abbrev-ref HEAD`
     
     echo "$CURRENT_BRANCH"
-}
\ No newline at end of file
+}
+
+require_clean_work_tree () {
+    cd $1 # At git home.
+
+    # Update the index
+    git update-index -q --ignore-submodules --refresh
+    err=0
+
+    # Disallow unstaged changes in the working tree
+    if ! git diff-files --quiet --ignore-submodules --
+    then
+        echo $0", ERROR:"
+        echo >&2 "You have unstaged changes."
+        git diff-files --name-status -r --ignore-submodules -- >&2
+        err=1
+    fi
+
+    # Disallow uncommitted changes in the index
+    if ! git diff-index --cached --quiet HEAD --ignore-submodules --
+    then
+        echo $0", ERROR:"
+        echo >&2 "Your index contains uncommitted changes."
+        git diff-index --cached --name-status -r --ignore-submodules HEAD -- >&2
+        err=1
+    fi
+
+    if [ $err = 1 ]
+    then
+        echo >&2 "Please commit or stash them."
+        exit 1
+    fi
+}


Mime
View raw message