From: "Shawn O. Pearce" <spearce@spearce.org>
To: David Kastrup <dak@gnu.org>
Cc: git@vger.kernel.org
Subject: Re: Problem with git-gui and relative directories
Date: Sat, 25 Aug 2007 04:15:25 -0400 [thread overview]
Message-ID: <20070825081525.GB18160@spearce.org> (raw)
In-Reply-To: <85veb4dqhv.fsf@lola.goethe.zz>
David Kastrup <dak@gnu.org> wrote:
> "Shawn O. Pearce" <spearce@spearce.org> writes:
> > +if {$_prefix ne {}} {
> > + regsub -all {[^/]+/} $_prefix ../ cdup
>
> I don't like this approach. It assumes too much about the file system
> and cleanliness of paths. It does all of the following:
>
> /somedir/ -> /../
> /somedir -> /somedir
> //server/somedir -> //../somedir
> /somedir//someother -> /..//someother
OK, well, uh. Go read the manpage for `git-rev-parse` and focus
in particular on the `--show-prefix` option of that command.
Its output is what we are using here. Its very well defined within
Git, and should have the same definition on all operating systems,
including MinGW.
And if the MinGW folks did something funny its only a translation
of / to \, in which case its easy enough for git-gui to make that
decision on its own based on what type of git it is running on.
> and so on. It can't deal with directory symlinks properly.
Depends on your definition of properly. Here git-gui does exactly
what the C programs in core Git do, which is counter to what the
shell scripts do. And people prefer the C behavior of going up
through the real parents, ignoring the symlinks that were used to
get to the directory the user started git-gui within.
> And the
> approach does not scale to Windows and other systems with diverging
> path syntaxes at all.
Yes, it does. Because the format of --show-prefix is defined.
> Isn't it possible to move to the workdir root for the purpose of
> interpreting workdir root relative filenames?
Because I have always disagreed with the GIT_WORK_TREE mess.
I think its insane to say "I'm here in A, my repository is over
there in B and my files are here in C... now go run status!".
But apparently its a use case.
I guess I could use `git rev-parse --show-cdup` and that would just
handle this case. But that's YAFAE (Yet Another Fork And Exec).
--
Shawn.
prev parent reply other threads:[~2007-08-25 8:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-24 13:40 Problem with git-gui and relative directories David Kastrup
2007-08-25 3:18 ` Shawn O. Pearce
2007-08-25 7:26 ` David Kastrup
2007-08-25 8:15 ` Shawn O. Pearce [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070825081525.GB18160@spearce.org \
--to=spearce@spearce.org \
--cc=dak@gnu.org \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).