package: git-buildpackage
version: 0.9.8

We have a git repo that contains debian packaging under
packaging/<distro>-<release> and we use a "debian" symlink to the
right packaging subdir that is part of the git tree. 

When trying to use `gbp buildpackage` to build such a git repo it will
fail because it uses "git show HEAD:debian/changelog" which does not
understand symlinks and errors. It would be great if building such a
tree would work :)

One possible fix is to use:

   git cat-file --follow-symlinks --batch

and pipe the wanted thing in (and cut the header). I attached a
(trivial) patch that does exactly this. It makes my repo build but I
did not test further than that. Please let me know if this looks
reasonable, if so I'm happy to adjust the patch further as needed.

Thanks for your consideration!

Cheers,
 Michael
diff -Nru git-buildpackage-0.9.8/gbp/git/repository.py git-buildpackage-0.9.8.1/gbp/git/repository.py
--- git-buildpackage-0.9.8/gbp/git/repository.py	2018-03-16 13:00:14.000000000 +0100
+++ git-buildpackage-0.9.8.1/gbp/git/repository.py	2018-04-04 11:45:10.000000000 +0200
@@ -1639,11 +1639,11 @@
 
         @rtype: C{bytestr}
         """
-        obj, stderr, ret = self._git_inout('show', ["--pretty=medium", id],
-                                           capture_stderr=True)
+        obj, stderr, ret = self._git_inout("cat-file", ["--follow-symlinks", "--batch="], input=id.encode("utf-8"), capture_stderr=True)
         if ret:
             raise GitRepositoryError("can't get %s: %s" % (id, stderr.decode().rstrip()))
-        return obj
+        # skip the first line, it contains a <sha1> <type> <size> header
+        return obj[1:]
 
     def grep_log(self, regex, since=None):
         """

Reply via email to