Skip Menu |

This queue is for tickets about the Git-Repository CPAN distribution.

Report information
The Basics
Id: 106454
Status: open
Priority: 0/
Queue: Git-Repository

People
Owner: Nobody in particular
Requestors: mseplowitz [...] bloomberg.net
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



CC: druoso [...] bloomberg.net
Subject: Use rev-parse --show-toplevel when computing work_tree
Date: Fri, 14 Aug 2015 14:18:56 -0000
To: bug-Git-Repository [...] rt.cpan.org
From: "Mike Seplowitz (BLOOMBERG/ 731 LEX)" <mseplowitz [...] bloomberg.net>
While using some git workareas in an unorthodox configuration, we encountered a problem in using Git::Repository. https://metacpan.org/source/BOOK/Git-Repository-1.315/lib/Git/Repository.pm line 124: # in a non-bare repository, the work tree is just above the gitdir if ( $self->run(qw( config --bool core.bare )) ne 'true' ) { $self->{work_tree} = _abs_path( File::Spec->updir, $self->{git_dir} ); } The assumption that the work tree is directly above the gitdir doesn't hold true in our case. We're using git repos that have the setting core.worktree = ../.. in the repo's config. We propose that using 'git rev-parse --show-toplevel' to compute the work tree would be more reliable: $self->{work_tree} = Git::Repository->run( qw( rev-parse --show-toplevel ), { %$options, cwd => $cwd } ); Thanks for your consideration.
On Fri Aug 14 10:19:06 2015, mseplowitz@bloomberg.net wrote: Show quoted text
> While using some git workareas in an unorthodox configuration, we > encountered a problem in using Git::Repository.
Thanks for reporting this. Show quoted text
> The assumption that the work tree is directly above the gitdir doesn't > hold true in our case. We're using git repos that have the setting > core.worktree = ../.. in the repo's config.
That assumption is actually wrong in many cases, for example if the GIT_WORK_TREE environment variable is set. I'll try to figure out a test for those cases. Show quoted text
> We propose that using 'git rev-parse --show-toplevel' to compute the > work tree would be more reliable:
Agreed. Since the option only appeared in git 1.6.6.2, so I'm going to have to use it depending on the version of git. Regards, -- BooK
On Sat Aug 15 17:21:41 2015, BOOK wrote: Show quoted text
> > Since the option only appeared in git 1.6.6.2, so I'm going > to have to use it depending on the version of git. >
It turns out the patch was in fact merged in git 1.7.0-rc0. -- BooK