From: Andreas Ericsson <ae@op5.se>
To: "Marcel M. Cary" <marcel@oak.homeunix.org>
Cc: Jakub Narebski <jnareb@gmail.com>,
gitster@pobox.com, git@vger.kernel.org
Subject: Re: [PATCH] rev-parse: Fix shell scripts whose cwd is a symlink into a git work-dir
Date: Tue, 25 Nov 2008 07:50:12 +0100 [thread overview]
Message-ID: <492BA024.7080506@op5.se> (raw)
In-Reply-To: <492B9321.8090706@oak.homeunix.org>
Marcel M. Cary wrote:
>> AFAIR, it was introduced to make test-builds of really large projects in
>> really deep directories with a ton of symlinks leading to the path work a
>> lot faster.
>
> Andreas,
>
> I see value in keeping Git very fast. That is, after all, why I chose
> Git over Mercurial. Do you know where that discussion was, if was in
> the archives? I found these reasons to avoid absolute paths in the git
> archives:
>
> * paths with more components are slower to work with (in the context of
> add and diff, which deal with many many paths)
> * absolute paths may exceed PATH_MAX while relative ones didn't
> * getcwd() will fail if parent directories are not executable, or on
> some platforms, if parent directories are not readable
>
> My impression is that the performance issue is probably not significant
> for cd_to_toplevel since it's not in a tight inner loop, and dito for
> other potential callers of --show-cdup. The PATH_MAX seems to be a
> restriction elsewhere in the code already.
>
The performance issue does not come from cd_to_toplevel itself, but from
its callers. That is, if scripts start to use absolute paths from *other*
tight loops, that's when we hit a problem.
> Even if there were a scenario that put --show-cdup in a tight loop, I
> wonder whether current implementation provides much performance benefit,
> at least when bash is the calling language: bash seems to make the
> relative path absolute anyway inside the "cd" builtin.
>
> The commit (5f94c730) that introduces that code doesn't mention
> performance. It compares to:
>
> git rev-parse --show-prefix | sed -e 's|[^/][^/]*|..|g'
>
>
> I also noticed that this failure case with "--show-cdup" in a symlinked
> directory has come up more than once before.
> http://marc.info/?l=git&m=122452534912000&w=2
> http://marc.info/?l=git&m=121613416212958&w=2
> https://kerneltrap.org/mailarchive/git/2007/4/25/244653/thread
>
I can imagine. However, --show-cdup has a different use too. It's nifty
for printing relative paths from commands running inside a subdirectory
of the repository. If you need the absolute path to the root of the repo,
I'd suggest you add "--show-absolute-path" instead.
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
next prev parent reply other threads:[~2008-11-25 6:51 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-15 15:11 [RFC PATCH 0/2] fixing git pull from symlinked directory Marcel M. Cary
2008-11-15 15:11 ` [RFC PATCH 1/2] Add failing test for "git pull" in " Marcel M. Cary
2008-11-15 15:11 ` [RFC PATCH 2/2] Support shell scripts that run from symlinks into a git working dir Marcel M. Cary
2008-11-22 21:33 ` [PATCH] rev-parse: Fix shell scripts whose cwd is a symlink into a git work-dir Marcel M. Cary
2008-11-22 21:54 ` Jakub Narebski
2008-11-23 7:10 ` Andreas Ericsson
2008-11-25 5:54 ` Marcel M. Cary
2008-11-25 6:50 ` Andreas Ericsson [this message]
2008-11-25 5:17 ` Marcel M. Cary
2008-11-25 7:30 ` Johannes Sixt
2008-11-25 16:16 ` Marcel M. Cary
2008-11-25 16:30 ` Johannes Sixt
2008-11-25 18:17 ` Junio C Hamano
2008-12-03 5:27 ` [PATCH] git-sh-setup: Fix scripts whose PWD " Marcel M. Cary
2008-12-03 7:20 ` Junio C Hamano
2008-12-10 15:04 ` [PATCH v2] " Marcel M. Cary
2008-12-10 20:18 ` Junio C Hamano
2008-12-13 20:47 ` [PATCH v3] " Marcel M. Cary
2008-12-14 3:54 ` Junio C Hamano
2008-12-15 17:34 ` Marcel M. Cary
2008-12-15 17:38 ` [PATCH v3] <-- really v4 Marcel M. Cary
2009-02-07 3:24 ` [RFC PATCH] git-sh-setup: Use "cd" option, not /bin/pwd, for symlinked work tree Marcel M. Cary
2009-02-07 12:25 ` Johannes Schindelin
2009-02-08 18:11 ` Marcel M. Cary
2009-02-08 20:56 ` Johannes Schindelin
2009-02-11 14:44 ` Marcel M. Cary
2009-02-11 18:16 ` Jeff King
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=492BA024.7080506@op5.se \
--to=ae@op5.se \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jnareb@gmail.com \
--cc=marcel@oak.homeunix.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.