* Benoît Knecht <[email protected]> [Mon Oct 25, 2010 at 07:05:20PM +0200]:
> Guido Günther wrote:
> > On Mon, Oct 25, 2010 at 03:12:15PM +0200, Benoît Knecht wrote:

> > > Instead of just looking for the existence of the .git directory in the
> > > current directory, use 'git rev-parse --show-cdup' to figure out where
> > > the root of the git repository is relatively to the current directory
> > > (and raise an error if we're actually not in a git repository).
> > > ---

> > > Is this what you had in mind? I didn't use '--is-bare-repository' as I'm
> > > not sure what should be done depending on the result.

> > > This works for me when I run git-buildpackage from within any directory
> > > of a git repository, but maybe there are other cases I didn't consider.

> > That's exactly the hard part. Finding the root of the repo is easy,
> > getting all the commands to work relative to this dir requires more work
> > - and we want consistent behaviour across all gbp commands of course.

> I'm not sure I see what you mean. The previous behavior was:
>     1. Look for .git in the current directory;
>     2. Abort if not found.
> Now we do:
>     1. Find out where .git is;
>     2. Go there;
>     3. Proceed.
> So it shouldn't break anything that wasn't already broken (it just
> automates the previous behavior of Fail -> Manually move to the root ->
> Try again).

> Or am I really missing something else here (maybe you've an example of a
> command that would now fail where it wouldn't have before)?

I'd just like to add, that I have a use case where I'd like to build
starting from the current directory, even though the .git directory
is in an upper directory. Currently I've to 'mkdir .git ;
git-buildpackage .... ; rmdir .git' to get git-buildpackage working
with the tree in $CWD which isn't the root of the repo.

Maybe the:

    try:
        repo = GitRepository(os.path.curdir)

in git-buildpackage could just be ignored if using an option like
--git-ignore-currentdir as an initial step towards the feature we're
discussing here? Guido, what do you think about that?

regards,
-mika-

Attachment: signature.asc
Description: Digital signature

Reply via email to