mirror of
https://git.yoctoproject.org/poky
synced 2026-04-18 21:32:12 +02:00
lib/oe/patch: fix for git am not cleaning up after itself
Unfortunately it appears that under certain circumstances, a failed git am followed by git am --abort won't clean up any changes the patch might have made - this was seen when running "devtool extract" on the unzip recipe; unzip-6.0_overflow3.diff has a malformed date as far as git am is concerned but it triggers this condition. Add a git reset --hard HEAD followed by git clean -f in order to recover from this scenario. (From OE-Core rev: 21fdbd76f458b70a6646dd6d0749e3a465ebd320) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
8fb70c6e7a
commit
e0b9a96002
@@ -407,6 +407,13 @@ class GitApplyTree(PatchTree):
|
||||
runcmd(["sh", "-c", " ".join(shellcmd)], self.dir)
|
||||
except CmdError:
|
||||
pass
|
||||
# git am won't always clean up after itself, sadly, so...
|
||||
shellcmd = ["git", "--work-tree=%s" % reporoot, "reset", "--hard", "HEAD"]
|
||||
runcmd(["sh", "-c", " ".join(shellcmd)], self.dir)
|
||||
# Also need to take care of any stray untracked files
|
||||
shellcmd = ["git", "--work-tree=%s" % reporoot, "clean", "-f"]
|
||||
runcmd(["sh", "-c", " ".join(shellcmd)], self.dir)
|
||||
|
||||
# Fall back to git apply
|
||||
shellcmd = ["git", "--git-dir=%s" % reporoot, "apply", "-p%s" % patch['strippath']]
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user