Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filterdiff not removing the header from excluded files in a git patch #46

Closed
brianjmurrell opened this issue Dec 7, 2020 · 3 comments
Closed

Comments

@brianjmurrell
Copy link

If I have a patch produced from git such as:

diff --git a/selftests/functional/test_basic.py b/selftests/functional/test_basic.py
index 468b7d57..ed494733 100644
--- a/selftests/functional/test_basic.py
+++ b/selftests/functional/test_basic.py
@@ -184,6 +184,13 @@ class RunnerOperationTest(unittest.TestCase):
         self.assertIn('    data     ' + mapping['data_dir'], result.stdout)
         self.assertIn('    logs     ' + mapping['logs_dir'], result.stdout)
 
+    def test_runner_phases(self):
+        cmd_line = ('%s run --sysinfo=off --job-results-dir %s '
+                    'phases.py' % (AVOCADO, self.tmpdir))
+        result = process.run(cmd_line)
+        expected_rc = exit_codes.AVOCADO_ALL_OK
+        self.assertEqual(result.exit_status, expected_rc,
+                         "Avocado did not return rc %d:\n%s" % (expected_rc, result))
     def test_runner_all_ok(self):
         os.chdir(basedir)
         cmd_line = ('%s run --sysinfo=off --job-results-dir %s '

and run it through filterdiff -p1 -x selftests/\*, the header of the file being excluded from the patch is still included:

$ filterdiff -p1 -x selftests/\* < foo.patch
diff --git a/selftests/functional/test_basic.py b/selftests/functional/test_basic.py
index 468b7d57..ed494733 100644

Which causes patch to barf:

$ filterdiff -p1 -x selftests/\* < foo.patch | patch -p1 --dry-run
can't find file to patch at input line 2
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/selftests/functional/test_basic.py b/selftests/functional/test_basic.py
|index 468b7d57..ed494733 100644
--------------------------
File to patch: 
@brianjmurrell
Copy link
Author

Interestingly, this doesn't seem to happen if my patch has two files that it patches and I exclude the first file in my filterdiff command.

@sergiomb2
Copy link
Contributor

filterdiff -p1 -x selftests/* < foo.patch returned one empty line

version of filterdiif

filterdiff --version
filterdiff - patchutils version 0.4.2

@brianjmurrell
Copy link
Author

Hrm.

$ filterdiff --version
filterdiff - patchutils version 0.3.3

I'll go bug RHEL to update, fix the bug at least. Sorry for the noise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants