[PATCH] new-workdir: handle rev-parse --git-dir not always giving full path
- From
Julian Phillips <julian@quantumfyre.co.uk>
- Date
- Jun 19, 2007, 11:44 UTC
- Message-ID
- <20070619114456.10962.31845.julian@quantumfyre.co.uk>
rev-parse --git-dir outputs a full path - except for the single case of when the path would be $(pwd)/.git, in which case it outputs simply .git. Check for this special case and handle it.
Signed-off-by: Julian Phillips <julian@quantumfyre.co.uk> ---
I tried to use new-workdir yesterday for the first time in a while, and found that it worked provided I gave a path inside the base repo, but not the path of the repo itself.
Turns out to be an oddity in rev-parse --git-dir output. Since the rev-parse code explicitly does something different, I assume there is a reason for it.
contrib/workdir/git-new-workdir | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/contrib/workdir/git-new-workdir b/contrib/workdir/git-new-workdir index f2a3615..709b2a3 100755 --- a/contrib/workdir/git-new-workdir +++ b/contrib/workdir/git-new-workdir @@ -24,6 +24,11 @@ git_dir=$(cd "$orig_git" 2>/dev/null && git rev-parse --git-dir 2>/dev/null) || die "\"$orig_git\" is not a git repository!" +if test "$git_dir" == ".git" +then + git_dir="$orig_git/.git" +fi + # don't link to a workdir if test -L "$git_dir/config" then
-- 1.5.2.2