[git-buildpackage] gbp and git-worktrees
Nish Aravamudan
nish.aravamudan at canonical.com
Thu Jan 11 22:24:07 CET 2018
Hi Guido,
Sorry for all the noise lately! Have another question for you:
In git-ubuntu, we are starting to heavily use git-worktrees, so that
we can have temporary locations that checkout different
commits/trees/etc than HEAD. This is very useful for us, e.g., when
linting arbitrary commits without having to worry about restoring
state in the cwd. In a recent change I am testing, we made it so that
some of our gbp call paths also occur from a worktree.
However, it seems like gbp (at least gbp-buildpackage) does not like
that too much :)
After doing some hacking on the snap's _check_repo, I see this:
...
01/11/2018 13:15:11 - DEBUG:Executing: gbp buildpackage
--git-builder=/bin/true --git-pristine-tar --git-ignore-branch
'--git-upstream-tag=pkg/upstream/ubuntu/%(version)s.bz2'
01/11/2018 13:15:11 - ERROR:Command exited 1: gbp buildpackage
--git-builder=/bin/true --git-pristine-tar --git-ignore-branch
'--git-upstream-tag=pkg/upstream/ubuntu/%(version)s.bz2'
01/11/2018 13:15:11 - ERROR:stdout: path = .
abspath = /tmp/tmp2qsiies4
toplevel = False
out = b'/home/nacc/tmp/strongswan\n'
dummy = b''
ret = 0
cdup = /home/nacc/tmp/strongswan
path = .
abspath = /tmp/tmp2qsiies4
toplevel = True
out = b'/home/nacc/tmp/strongswan\n'
dummy = b''
ret = 0
cdup = /home/nacc/tmp/strongswan
01/11/2018 13:15:11 - ERROR:stderr: gbp:error: /tmp/tmp2qsiies4 is not
a git repository
Traceback (most recent call last):
File "/snap/git-ubuntu/x1/bin/gbp", line 11, in <module>
load_entry_point('gbp==0.9.6', 'console_scripts', 'gbp')()
File "/snap/git-ubuntu/x1/lib/python3.6/site-packages/gbp/scripts/supercommand.py",
line 145, in supercommand
return module.main(args)
File "/snap/git-ubuntu/x1/lib/python3.6/site-packages/gbp/scripts/buildpackage.py",
line 478, in main
repo = DebianGitRepository(os.path.curdir)
File "/snap/git-ubuntu/x1/lib/python3.6/site-packages/gbp/deb/git.py",
line 41, in __init__
super(DebianGitRepository, self).__init__(*args, **kwargs)
File "/snap/git-ubuntu/x1/lib/python3.6/site-packages/gbp/pkg/git.py",
line 36, in __init__
super(PkgGitRepository, self).__init__(*args, **kwargs)
File "/snap/git-ubuntu/x1/lib/python3.6/site-packages/gbp/git/repository.py",
line 136, in __init__
self._path = self._check_repo(path, toplevel)
File "/snap/git-ubuntu/x1/lib/python3.6/site-packages/gbp/git/repository.py",
line 119, in _check_repo
raise GitRepositoryError("Not the toplevel of a Git repository
at '%s': '%s'" % (path, cdup))
gbp.git.repository.GitRepositoryError: Not the toplevel of a Git
repository at '.': '/home/nacc/tmp/strongswan'
Which seems to me, that it's making what was a sensible error before
worktrees were introduced, if I understand the code correctly. If we
are intending to be invoked from the top level of a Git repository and
cdup is non-empty, then we must not be at the top level of a Git
repository? Except in the case of worktrees, I think, where we might
be in a different directory than the Git directory -- but still have
access to the samee
Does it make sense to perhaps change the condition in _check_repo that
if the cdup is not an absolute path (starting with '/'?) that then the
error condition is still true.
Thanks,
Nish
More information about the git-buildpackage
mailing list