]> code.ossystems Code Review - openembedded-core.git/commitdiff
image-buildinfo: treat staged changes as modified branch, too
authorAndré Draszik <adraszik@tycoint.com>
Fri, 4 Nov 2016 10:53:33 +0000 (10:53 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 15 Nov 2016 15:11:56 +0000 (15:11 +0000)
When staging changes in a layer using git add, image-buildinfo
doesn't detect this as a modification, because of the way it
uses git diff.

Surely, merely staging, but not committing changes to git
should not result in image-buildhistory assuming that the
git repository hasn't been modified compared to the branch
HEAD, this state should be treated similarly to modifications
being unstaged.

We have to use both, git diff and git diff --cached to get the
desired result.

Signed-off-by: André Draszik <adraszik@tycoint.com>
Reported-by: Lukasz Nowak <lnowak@tycoint.com>
Reviewed-by: Lukasz Nowak <lnowak@tycoint.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/classes/image-buildinfo.bbclass

index 3003f5d2564d509808d94a7cd5f98d991f4ae7fb..da1edf7496c48adc88149aa2176468b58f8f6f00 100644 (file)
@@ -28,7 +28,9 @@ def image_buildinfo_outputvars(vars, listvars, d):
 def get_layer_git_status(path):
     import subprocess
     try:
-        subprocess.check_output("cd %s; PSEUDO_UNLOAD=1 git diff --quiet --no-ext-diff" % path,
+        subprocess.check_output("""cd %s; export PSEUDO_UNLOAD=1; set -e;
+                                git diff --quiet --no-ext-diff
+                                git diff --quiet --no-ext-diff --cached""" % path,
                                 shell=True,
                                 stderr=subprocess.STDOUT)
         return ""