'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 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) Leon's version with --show-toplevel diff --git a/buildlib/cbuild b/buildlib/cbuild index 6b6c5878bbd592..9fed01510b570d 100755 --- a/buildlib/cbuild +++ b/buildlib/cbuild @@ -872,8 +872,7 @@ 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)); + git_top = subprocess.check_output(["git","rev-parse","--show-toplevel"]).strip(); + os.chdir(git_top); args.func(args); -- 2.16.2 -- 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