Skip to content

Commit

Permalink
Run git apply from the directory being patched (olofk#346)
Browse files Browse the repository at this point in the history
* Run git apply from the directory being patched

Git 2.3.3 introduced a check to prevent git apply from modifying files
outside the current working directory. FuseSoC's usage of --directory
requires disabling this check with --unsafe-paths in newer versions of
git.

Older versions of git, including git 1.8.3 shipped with RHEL 7, don't
perform the check or support the --unsafe-paths option. Therefore using
--directory in this manner would require a git version check and setting
the git apply options based on the result.

The simpler option is just running git apply from the directory being
patched, especially since this is already supported by the Launcher
class.
  • Loading branch information
GCHQDeveloper560 authored and olofk committed Jan 28, 2020
1 parent ccd2eb8 commit f59066f
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions fusesoc/provider/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,7 @@ def _patch(self):
+ os.path.join(self.files_root)
)
try:
Launcher(
"git",
[
"apply",
"--unsafe-paths",
"--directory",
self.files_root,
patch_file,
],
).run()
Launcher("git", ["apply", patch_file], self.files_root).run()
except OSError:
raise RuntimeError("Failed to call 'git' for patching core")

Expand Down

0 comments on commit f59066f

Please sign in to comment.