Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] image-buildinfo: treat staged changes as modified branch, too
@ 2016-11-04 10:53 André Draszik
  0 siblings, 0 replies; only message in thread
From: André Draszik @ 2016-11-04 10:53 UTC (permalink / raw)
  To: openembedded-core

From: André Draszik <adraszik@tycoint.com>

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>
---
 meta/classes/image-buildinfo.bbclass | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/meta/classes/image-buildinfo.bbclass b/meta/classes/image-buildinfo.bbclass
index 3003f5d..da1edf7 100644
--- a/meta/classes/image-buildinfo.bbclass
+++ b/meta/classes/image-buildinfo.bbclass
@@ -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 ""
-- 
2.10.2



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-11-04 10:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-04 10:53 [PATCH] image-buildinfo: treat staged changes as modified branch, too André Draszik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox