[PATCH 10/20] add_tag: Run the tag command in the right directory

Mathieu Bridon bochecha at fedoraproject.org
Wed Oct 29 12:57:08 UTC 2014


We were running `git tag` in the current directory.

This doesn't cause any problem when we run the tool in the git directory
we want to tag, which is the most common case.

However, when using the API (for example in the unit tests), the current
directory might not be the git clone, we might really be anywhere.

As such, the `git tag` command would just fail.

Worse, when running the tests, we would add tags to the clone of
upstream rpkg!
---
 src/pyrpkg/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/pyrpkg/__init__.py b/src/pyrpkg/__init__.py
index 660d327..ed40654 100644
--- a/src/pyrpkg/__init__.py
+++ b/src/pyrpkg/__init__.py
@@ -1016,7 +1016,7 @@ class Commands(object):
             cmd.extend(['-F', os.path.abspath(file)])
         cmd.append(tagname)
         # make it so
-        self._run_command(cmd)
+        self._run_command(cmd, cwd=self.path)
         self.log.info('Tag \'%s\' was created' % tagname)
 
     def clean(self, dry=False, useignore=True):
-- 
2.1.0



More information about the rel-eng mailing list