[PATCH] new-workdir: handle rev-parse --git-dir not always giving full path

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

 



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@xxxxxxxxxxxxxxxxx>
---

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

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

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux