| Message ID | 20250915090208.2007216-1-skandigraun@gmail.com |
|---|---|
| State | Accepted, archived |
| Commit | 6c7bb23b05ab613d5efe8e1378d7e1b1cc8cfc45 |
| Headers | show |
| Series | [1/4] patchtest: apply patch in repo root | expand |
Hi, Just wanted to say thanks for submitting these - I didn't catch them earlier. :) On 2025-09-15 05:02, Gyorgy Sarvari via lists.openembedded.org wrote: > Patchtest tries to apply the received patch on the repository, without > specifying the directory, which means that the CWD is used. In case the > patch modifies a content in a different folder (e.g. the script is running > in ./meta, but the patch modifies ./meta-selftest), the patch will be skipped, > but git still returns 0, instead of complaining. > > To avoid such false positives, specify the working directory for applying the > patch - the top of the repodir. > > Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com> > --- > meta/lib/patchtest/repo.py | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/meta/lib/patchtest/repo.py b/meta/lib/patchtest/repo.py > index 8ec8f68a0b..2cdd6736e4 100644 > --- a/meta/lib/patchtest/repo.py > +++ b/meta/lib/patchtest/repo.py > @@ -52,7 +52,7 @@ class PatchTestRepo(object): > self._patchcanbemerged = True > try: > # Make sure to get the absolute path of the file > - self.repo.git.execute(['git', 'apply', '--check', os.path.abspath(self.patch.path)], with_exceptions=True) > + self.repo.git.execute(['git', '-C', self.repodir, 'apply', '--check', os.path.abspath(self.patch.path)], with_exceptions=True) > except git.exc.GitCommandError as ce: > self._patchcanbemerged = False > > @@ -76,7 +76,7 @@ class PatchTestRepo(object): > > def merge(self): > if self._patchcanbemerged: > - self.repo.git.execute(['git', 'am', '--keep-cr', os.path.abspath(self.patch.path)]) > + self.repo.git.execute(['git', '-C', self.repodir, 'am', '--keep-cr', os.path.abspath(self.patch.path)]) > self._patchmerged = True > > def clean(self): > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#223391): https://lists.openembedded.org/g/openembedded-core/message/223391 > Mute This Topic: https://lists.openembedded.org/mt/115250666/7611679 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [tgamblin@baylibre.com] > -=-=-=-=-=-=-=-=-=-=-=- >
diff --git a/meta/lib/patchtest/repo.py b/meta/lib/patchtest/repo.py index 8ec8f68a0b..2cdd6736e4 100644 --- a/meta/lib/patchtest/repo.py +++ b/meta/lib/patchtest/repo.py @@ -52,7 +52,7 @@ class PatchTestRepo(object): self._patchcanbemerged = True try: # Make sure to get the absolute path of the file - self.repo.git.execute(['git', 'apply', '--check', os.path.abspath(self.patch.path)], with_exceptions=True) + self.repo.git.execute(['git', '-C', self.repodir, 'apply', '--check', os.path.abspath(self.patch.path)], with_exceptions=True) except git.exc.GitCommandError as ce: self._patchcanbemerged = False @@ -76,7 +76,7 @@ class PatchTestRepo(object): def merge(self): if self._patchcanbemerged: - self.repo.git.execute(['git', 'am', '--keep-cr', os.path.abspath(self.patch.path)]) + self.repo.git.execute(['git', '-C', self.repodir, 'am', '--keep-cr', os.path.abspath(self.patch.path)]) self._patchmerged = True def clean(self):
Patchtest tries to apply the received patch on the repository, without specifying the directory, which means that the CWD is used. In case the patch modifies a content in a different folder (e.g. the script is running in ./meta, but the patch modifies ./meta-selftest), the patch will be skipped, but git still returns 0, instead of complaining. To avoid such false positives, specify the working directory for applying the patch - the top of the repodir. Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com> --- meta/lib/patchtest/repo.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)