Re: [PATCH rdma-core] cbuild: Make cbuild work with git worktrees

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 28, 2018 at 11:37:30AM -0600, Jason Gunthorpe wrote:
> On Wed, Mar 28, 2018 at 07:38:10AM +0300, Leon Romanovsky wrote:
> > On Tue, Mar 27, 2018 at 03:33:39PM -0600, Jason Gunthorpe wrote:
> > > 'rev-parse --git-dir' does not do something useful when using worktrees.
> > > Instead use cdup which prints enough ../'s to get to the top of the tree.
> > >
> > > Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxxxx>
> > >  buildlib/cbuild | 6 +++---
> > >  1 file changed, 3 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/buildlib/cbuild b/buildlib/cbuild
> > > index 6b6c5878bbd592..e1aecbaa0fdef5 100755
> > > +++ b/buildlib/cbuild
> > > @@ -872,8 +872,8 @@ if __name__ == '__main__':
> > >
> > >      # This script must always run from the top of the git tree, and a git
> > >      # checkout is mandatory.
> > > -    git_top = subprocess.check_output(["git","rev-parse","--git-dir"]).strip();
> > > -    if git_top != ".git":
> > > -        os.chdir(os.path.dirname(git_top));
> > > +    cdup = subprocess.check_output(["git","rev-parse","--show-cdup"]).strip();
> >
> > "--show-toplevel" is designed for this.
>
> Okay, it looks like it is available in the older gits too
>
> > > +    if cdup:
> > > +        os.chdir(cdup);
> >
> > and what will be if cdup is NULL?
>
> empty string means cwd == top level

Ahhh, so please use --show-toplevel, it will always return string.

>
> Jason
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux