Patchwork [5/7] scripts/combo-layer: fix dirty repo check

login
register
mail settings
Submitter Paul Eggleton
Date Nov. 4, 2011, 5:55 p.m.
Message ID <3dd638cdc46847b64d4397ffd5b0fa1190f0b2c8.1320429268.git.paul.eggleton@linux.intel.com>
Download mbox | patch
Permalink /patch/14295/
State Accepted
Commit f03fa8bbafa82ce6b09c08bf86011b6c51eb3531
Headers show

Comments

Paul Eggleton - Nov. 4, 2011, 5:55 p.m.
Fix the dirty repository check to detect any changes, including
untracked files and uncommitted changes in the index.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 scripts/combo-layer |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

Patch

diff --git a/scripts/combo-layer b/scripts/combo-layer
index 4cb9ee0..f3480dc 100755
--- a/scripts/combo-layer
+++ b/scripts/combo-layer
@@ -138,12 +138,8 @@  def check_repo_clean(repodir):
         check if the repo is clean
         exit if repo is dirty
     """
-    try:
-        runcmd("git diff --quiet", repodir)
-        #TODO: also check the index using "git diff --cached"
-        #      but this will fail in just initialized git repo
-        #      so need figure out a way
-    except:
+    output=runcmd("git status --porcelain", repodir)
+    if output:
         logger.error("git repo %s is dirty, please fix it first", repodir)
         sys.exit(1)