git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git-sh-setup.sh:cd_to_toplevel problematic with symlinks
@ 2007-08-06 16:10 Matthias Lederhofer
       [not found] ` <20070806211238.GA27363@informatik.uni-freiburg.de>
  0 siblings, 1 reply; 3+ messages in thread
From: Matthias Lederhofer @ 2007-08-06 16:10 UTC (permalink / raw)
  To: git

cd_to_toplevel takes the output of git rev-parse --show-cdup and feeds
it to cd.  The problem is that cd uses PWD to do what the user means
when saying cd .., i.e. it goes to /foo when in /foo/bar even though
/foo/bar might be a symlink.  Example:

    (in an existing git repository)
    /tmp/foo$ mkdir -p a/b
    /tmp/foo$ ln -s a/b c
    /tmp/foo$ cd c
    /tmp/foo/c$ git fetch . master:master
    git-fetch: line 108: /FETCH_HEAD: Permission denied

Is there any way to tell cd to ignore $PWD?

Another option is to have a new option to rev-parse which shows the
absolute path to tho toplevel.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: git-sh-setup.sh:cd_to_toplevel problematic with symlinks
       [not found] ` <20070806211238.GA27363@informatik.uni-freiburg.de>
@ 2007-08-07 10:11   ` Matthias Lederhofer
  2007-08-07 12:45     ` Uwe Kleine-König
  0 siblings, 1 reply; 3+ messages in thread
From: Matthias Lederhofer @ 2007-08-07 10:11 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: git

Your mail did not make it to the list, therefore I quote the full
mail.

Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de> wrote:
> Matthias Lederhofer wrote:
> > cd_to_toplevel takes the output of git rev-parse --show-cdup and feeds
> > it to cd.  The problem is that cd uses PWD to do what the user means
> > when saying cd .., i.e. it goes to /foo when in /foo/bar even though
> > /foo/bar might be a symlink.  Example:
> > 
> >     (in an existing git repository)
> >     /tmp/foo$ mkdir -p a/b
> >     /tmp/foo$ ln -s a/b c
> >     /tmp/foo$ cd c
> >     /tmp/foo/c$ git fetch . master:master
> >     git-fetch: line 108: /FETCH_HEAD: Permission denied
> > 
> > Is there any way to tell cd to ignore $PWD?
> cd -P ... does the trick.  IIRC it's in SUSv3, but once more, Solaris
> /bin/sh doesn't know about that option:
> 
> 	login@~ > uname -a
> 	SunOS login 5.10 Generic_125100-10 sun4u sparc
> 
> 	login@~ > /bin/sh
> 
> 	$ mkdir /tmp/foo; cd /tmp/foo
> 
> 	$ git init
> 	Initialized empty Git repository in .git/
> 
> 	$ mkdir -p a/b; ln -s a/b c; cd c
> 
> 	$ git rev-parse --show-cdup
> 	../../
> 
> 	$ cd -P ../../
> 	-P: does not exist

Do we care about that shell?  There was another thread about shell
script cleanup where the default sun /bin/sh doesn't support some
other features from the git shell scripts too.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: git-sh-setup.sh:cd_to_toplevel problematic with symlinks
  2007-08-07 10:11   ` Matthias Lederhofer
@ 2007-08-07 12:45     ` Uwe Kleine-König
  0 siblings, 0 replies; 3+ messages in thread
From: Uwe Kleine-König @ 2007-08-07 12:45 UTC (permalink / raw)
  To: Matthias Lederhofer; +Cc: git

Hello Matthias,

Matthias Lederhofer wrote:
> Your mail did not make it to the list, therefore I quote the full
> mail.
Ops, thanks.

> Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de> wrote:
> > > Is there any way to tell cd to ignore $PWD?
> > cd -P ... does the trick.  IIRC it's in SUSv3, but once more, Solaris
> > /bin/sh doesn't know about that option:
> > 
[...]
> 
> Do we care about that shell?  There was another thread about shell
> script cleanup where the default sun /bin/sh doesn't support some
> other features from the git shell scripts too.
Ah, I see, Makefile defines SHELL_PATH for SunOS to /bin/bash anyhow.

OK, then maybe just use it and if it breaks for someone we will notice
it ...

Best regards
Uwe

-- 
Uwe Kleine-König

http://www.google.com/search?q=12+mol+in+dozen

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-08-07 12:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-06 16:10 git-sh-setup.sh:cd_to_toplevel problematic with symlinks Matthias Lederhofer
     [not found] ` <20070806211238.GA27363@informatik.uni-freiburg.de>
2007-08-07 10:11   ` Matthias Lederhofer
2007-08-07 12:45     ` Uwe Kleine-König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).