* quick bare clones taking longer?
@ 2007-05-09 9:09 David Miller
2007-05-09 11:09 ` Johannes Schindelin
2007-05-09 15:41 ` Junio C Hamano
0 siblings, 2 replies; 24+ messages in thread
From: David Miller @ 2007-05-09 9:09 UTC (permalink / raw)
To: git
master.kernel.org just upgraded to git-1.5.1.4 and I notice
that doing something like this:
git clone --bare -n -l -s ../torvalds/linux-2.6.git test-2.6.git
is no longer an instantaneous operation, it seems to be doing a lot
of stuff now:
Initialized empty Git repository in /home/davem/git/test-2.6.git/
remote: Generating pack...
remote: Done counting 480025 objects.
remote: Deltifying 480025 objects.
remote: 100% (480025/480025) done
Indexing 480025 objects.
remote: Total 480025 (delta 385878), reused 473265 (delta 379369)
100% (480025/480025) done
Resolving 385878 deltas.
100% (385878/385878) done
Is there a new way to get a quick clone?
Thanks!
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: quick bare clones taking longer?
2007-05-09 9:09 quick bare clones taking longer? David Miller
@ 2007-05-09 11:09 ` Johannes Schindelin
2007-05-09 15:41 ` Junio C Hamano
1 sibling, 0 replies; 24+ messages in thread
From: Johannes Schindelin @ 2007-05-09 11:09 UTC (permalink / raw)
To: David Miller; +Cc: git
Hi,
On Wed, 9 May 2007, David Miller wrote:
> master.kernel.org just upgraded to git-1.5.1.4 and I notice
> that doing something like this:
>
> git clone --bare -n -l -s ../torvalds/linux-2.6.git test-2.6.git
>
> is no longer an instantaneous operation, it seems to be doing a lot
> of stuff now:
>
> Initialized empty Git repository in /home/davem/git/test-2.6.git/
> remote: Generating pack...
> remote: Done counting 480025 objects.
> remote: Deltifying 480025 objects.
> remote: 100% (480025/480025) done
> Indexing 480025 objects.
> remote: Total 480025 (delta 385878), reused 473265 (delta 379369)
> 100% (480025/480025) done
> Resolving 385878 deltas.
> 100% (385878/385878) done
>
> Is there a new way to get a quick clone?
I just checked out 1.5.1.4, built it, and cannot reproduce this behaviour.
It's as fast as ever.
Ciao,
Dscho
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: quick bare clones taking longer?
2007-05-09 9:09 quick bare clones taking longer? David Miller
2007-05-09 11:09 ` Johannes Schindelin
@ 2007-05-09 15:41 ` Junio C Hamano
2007-05-09 20:06 ` David Miller
1 sibling, 1 reply; 24+ messages in thread
From: Junio C Hamano @ 2007-05-09 15:41 UTC (permalink / raw)
To: David Miller; +Cc: git
David Miller <davem@davemloft.net> writes:
> master.kernel.org just upgraded to git-1.5.1.4 and I notice
> that doing something like this:
>
> git clone --bare -n -l -s ../torvalds/linux-2.6.git test-2.6.git
>
> is no longer an instantaneous operation, it seems to be doing a lot
> of stuff now:
>
> Initialized empty Git repository in /home/davem/git/test-2.6.git/
> remote: Generating pack...
> remote: Done counting 480025 objects.
> remote: Deltifying 480025 objects.
> remote: 100% (480025/480025) done
> Indexing 480025 objects.
> remote: Total 480025 (delta 385878), reused 473265 (delta 379369)
> 100% (480025/480025) done
> Resolving 385878 deltas.
> 100% (385878/385878) done
>
> Is there a new way to get a quick clone?
There is something very wrong. "-l -s" should never go to the
"remote: Generating pack..." codepath. Is that reproducible?
Could you try "sh -x git-clone" it?
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: quick bare clones taking longer?
2007-05-09 15:41 ` Junio C Hamano
@ 2007-05-09 20:06 ` David Miller
2007-05-09 21:48 ` Junio C Hamano
0 siblings, 1 reply; 24+ messages in thread
From: David Miller @ 2007-05-09 20:06 UTC (permalink / raw)
To: junkio; +Cc: git
From: Junio C Hamano <junkio@cox.net>
Date: Wed, 09 May 2007 08:41:20 -0700
> There is something very wrong. "-l -s" should never go to the
> "remote: Generating pack..." codepath. Is that reproducible?
Every single time on master.kernel.org
> Could you try "sh -x git-clone" it?
Sure:
+ unset CDPATH
+ '[' -n '' ']'
+ quiet=
+ local=no
+ use_local=no
+ local_shared=no
+ unset template
+ no_checkout=
+ upload_pack=
+ bare=
+ reference=
+ origin=
+ origin_override=
+ use_separate_remote=t
+ depth=
+ no_progress=
+ test -t 1
+ case "$#,$1" in
+ bare=yes
+ shift
+ case "$#,$1" in
+ no_checkout=yes
+ shift
+ case "$#,$1" in
+ use_local=yes
+ shift
+ case "$#,$1" in
+ local_shared=yes
+ use_local=yes
+ shift
+ case "$#,$1" in
+ break
+ repo=../torvalds/linux-2.6.git
+ test -n ../torvalds/linux-2.6.git
+ test yes = yes
+ test yes = ''
+ no_checkout=yes
+ use_separate_remote=
+ test -z ''
+ origin=origin
++ get_repo_base ../torvalds/linux-2.6.git
+ base=
+ dir=test-2.6.git
+ '[' -z test-2.6.git ']'
+ '[' -e test-2.6.git ']'
+ mkdir -p test-2.6.git
++ cd test-2.6.git
++ pwd
+ D=/home/davem/git/test-2.6.git
+ trap 'err=$?; cd ..; rm -rf "$D"; exit $err' 0
+ case "$bare" in
+ GIT_DIR=/home/davem/git/test-2.6.git
+ export GIT_DIR
+ git-init
Initialized empty Git repository in /home/davem/git/test-2.6.git/
+ test -n ''
+ rm -f /home/davem/git/test-2.6.git/CLONE_HEAD
+ case "$local,$use_local" in
+ case "$repo" in
+ case "$upload_pack" in
+ git-fetch-pack --all -k ../torvalds/linux-2.6.git
remote: Generating pack...
etc.
Oh, /home/davem/git is a soft symlink to
/pub/scm/linux/kernel/git/davem, maybe that is confusing
git to make it think the repo is not local.
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: quick bare clones taking longer?
2007-05-09 20:06 ` David Miller
@ 2007-05-09 21:48 ` Junio C Hamano
2007-05-09 22:02 ` David Miller
0 siblings, 1 reply; 24+ messages in thread
From: Junio C Hamano @ 2007-05-09 21:48 UTC (permalink / raw)
To: David Miller; +Cc: junkio, git
David Miller <davem@davemloft.net> writes:
> From: Junio C Hamano <junkio@cox.net>
> Date: Wed, 09 May 2007 08:41:20 -0700
>
>> There is something very wrong. "-l -s" should never go to the
>> "remote: Generating pack..." codepath. Is that reproducible?
>
> Every single time on master.kernel.org
>
>> Could you try "sh -x git-clone" it?
>
> Sure:
>
> + unset CDPATH
> + '[' -n '' ']'
> + quiet=
> + local=no
> + use_local=no
> + local_shared=no
> + unset template
> + no_checkout=
> + upload_pack=
> + bare=
> + reference=
> + origin=
> + origin_override=
> + use_separate_remote=t
> + depth=
> + no_progress=
> + test -t 1
> + case "$#,$1" in
> + bare=yes
> + shift
> + case "$#,$1" in
> + no_checkout=yes
> + shift
> + case "$#,$1" in
> + use_local=yes
> + shift
> + case "$#,$1" in
> + local_shared=yes
> + use_local=yes
> + shift
> + case "$#,$1" in
> + break
> + repo=../torvalds/linux-2.6.git
> + test -n ../torvalds/linux-2.6.git
> + test yes = yes
> + test yes = ''
> + no_checkout=yes
> + use_separate_remote=
> + test -z ''
> + origin=origin
> ++ get_repo_base ../torvalds/linux-2.6.git
> + base=
This part puzzles me. The only way I could reproduce this was:
$ ls -F victim victim.git
ls: victim: No such file or directory
victim.git:
./ HEAD config description hooks/ lost-found/ refs/
../ branches/ config~ gitcvs.master.sqlite info/ objects/ remotes/
$ mkdir j
$ cd j
$ git clone --bare -l -s -n ../victim new.git
That is, I did not have ../victim but I did have ../victim.git/
repository, and I gave the former to "git clone".
But that suggests that you do not have ../torvalds/linux-2.6.git
directory but instead have ../torvalds/linux-2.6.git.git/ which
sound a bit insane.
Puzzled...
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: quick bare clones taking longer?
2007-05-09 21:48 ` Junio C Hamano
@ 2007-05-09 22:02 ` David Miller
2007-05-09 22:59 ` Junio C Hamano
0 siblings, 1 reply; 24+ messages in thread
From: David Miller @ 2007-05-09 22:02 UTC (permalink / raw)
To: junkio; +Cc: git
From: Junio C Hamano <junkio@cox.net>
Date: Wed, 09 May 2007 14:48:38 -0700
> > + no_checkout=yes
> > + use_separate_remote=
> > + test -z ''
> > + origin=origin
> > ++ get_repo_base ../torvalds/linux-2.6.git
> > + base=
>
> This part puzzles me. The only way I could reproduce this was:
>
> $ ls -F victim victim.git
> ls: victim: No such file or directory
> victim.git:
> ./ HEAD config description hooks/ lost-found/ refs/
> ../ branches/ config~ gitcvs.master.sqlite info/ objects/ remotes/
> $ mkdir j
> $ cd j
> $ git clone --bare -l -s -n ../victim new.git
>
> That is, I did not have ../victim but I did have ../victim.git/
> repository, and I gave the former to "git clone".
>
> But that suggests that you do not have ../torvalds/linux-2.6.git
> directory but instead have ../torvalds/linux-2.6.git.git/ which
> sound a bit insane.
>
> Puzzled...
This deeply puzzles me too.
I'm just not going to go into my git directory using that
symlink in my home directory any more. :-)
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: quick bare clones taking longer?
2007-05-09 22:02 ` David Miller
@ 2007-05-09 22:59 ` Junio C Hamano
2007-05-09 23:23 ` David Miller
0 siblings, 1 reply; 24+ messages in thread
From: Junio C Hamano @ 2007-05-09 22:59 UTC (permalink / raw)
To: David Miller; +Cc: junkio, git
David Miller <davem@davemloft.net> writes:
> From: Junio C Hamano <junkio@cox.net>
> Date: Wed, 09 May 2007 14:48:38 -0700
>
>> > + no_checkout=yes
>> > + use_separate_remote=
>> > + test -z ''
>> > + origin=origin
>> > ++ get_repo_base ../torvalds/linux-2.6.git
>> > + base=
>>
>> This part puzzles me. The only way I could reproduce this was:
>>
>> $ ls -F victim victim.git
>> ls: victim: No such file or directory
>> victim.git:
>> ./ HEAD config description hooks/ lost-found/ refs/
>> ../ branches/ config~ gitcvs.master.sqlite info/ objects/ remotes/
>> $ mkdir j
>> $ cd j
>> $ git clone --bare -l -s -n ../victim new.git
>>
>> That is, I did not have ../victim but I did have ../victim.git/
>> repository, and I gave the former to "git clone".
>>
>> But that suggests that you do not have ../torvalds/linux-2.6.git
>> directory but instead have ../torvalds/linux-2.6.git.git/ which
>> sound a bit insane.
>>
>> Puzzled...
>
> This deeply puzzles me too.
>
> I'm just not going to go into my git directory using that
> symlink in my home directory any more. :-)
Ahhh, symlink!
get_repo_base does this:
get_repo_base() {
(cd "$1" && (cd .git ; pwd)) 2> /dev/null
}
and is used like this:
# Turn the source into an absolute path if
# it is local
if base=$(get_repo_base "$repo"); then
repo="$base"
local=yes
fi
That is, get_repo_base does:
* first try to cd to ../torvalds/linux-2.6.git; if it fails
then give up.
* then further cd down to .git if we can but do not worry about
it if we can't. Report where we are and succeed.
If the above "fails", the caller considers the cloned-from
repository a non-local one, and turns off -l -s optimization.
The above sequence is called before we create the new directory
and chdir to it. Maybe pwd has funny behaviour (e.g. $PWD) and
we need to explicitly say /bin/pwd or somesuch...
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: quick bare clones taking longer?
2007-05-09 22:59 ` Junio C Hamano
@ 2007-05-09 23:23 ` David Miller
2007-05-09 23:25 ` Junio C Hamano
0 siblings, 1 reply; 24+ messages in thread
From: David Miller @ 2007-05-09 23:23 UTC (permalink / raw)
To: junkio; +Cc: git
From: Junio C Hamano <junkio@cox.net>
Date: Wed, 09 May 2007 15:59:23 -0700
> The above sequence is called before we create the new directory
> and chdir to it. Maybe pwd has funny behaviour (e.g. $PWD) and
> we need to explicitly say /bin/pwd or somesuch...
Indeed:
[davem@hera ~]$ pwd
/home/davem
[davem@hera ~]$ cd git
[davem@hera git]$ pwd
/home/davem/git
[davem@hera git]$ /bin/pwd
/home/ftp/pub/scm/linux/kernel/git/davem
[davem@hera git]$
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: quick bare clones taking longer?
2007-05-09 23:23 ` David Miller
@ 2007-05-09 23:25 ` Junio C Hamano
2007-05-10 0:11 ` Junio C Hamano
0 siblings, 1 reply; 24+ messages in thread
From: Junio C Hamano @ 2007-05-09 23:25 UTC (permalink / raw)
To: David Miller; +Cc: junkio, git
David Miller <davem@davemloft.net> writes:
> From: Junio C Hamano <junkio@cox.net>
> Date: Wed, 09 May 2007 15:59:23 -0700
>
>> The above sequence is called before we create the new directory
>> and chdir to it. Maybe pwd has funny behaviour (e.g. $PWD) and
>> we need to explicitly say /bin/pwd or somesuch...
>
> Indeed:
>
> [davem@hera ~]$ pwd
> /home/davem
> [davem@hera ~]$ cd git
> [davem@hera git]$ pwd
> /home/davem/git
> [davem@hera git]$ /bin/pwd
> /home/ftp/pub/scm/linux/kernel/git/davem
> [davem@hera git]$
Thanks.
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: quick bare clones taking longer?
2007-05-09 23:25 ` Junio C Hamano
@ 2007-05-10 0:11 ` Junio C Hamano
2007-05-10 0:27 ` Junio C Hamano
` (2 more replies)
0 siblings, 3 replies; 24+ messages in thread
From: Junio C Hamano @ 2007-05-10 0:11 UTC (permalink / raw)
To: David Miller; +Cc: junkio, git
Junio C Hamano <junkio@cox.net> writes:
> David Miller <davem@davemloft.net> writes:
>
>> From: Junio C Hamano <junkio@cox.net>
>> Date: Wed, 09 May 2007 15:59:23 -0700
>>
>>> The above sequence is called before we create the new directory
>>> and chdir to it. Maybe pwd has funny behaviour (e.g. $PWD) and
>>> we need to explicitly say /bin/pwd or somesuch...
>>
>> Indeed:
>>
>> [davem@hera ~]$ pwd
>> /home/davem
>> [davem@hera ~]$ cd git
>> [davem@hera git]$ pwd
>> /home/davem/git
>> [davem@hera git]$ /bin/pwd
>> /home/ftp/pub/scm/linux/kernel/git/davem
>> [davem@hera git]$
>
> Thanks.
This would fix it, but I find this kind of ugly.
-- >8 --
git-clone: don't get fooled by $PWD
If you have /home/me/git symlink pointing at /pub/git/mine,
trying to clone from /pub/git/his/ using relative path would not
work as expected:
$ cd /home/me
$ cd git
$ ls ../
his mine
$ git clone -l -s -n ../his/stuff.git
This is because "cd ../his/stuff.git" done inside git-clone to
check if the repository is local is confused by $PWD, which is
set to /home/me, and tries to go to /home/his/stuff.git which is
different from /pub/git/his/stuff.git.
We could probably say "set -P" (or "cd -P") instead, if we know
the shell is POSIX, but the way the patch is coded is probably
more portable.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
diff --git a/git-clone.sh b/git-clone.sh
index cad5c0c..c5852a2 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -18,7 +18,14 @@ usage() {
}
get_repo_base() {
- (cd "$1" && (cd .git ; pwd)) 2> /dev/null
+ (
+ cd "`/bin/pwd`" &&
+ cd "$1" &&
+ (
+ cd .git
+ pwd
+ )
+ ) 2>/dev/null
}
if [ -n "$GIT_SSL_NO_VERIFY" ]; then
^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: quick bare clones taking longer?
2007-05-10 0:11 ` Junio C Hamano
@ 2007-05-10 0:27 ` Junio C Hamano
2007-05-10 0:29 ` David Miller
2007-05-10 8:05 ` Matthieu Moy
2007-05-10 17:04 ` Andy Whitcroft
2 siblings, 1 reply; 24+ messages in thread
From: Junio C Hamano @ 2007-05-10 0:27 UTC (permalink / raw)
To: David Miller; +Cc: junkio, git
Junio C Hamano <junkio@cox.net> writes:
> Junio C Hamano <junkio@cox.net> writes:
>
>> David Miller <davem@davemloft.net> writes:
>>
>>> From: Junio C Hamano <junkio@cox.net>
>>> Date: Wed, 09 May 2007 15:59:23 -0700
>>>
>>>> The above sequence is called before we create the new directory
>>>> and chdir to it. Maybe pwd has funny behaviour (e.g. $PWD) and
>>>> we need to explicitly say /bin/pwd or somesuch...
>>>
>>> Indeed:
>>>
>>> [davem@hera ~]$ pwd
>>> /home/davem
>>> [davem@hera ~]$ cd git
>>> [davem@hera git]$ pwd
>>> /home/davem/git
>>> [davem@hera git]$ /bin/pwd
>>> /home/ftp/pub/scm/linux/kernel/git/davem
>>> [davem@hera git]$
>>
>> Thanks.
>
> This would fix it, but I find this kind of ugly.
Side note. Earlier you said:
master.kernel.org just upgraded to git-1.5.1.4 and I notice
that doing something like this:
git clone --bare -n -l -s ../torvalds/linux-2.6.git test-2.6.git
is no longer an instantaneous operation, it seems to be doing a lot
of stuff now:
But I do not see any difference between v1.5.1.3 and v1.5.1.4 in
this area. In fact, that get_repo_base() shell function has not
changed since v0.99.
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: quick bare clones taking longer?
2007-05-10 0:27 ` Junio C Hamano
@ 2007-05-10 0:29 ` David Miller
0 siblings, 0 replies; 24+ messages in thread
From: David Miller @ 2007-05-10 0:29 UTC (permalink / raw)
To: junkio; +Cc: git
From: Junio C Hamano <junkio@cox.net>
Date: Wed, 09 May 2007 17:27:41 -0700
> Side note. Earlier you said:
>
> master.kernel.org just upgraded to git-1.5.1.4 and I notice
> that doing something like this:
>
> git clone --bare -n -l -s ../torvalds/linux-2.6.git test-2.6.git
>
> is no longer an instantaneous operation, it seems to be doing a lot
> of stuff now:
>
> But I do not see any difference between v1.5.1.3 and v1.5.1.4 in
> this area. In fact, that get_repo_base() shell function has not
> changed since v0.99.
Correct. I happened to create and start using that symlink
around the same time they upgraded, that's why I made that
(false) connection.
There is no connection between git version and this problem, it's just
the symlink thing.
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: quick bare clones taking longer?
2007-05-10 0:11 ` Junio C Hamano
2007-05-10 0:27 ` Junio C Hamano
@ 2007-05-10 8:05 ` Matthieu Moy
2007-05-10 8:25 ` Junio C Hamano
2007-05-10 8:56 ` Johannes Sixt
2007-05-10 17:04 ` Andy Whitcroft
2 siblings, 2 replies; 24+ messages in thread
From: Matthieu Moy @ 2007-05-10 8:05 UTC (permalink / raw)
To: git
Junio C Hamano <junkio@cox.net> writes:
> get_repo_base() {
> - (cd "$1" && (cd .git ; pwd)) 2> /dev/null
> + (
> + cd "`/bin/pwd`" &&
> + cd "$1" &&
> + (
> + cd .git
> + pwd
> + )
> + ) 2>/dev/null
> }
Will this work on windows?
--
Matthieu
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: quick bare clones taking longer?
2007-05-10 8:05 ` Matthieu Moy
@ 2007-05-10 8:25 ` Junio C Hamano
2007-05-10 8:55 ` Matthieu Moy
2007-05-10 8:56 ` Johannes Sixt
1 sibling, 1 reply; 24+ messages in thread
From: Junio C Hamano @ 2007-05-10 8:25 UTC (permalink / raw)
To: Matthieu Moy; +Cc: git
Matthieu Moy <Matthieu.Moy@imag.fr> writes:
> Junio C Hamano <junkio@cox.net> writes:
>
>> get_repo_base() {
>> - (cd "$1" && (cd .git ; pwd)) 2> /dev/null
>> + (
>> + cd "`/bin/pwd`" &&
>> + cd "$1" &&
>> + (
>> + cd .git
>> + pwd
>> + )
>> + ) 2>/dev/null
>> }
>
> Will this work on windows?
Is that a serious question?
If so, my answer is "I do not know, but the update is not any
more complex than the existing code -- both are perfectly fine
POSIX shell". Besides, if there are enough users who care about
Windows, there must be some competent ones among them, and we
will hear from them soon enough with an improvement patch.
If not, welcome to my killfile ;-).
NB. No, the last one is not serious. I do not have a
killfile.
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: quick bare clones taking longer?
2007-05-10 8:25 ` Junio C Hamano
@ 2007-05-10 8:55 ` Matthieu Moy
2007-05-10 15:38 ` Brian Gernhardt
0 siblings, 1 reply; 24+ messages in thread
From: Matthieu Moy @ 2007-05-10 8:55 UTC (permalink / raw)
To: git
Junio C Hamano <junkio@cox.net> writes:
> Is that a serious question?
It is. I have to admit that my knowledge about POSIX kind of things on
windows approaches zero, but a hardcoded /bin/something path sounds
suspicious to me.
Nothing more, nothing less in my question.
--
Matthieu
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: quick bare clones taking longer?
2007-05-10 8:05 ` Matthieu Moy
2007-05-10 8:25 ` Junio C Hamano
@ 2007-05-10 8:56 ` Johannes Sixt
2007-05-10 20:52 ` Dan Nicholson
1 sibling, 1 reply; 24+ messages in thread
From: Johannes Sixt @ 2007-05-10 8:56 UTC (permalink / raw)
To: git
Matthieu Moy wrote:
>
> Junio C Hamano <junkio@cox.net> writes:
>
> > get_repo_base() {
> > - (cd "$1" && (cd .git ; pwd)) 2> /dev/null
> > + (
> > + cd "`/bin/pwd`" &&
> > + cd "$1" &&
> > + (
> > + cd .git
> > + pwd
> > + )
> > + ) 2>/dev/null
> > }
>
> Will this work on windows?
Yes. As does the alternative that uses cd -P. MinGW uses bash (3.1
here).
-- Hannes
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: quick bare clones taking longer?
2007-05-10 8:55 ` Matthieu Moy
@ 2007-05-10 15:38 ` Brian Gernhardt
2007-05-12 15:25 ` Win32 version, was " Johannes Schindelin
0 siblings, 1 reply; 24+ messages in thread
From: Brian Gernhardt @ 2007-05-10 15:38 UTC (permalink / raw)
To: Matthieu Moy; +Cc: Git Mailing List
On May 10, 2007, at 4:55 AM, Matthieu Moy wrote:
> Junio C Hamano <junkio@cox.net> writes:
>
>> Is that a serious question?
>
> It is. I have to admit that my knowledge about POSIX kind of things on
> windows approaches zero, but a hardcoded /bin/something path sounds
> suspicious to me.
I think every POSIX environment provides _something_ for /bin and /
usr/bin. There are too many scripts that start "#!/bin/bash" or "#!/
usr/bin/env interpreter" for it not to. And to be POSIX, the basic
utilities (like pwd and env) should be in there. Someday Git may
work on Windows without a funny (for MS) environment. But that day
is not today. Tomorrow doesn't look too good either. ;-)
~~ Brian
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: quick bare clones taking longer?
2007-05-10 0:11 ` Junio C Hamano
2007-05-10 0:27 ` Junio C Hamano
2007-05-10 8:05 ` Matthieu Moy
@ 2007-05-10 17:04 ` Andy Whitcroft
2 siblings, 0 replies; 24+ messages in thread
From: Andy Whitcroft @ 2007-05-10 17:04 UTC (permalink / raw)
To: Junio C Hamano; +Cc: David Miller, git
Junio C Hamano wrote:
> Junio C Hamano <junkio@cox.net> writes:
>
>> David Miller <davem@davemloft.net> writes:
>>
>>> From: Junio C Hamano <junkio@cox.net>
>>> Date: Wed, 09 May 2007 15:59:23 -0700
>>>
>>>> The above sequence is called before we create the new directory
>>>> and chdir to it. Maybe pwd has funny behaviour (e.g. $PWD) and
>>>> we need to explicitly say /bin/pwd or somesuch...
>>> Indeed:
>>>
>>> [davem@hera ~]$ pwd
>>> /home/davem
>>> [davem@hera ~]$ cd git
>>> [davem@hera git]$ pwd
>>> /home/davem/git
>>> [davem@hera git]$ /bin/pwd
>>> /home/ftp/pub/scm/linux/kernel/git/davem
>>> [davem@hera git]$
>> Thanks.
>
> This would fix it, but I find this kind of ugly.
>
> -- >8 --
> git-clone: don't get fooled by $PWD
>
> If you have /home/me/git symlink pointing at /pub/git/mine,
> trying to clone from /pub/git/his/ using relative path would not
> work as expected:
>
> $ cd /home/me
> $ cd git
> $ ls ../
> his mine
> $ git clone -l -s -n ../his/stuff.git
>
> This is because "cd ../his/stuff.git" done inside git-clone to
> check if the repository is local is confused by $PWD, which is
> set to /home/me, and tries to go to /home/his/stuff.git which is
> different from /pub/git/his/stuff.git.
>
> We could probably say "set -P" (or "cd -P") instead, if we know
> the shell is POSIX, but the way the patch is coded is probably
> more portable.
>
> Signed-off-by: Junio C Hamano <junkio@cox.net>
> ---
>
> diff --git a/git-clone.sh b/git-clone.sh
> index cad5c0c..c5852a2 100755
> --- a/git-clone.sh
> +++ b/git-clone.sh
> @@ -18,7 +18,14 @@ usage() {
> }
>
> get_repo_base() {
> - (cd "$1" && (cd .git ; pwd)) 2> /dev/null
> + (
> + cd "`/bin/pwd`" &&
> + cd "$1" &&
> + (
> + cd .git
> + pwd
> + )
> + ) 2>/dev/null
> }
>
> if [ -n "$GIT_SSL_NO_VERIFY" ]; then
That is pretty much how I have seen this solved in the past. One thing
while you are playing with this code. There seems to be an extra
sub-shell in there unnecesarily and the error redirection seems a little
aggressive?
This seems to be semantically equivalent:
get_repo_base() {
(
cd "`/bin/pwd`" &&
cd "$1" &&
{
cd .git 2>/dev/null
pwd
}
)
}
-apw
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: quick bare clones taking longer?
2007-05-10 8:56 ` Johannes Sixt
@ 2007-05-10 20:52 ` Dan Nicholson
2007-05-10 21:55 ` Junio C Hamano
0 siblings, 1 reply; 24+ messages in thread
From: Dan Nicholson @ 2007-05-10 20:52 UTC (permalink / raw)
To: git
Johannes Sixt <J.Sixt <at> eudaptics.com> writes:
>
> Matthieu Moy wrote:
> >
> > Junio C Hamano <junkio <at> cox.net> writes:
> >
> > > get_repo_base() {
> > > - (cd "$1" && (cd .git ; pwd)) 2> /dev/null
> > > + (
> > > + cd "`/bin/pwd`" &&
> > > + cd "$1" &&
> > > + (
> > > + cd .git
> > > + pwd
> > > + )
> > > + ) 2>/dev/null
> > > }
> >
> > Will this work on windows?
>
> Yes. As does the alternative that uses cd -P. MinGW uses bash (3.1
> here).
In fact, all POSIX shells should support `cd -P' according to the spec, so it
should probably just be used directly instead of hoping that /bin/pwd exists.
(cd -P "$1" && (cd .git ; pwd)) 2>/dev/null
http://www.opengroup.org/onlinepubs/009695399/utilities/cd.html
--
Dan
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: quick bare clones taking longer?
2007-05-10 20:52 ` Dan Nicholson
@ 2007-05-10 21:55 ` Junio C Hamano
2007-05-10 22:08 ` Dan Nicholson
0 siblings, 1 reply; 24+ messages in thread
From: Junio C Hamano @ 2007-05-10 21:55 UTC (permalink / raw)
To: Dan Nicholson; +Cc: git
Dan Nicholson <dbn.lists@gmail.com> writes:
> In fact, all POSIX shells should support `cd -P' according to the spec, so it
> should probably just be used directly instead of hoping that /bin/pwd exists.
>
> (cd -P "$1" && (cd .git ; pwd)) 2>/dev/null
>
> http://www.opengroup.org/onlinepubs/009695399/utilities/cd.html
Yes but no ;-). I've said this a few times on the list in the
past, but I'll repeat it again for new people.
We reject something whose portability in question by saying
"It's not _even in_ POSIX". We on the other hand try to refrain
from saying "POSIX says you are supposed to have it, so screw
people that are not fully POSIX".
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: quick bare clones taking longer?
2007-05-10 21:55 ` Junio C Hamano
@ 2007-05-10 22:08 ` Dan Nicholson
2007-05-10 23:22 ` Junio C Hamano
0 siblings, 1 reply; 24+ messages in thread
From: Dan Nicholson @ 2007-05-10 22:08 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On 5/10/07, Junio C Hamano <junkio@cox.net> wrote:
> Dan Nicholson <dbn.lists@gmail.com> writes:
>
> > In fact, all POSIX shells should support `cd -P' according to the spec, so it
> > should probably just be used directly instead of hoping that /bin/pwd exists.
> >
> > (cd -P "$1" && (cd .git ; pwd)) 2>/dev/null
> >
> > http://www.opengroup.org/onlinepubs/009695399/utilities/cd.html
>
> Yes but no ;-). I've said this a few times on the list in the
> past, but I'll repeat it again for new people.
>
> We reject something whose portability in question by saying
> "It's not _even in_ POSIX". We on the other hand try to refrain
> from saying "POSIX says you are supposed to have it, so screw
> people that are not fully POSIX".
Yes, I suppose. At the same time, git already implicitly requires more
than, say, a Bourne shell. Functions, $( ) command substitution, ${}
parameter expansion, $(( )) arithmetic expansion, etc. These are all
standard in a POSIX shell, but may or may not exist in other shell
variants.
--
Dan
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: quick bare clones taking longer?
2007-05-10 22:08 ` Dan Nicholson
@ 2007-05-10 23:22 ` Junio C Hamano
0 siblings, 0 replies; 24+ messages in thread
From: Junio C Hamano @ 2007-05-10 23:22 UTC (permalink / raw)
To: Dan Nicholson; +Cc: Junio C Hamano, git
"Dan Nicholson" <dbn.lists@gmail.com> writes:
> On 5/10/07, Junio C Hamano <junkio@cox.net> wrote:
> ...
>> We reject something whose portability is in question by saying
>> "It's not _even in_ POSIX". We on the other hand try to refrain
>> from saying "POSIX says you are supposed to have it, so screw
>> people that are not fully POSIX".
>
> Yes, I suppose. At the same time, git already implicitly requires more
> than, say, a Bourne shell.
Yes, and the line is fuzzy and case by case. I am playing it
safe as we are in pre-release freeze, also I condider /bin/pwd
much more universally available than "cd -P".
^ permalink raw reply [flat|nested] 24+ messages in thread
* Win32 version, was Re: quick bare clones taking longer?
2007-05-10 15:38 ` Brian Gernhardt
@ 2007-05-12 15:25 ` Johannes Schindelin
2007-05-12 15:48 ` Brian Gernhardt
0 siblings, 1 reply; 24+ messages in thread
From: Johannes Schindelin @ 2007-05-12 15:25 UTC (permalink / raw)
To: Brian Gernhardt; +Cc: Git Mailing List
Hi,
On Thu, 10 May 2007, Brian Gernhardt wrote:
> Someday Git may work on Windows without a funny (for MS) environment.
> But that day is not today. Tomorrow doesn't look too good either. ;-)
It sure sounds like you would like that day rather sooner than later. In
related news, that day will be sooner rather than later, if people who
actually care deeply about this _do_ something about it.
Hth,
Dscho
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: Win32 version, was Re: quick bare clones taking longer?
2007-05-12 15:25 ` Win32 version, was " Johannes Schindelin
@ 2007-05-12 15:48 ` Brian Gernhardt
0 siblings, 0 replies; 24+ messages in thread
From: Brian Gernhardt @ 2007-05-12 15:48 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Git Mailing List
On May 12, 2007, at 11:25 AM, Johannes Schindelin wrote:
> On Thu, 10 May 2007, Brian Gernhardt wrote:
>
>> Someday Git may work on Windows without a funny (for MS) environment.
>> But that day is not today. Tomorrow doesn't look too good
>> either. ;-)
>
> It sure sounds like you would like that day rather sooner than
> later. In
> related news, that day will be sooner rather than later, if people who
> actually care deeply about this _do_ something about it.
Actually, at the moment, my only Windows environment is inside a VM
box on my Mac. So as long as it works on my Mac, I don't care how
long it takes. And I have neither the time nor build environment to
try to fix it. If that changes, I'll produce patches like a good
code monkey.
~~ Brian
^ permalink raw reply [flat|nested] 24+ messages in thread
end of thread, other threads:[~2007-05-12 15:49 UTC | newest]
Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-09 9:09 quick bare clones taking longer? David Miller
2007-05-09 11:09 ` Johannes Schindelin
2007-05-09 15:41 ` Junio C Hamano
2007-05-09 20:06 ` David Miller
2007-05-09 21:48 ` Junio C Hamano
2007-05-09 22:02 ` David Miller
2007-05-09 22:59 ` Junio C Hamano
2007-05-09 23:23 ` David Miller
2007-05-09 23:25 ` Junio C Hamano
2007-05-10 0:11 ` Junio C Hamano
2007-05-10 0:27 ` Junio C Hamano
2007-05-10 0:29 ` David Miller
2007-05-10 8:05 ` Matthieu Moy
2007-05-10 8:25 ` Junio C Hamano
2007-05-10 8:55 ` Matthieu Moy
2007-05-10 15:38 ` Brian Gernhardt
2007-05-12 15:25 ` Win32 version, was " Johannes Schindelin
2007-05-12 15:48 ` Brian Gernhardt
2007-05-10 8:56 ` Johannes Sixt
2007-05-10 20:52 ` Dan Nicholson
2007-05-10 21:55 ` Junio C Hamano
2007-05-10 22:08 ` Dan Nicholson
2007-05-10 23:22 ` Junio C Hamano
2007-05-10 17:04 ` Andy Whitcroft
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).