{"thread":{"id":"8052","subject":"quick bare clones taking longer?","startedAt":"2007-05-09T09:09:16Z","lastAt":"2007-05-12T15:48:57Z","messageCount":24,"participants":["David Miller","Johannes Schindelin","Junio C Hamano","Matthieu Moy","Johannes Sixt","Brian Gernhardt","Andy Whitcroft","Dan Nicholson"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"41562","messageId":"20070509.020916.80034730.davem@davemloft.net","threadId":"8052","inReplyTo":null,"subject":"quick bare clones taking longer?","fromName":"David Miller","fromEmail":"davem@davemloft.net","sentAt":"2007-05-09T09:09:16Z","receivedAt":"2007-05-09T09:09:16Z","isPatch":false,"sender":{"key":"davem@davemloft.net","avatar":null},"body":"\nmaster.kernel.org just upgraded to git-1.5.1.4 and I notice\nthat doing something like this:\n\n\tgit clone --bare -n -l -s ../torvalds/linux-2.6.git test-2.6.git\n\nis no longer an instantaneous operation, it seems to be doing a lot\nof stuff now:\n\nInitialized empty Git repository in /home/davem/git/test-2.6.git/\nremote: Generating pack...\nremote: Done counting 480025 objects.\nremote: Deltifying 480025 objects.\nremote:  100% (480025/480025) done\nIndexing 480025 objects.\nremote: Total 480025 (delta 385878), reused 473265 (delta 379369)\n 100% (480025/480025) done\nResolving 385878 deltas.\n 100% (385878/385878) done\n\nIs there a new way to get a quick clone?\n\nThanks!\n"},{"id":"41572","messageId":"Pine.LNX.4.64.0705091309010.4167@racer.site","threadId":"8052","inReplyTo":"20070509.020916.80034730.davem@davemloft.net","subject":"Re: quick bare clones taking longer?","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-05-09T11:09:40Z","receivedAt":"2007-05-09T11:09:40Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 9 May 2007, David Miller wrote:\n\n> master.kernel.org just upgraded to git-1.5.1.4 and I notice\n> that doing something like this:\n> \n> \tgit clone --bare -n -l -s ../torvalds/linux-2.6.git test-2.6.git\n> \n> is no longer an instantaneous operation, it seems to be doing a lot\n> of stuff now:\n> \n> Initialized empty Git repository in /home/davem/git/test-2.6.git/\n> remote: Generating pack...\n> remote: Done counting 480025 objects.\n> remote: Deltifying 480025 objects.\n> remote:  100% (480025/480025) done\n> Indexing 480025 objects.\n> remote: Total 480025 (delta 385878), reused 473265 (delta 379369)\n>  100% (480025/480025) done\n> Resolving 385878 deltas.\n>  100% (385878/385878) done\n> \n> Is there a new way to get a quick clone?\n\nI just checked out 1.5.1.4, built it, and cannot reproduce this behaviour. \nIt's as fast as ever.\n\nCiao,\nDscho\n"},{"id":"41607","messageId":"7vvef2t36n.fsf@assigned-by-dhcp.cox.net","threadId":"8052","inReplyTo":"20070509.020916.80034730.davem@davemloft.net","subject":"Re: quick bare clones taking longer?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-05-09T15:41:20Z","receivedAt":"2007-05-09T15:41:20Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"David Miller <davem@davemloft.net> writes:\n\n> master.kernel.org just upgraded to git-1.5.1.4 and I notice\n> that doing something like this:\n>\n> \tgit clone --bare -n -l -s ../torvalds/linux-2.6.git test-2.6.git\n>\n> is no longer an instantaneous operation, it seems to be doing a lot\n> of stuff now:\n>\n> Initialized empty Git repository in /home/davem/git/test-2.6.git/\n> remote: Generating pack...\n> remote: Done counting 480025 objects.\n> remote: Deltifying 480025 objects.\n> remote:  100% (480025/480025) done\n> Indexing 480025 objects.\n> remote: Total 480025 (delta 385878), reused 473265 (delta 379369)\n>  100% (480025/480025) done\n> Resolving 385878 deltas.\n>  100% (385878/385878) done\n>\n> Is there a new way to get a quick clone?\n\nThere is something very wrong.  \"-l -s\" should never go to the\n\"remote: Generating pack...\" codepath.  Is that reproducible?\nCould you try \"sh -x git-clone\" it?\n"},{"id":"41650","messageId":"20070509.130614.15589957.davem@davemloft.net","threadId":"8052","inReplyTo":"7vvef2t36n.fsf@assigned-by-dhcp.cox.net","subject":"Re: quick bare clones taking longer?","fromName":"David Miller","fromEmail":"davem@davemloft.net","sentAt":"2007-05-09T20:06:14Z","receivedAt":"2007-05-09T20:06:14Z","isPatch":false,"sender":{"key":"davem@davemloft.net","avatar":null},"body":"From: Junio C Hamano <junkio@cox.net>\nDate: Wed, 09 May 2007 08:41:20 -0700\n\n> There is something very wrong.  \"-l -s\" should never go to the\n> \"remote: Generating pack...\" codepath.  Is that reproducible?\n\nEvery single time on master.kernel.org\n\n> Could you try \"sh -x git-clone\" it?\n\nSure:\n\n+ unset CDPATH\n+ '[' -n '' ']'\n+ quiet=\n+ local=no\n+ use_local=no\n+ local_shared=no\n+ unset template\n+ no_checkout=\n+ upload_pack=\n+ bare=\n+ reference=\n+ origin=\n+ origin_override=\n+ use_separate_remote=t\n+ depth=\n+ no_progress=\n+ test -t 1\n+ case \"$#,$1\" in\n+ bare=yes\n+ shift\n+ case \"$#,$1\" in\n+ no_checkout=yes\n+ shift\n+ case \"$#,$1\" in\n+ use_local=yes\n+ shift\n+ case \"$#,$1\" in\n+ local_shared=yes\n+ use_local=yes\n+ shift\n+ case \"$#,$1\" in\n+ break\n+ repo=../torvalds/linux-2.6.git\n+ test -n ../torvalds/linux-2.6.git\n+ test yes = yes\n+ test yes = ''\n+ no_checkout=yes\n+ use_separate_remote=\n+ test -z ''\n+ origin=origin\n++ get_repo_base ../torvalds/linux-2.6.git\n+ base=\n+ dir=test-2.6.git\n+ '[' -z test-2.6.git ']'\n+ '[' -e test-2.6.git ']'\n+ mkdir -p test-2.6.git\n++ cd test-2.6.git\n++ pwd\n+ D=/home/davem/git/test-2.6.git\n+ trap 'err=$?; cd ..; rm -rf \"$D\"; exit $err' 0\n+ case \"$bare\" in\n+ GIT_DIR=/home/davem/git/test-2.6.git\n+ export GIT_DIR\n+ git-init\nInitialized empty Git repository in /home/davem/git/test-2.6.git/\n+ test -n ''\n+ rm -f /home/davem/git/test-2.6.git/CLONE_HEAD\n+ case \"$local,$use_local\" in\n+ case \"$repo\" in\n+ case \"$upload_pack\" in\n+ git-fetch-pack --all -k ../torvalds/linux-2.6.git\nremote: Generating pack...\n\netc.\n\nOh, /home/davem/git is a soft symlink to\n/pub/scm/linux/kernel/git/davem, maybe that is confusing\ngit to make it think the repo is not local.\n"},{"id":"41669","messageId":"7virb1sm6h.fsf@assigned-by-dhcp.cox.net","threadId":"8052","inReplyTo":"20070509.130614.15589957.davem@davemloft.net","subject":"Re: quick bare clones taking longer?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-05-09T21:48:38Z","receivedAt":"2007-05-09T21:48:38Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"David Miller <davem@davemloft.net> writes:\n\n> From: Junio C Hamano <junkio@cox.net>\n> Date: Wed, 09 May 2007 08:41:20 -0700\n>\n>> There is something very wrong.  \"-l -s\" should never go to the\n>> \"remote: Generating pack...\" codepath.  Is that reproducible?\n>\n> Every single time on master.kernel.org\n>\n>> Could you try \"sh -x git-clone\" it?\n>\n> Sure:\n>\n> + unset CDPATH\n> + '[' -n '' ']'\n> + quiet=\n> + local=no\n> + use_local=no\n> + local_shared=no\n> + unset template\n> + no_checkout=\n> + upload_pack=\n> + bare=\n> + reference=\n> + origin=\n> + origin_override=\n> + use_separate_remote=t\n> + depth=\n> + no_progress=\n> + test -t 1\n> + case \"$#,$1\" in\n> + bare=yes\n> + shift\n> + case \"$#,$1\" in\n> + no_checkout=yes\n> + shift\n> + case \"$#,$1\" in\n> + use_local=yes\n> + shift\n> + case \"$#,$1\" in\n> + local_shared=yes\n> + use_local=yes\n> + shift\n> + case \"$#,$1\" in\n> + break\n> + repo=../torvalds/linux-2.6.git\n> + test -n ../torvalds/linux-2.6.git\n> + test yes = yes\n> + test yes = ''\n> + no_checkout=yes\n> + use_separate_remote=\n> + test -z ''\n> + origin=origin\n> ++ get_repo_base ../torvalds/linux-2.6.git\n> + base=\n\nThis part puzzles me.  The only way I could reproduce this was:\n\n$ ls -F victim victim.git\nls: victim: No such file or directory\nvictim.git:\n./   HEAD\tconfig\t description\t       hooks/  lost-found/  refs/\n../  branches/\tconfig~  gitcvs.master.sqlite  info/   objects/     remotes/\n$ mkdir j\n$ cd j\n$ git clone --bare -l -s -n ../victim new.git\n\nThat is, I did not have ../victim but I did have ../victim.git/\nrepository, and I gave the former to \"git clone\".\n\nBut that suggests that you do not have ../torvalds/linux-2.6.git\ndirectory but instead have ../torvalds/linux-2.6.git.git/ which\nsound a bit insane.\n\nPuzzled...\n"},{"id":"41672","messageId":"20070509.150256.59469756.davem@davemloft.net","threadId":"8052","inReplyTo":"7virb1sm6h.fsf@assigned-by-dhcp.cox.net","subject":"Re: quick bare clones taking longer?","fromName":"David Miller","fromEmail":"davem@davemloft.net","sentAt":"2007-05-09T22:02:56Z","receivedAt":"2007-05-09T22:02:56Z","isPatch":false,"sender":{"key":"davem@davemloft.net","avatar":null},"body":"From: Junio C Hamano <junkio@cox.net>\nDate: Wed, 09 May 2007 14:48:38 -0700\n\n> > + no_checkout=yes\n> > + use_separate_remote=\n> > + test -z ''\n> > + origin=origin\n> > ++ get_repo_base ../torvalds/linux-2.6.git\n> > + base=\n> \n> This part puzzles me.  The only way I could reproduce this was:\n> \n> $ ls -F victim victim.git\n> ls: victim: No such file or directory\n> victim.git:\n> ./   HEAD\tconfig\t description\t       hooks/  lost-found/  refs/\n> ../  branches/\tconfig~  gitcvs.master.sqlite  info/   objects/     remotes/\n> $ mkdir j\n> $ cd j\n> $ git clone --bare -l -s -n ../victim new.git\n> \n> That is, I did not have ../victim but I did have ../victim.git/\n> repository, and I gave the former to \"git clone\".\n> \n> But that suggests that you do not have ../torvalds/linux-2.6.git\n> directory but instead have ../torvalds/linux-2.6.git.git/ which\n> sound a bit insane.\n> \n> Puzzled...\n\nThis deeply puzzles me too.\n\nI'm just not going to go into my git directory using that\nsymlink in my home directory any more. :-)\n"},{"id":"41682","messageId":"7v3b25siwk.fsf@assigned-by-dhcp.cox.net","threadId":"8052","inReplyTo":"20070509.150256.59469756.davem@davemloft.net","subject":"Re: quick bare clones taking longer?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-05-09T22:59:23Z","receivedAt":"2007-05-09T22:59:23Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"David Miller <davem@davemloft.net> writes:\n\n> From: Junio C Hamano <junkio@cox.net>\n> Date: Wed, 09 May 2007 14:48:38 -0700\n>\n>> > + no_checkout=yes\n>> > + use_separate_remote=\n>> > + test -z ''\n>> > + origin=origin\n>> > ++ get_repo_base ../torvalds/linux-2.6.git\n>> > + base=\n>> \n>> This part puzzles me.  The only way I could reproduce this was:\n>> \n>> $ ls -F victim victim.git\n>> ls: victim: No such file or directory\n>> victim.git:\n>> ./   HEAD\tconfig\t description\t       hooks/  lost-found/  refs/\n>> ../  branches/\tconfig~  gitcvs.master.sqlite  info/   objects/     remotes/\n>> $ mkdir j\n>> $ cd j\n>> $ git clone --bare -l -s -n ../victim new.git\n>> \n>> That is, I did not have ../victim but I did have ../victim.git/\n>> repository, and I gave the former to \"git clone\".\n>> \n>> But that suggests that you do not have ../torvalds/linux-2.6.git\n>> directory but instead have ../torvalds/linux-2.6.git.git/ which\n>> sound a bit insane.\n>> \n>> Puzzled...\n>\n> This deeply puzzles me too.\n>\n> I'm just not going to go into my git directory using that\n> symlink in my home directory any more. :-)\n\nAhhh, symlink!\n\nget_repo_base does this:\n\n        get_repo_base() {\n                (cd \"$1\" && (cd .git ; pwd)) 2> /dev/null\n        }\n\nand is used like this:\n\n        # Turn the source into an absolute path if\n        # it is local\n        if base=$(get_repo_base \"$repo\"); then\n                repo=\"$base\"\n                local=yes\n        fi\n\nThat is, get_repo_base does:\n\n * first try to cd to ../torvalds/linux-2.6.git; if it fails\n   then give up.\n\n * then further cd down to .git if we can but do not worry about\n   it if we can't.  Report where we are and succeed.\n\nIf the above \"fails\", the caller considers the cloned-from\nrepository a non-local one, and turns off -l -s optimization.\n\nThe above sequence is called before we create the new directory\nand chdir to it.  Maybe pwd has funny behaviour (e.g. $PWD) and\nwe need to explicitly say /bin/pwd or somesuch...\n"},{"id":"41686","messageId":"20070509.162301.48802460.davem@davemloft.net","threadId":"8052","inReplyTo":"7v3b25siwk.fsf@assigned-by-dhcp.cox.net","subject":"Re: quick bare clones taking longer?","fromName":"David Miller","fromEmail":"davem@davemloft.net","sentAt":"2007-05-09T23:23:01Z","receivedAt":"2007-05-09T23:23:01Z","isPatch":false,"sender":{"key":"davem@davemloft.net","avatar":null},"body":"From: Junio C Hamano <junkio@cox.net>\nDate: Wed, 09 May 2007 15:59:23 -0700\n\n> The above sequence is called before we create the new directory\n> and chdir to it.  Maybe pwd has funny behaviour (e.g. $PWD) and\n> we need to explicitly say /bin/pwd or somesuch...\n\nIndeed:\n\n[davem@hera ~]$ pwd\n/home/davem\n[davem@hera ~]$ cd git\n[davem@hera git]$ pwd\n/home/davem/git\n[davem@hera git]$ /bin/pwd\n/home/ftp/pub/scm/linux/kernel/git/davem\n[davem@hera git]$ \n"},{"id":"41687","messageId":"7vy7jxr35a.fsf@assigned-by-dhcp.cox.net","threadId":"8052","inReplyTo":"20070509.162301.48802460.davem@davemloft.net","subject":"Re: quick bare clones taking longer?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-05-09T23:25:05Z","receivedAt":"2007-05-09T23:25:05Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"David Miller <davem@davemloft.net> writes:\n\n> From: Junio C Hamano <junkio@cox.net>\n> Date: Wed, 09 May 2007 15:59:23 -0700\n>\n>> The above sequence is called before we create the new directory\n>> and chdir to it.  Maybe pwd has funny behaviour (e.g. $PWD) and\n>> we need to explicitly say /bin/pwd or somesuch...\n>\n> Indeed:\n>\n> [davem@hera ~]$ pwd\n> /home/davem\n> [davem@hera ~]$ cd git\n> [davem@hera git]$ pwd\n> /home/davem/git\n> [davem@hera git]$ /bin/pwd\n> /home/ftp/pub/scm/linux/kernel/git/davem\n> [davem@hera git]$ \n\nThanks.\n"},{"id":"41689","messageId":"7vd519r10c.fsf@assigned-by-dhcp.cox.net","threadId":"8052","inReplyTo":"7vy7jxr35a.fsf@assigned-by-dhcp.cox.net","subject":"Re: quick bare clones taking longer?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-05-10T00:11:15Z","receivedAt":"2007-05-10T00:11:15Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <junkio@cox.net> writes:\n\n> David Miller <davem@davemloft.net> writes:\n>\n>> From: Junio C Hamano <junkio@cox.net>\n>> Date: Wed, 09 May 2007 15:59:23 -0700\n>>\n>>> The above sequence is called before we create the new directory\n>>> and chdir to it.  Maybe pwd has funny behaviour (e.g. $PWD) and\n>>> we need to explicitly say /bin/pwd or somesuch...\n>>\n>> Indeed:\n>>\n>> [davem@hera ~]$ pwd\n>> /home/davem\n>> [davem@hera ~]$ cd git\n>> [davem@hera git]$ pwd\n>> /home/davem/git\n>> [davem@hera git]$ /bin/pwd\n>> /home/ftp/pub/scm/linux/kernel/git/davem\n>> [davem@hera git]$ \n>\n> Thanks.\n\nThis would fix it, but I find this kind of ugly.\n\n-- >8 --\ngit-clone: don't get fooled by $PWD\n\nIf you have /home/me/git symlink pointing at /pub/git/mine,\ntrying to clone from /pub/git/his/ using relative path would not\nwork as expected:\n\n\t$ cd /home/me\n        $ cd git\n        $ ls ../\n        his    mine\n        $ git clone -l -s -n ../his/stuff.git\n\nThis is because \"cd ../his/stuff.git\" done inside git-clone to\ncheck if the repository is local is confused by $PWD, which is\nset to /home/me, and tries to go to /home/his/stuff.git which is\ndifferent from /pub/git/his/stuff.git.\n\nWe could probably say \"set -P\" (or \"cd -P\") instead, if we know\nthe shell is POSIX, but the way the patch is coded is probably\nmore portable.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n\ndiff --git a/git-clone.sh b/git-clone.sh\nindex cad5c0c..c5852a2 100755\n--- a/git-clone.sh\n+++ b/git-clone.sh\n@@ -18,7 +18,14 @@ usage() {\n }\n \n get_repo_base() {\n-\t(cd \"$1\" && (cd .git ; pwd)) 2> /dev/null\n+\t(\n+\t\tcd \"`/bin/pwd`\" &&\n+\t\tcd \"$1\" &&\n+\t\t(\n+\t\t\tcd .git\n+\t\t\tpwd\n+\t\t)\n+\t) 2>/dev/null\n }\n \n if [ -n \"$GIT_SSL_NO_VERIFY\" ]; then\n"},{"id":"41690","messageId":"7v7irhr08y.fsf@assigned-by-dhcp.cox.net","threadId":"8052","inReplyTo":"7vd519r10c.fsf@assigned-by-dhcp.cox.net","subject":"Re: quick bare clones taking longer?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-05-10T00:27:41Z","receivedAt":"2007-05-10T00:27:41Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <junkio@cox.net> writes:\n\n> Junio C Hamano <junkio@cox.net> writes:\n>\n>> David Miller <davem@davemloft.net> writes:\n>>\n>>> From: Junio C Hamano <junkio@cox.net>\n>>> Date: Wed, 09 May 2007 15:59:23 -0700\n>>>\n>>>> The above sequence is called before we create the new directory\n>>>> and chdir to it.  Maybe pwd has funny behaviour (e.g. $PWD) and\n>>>> we need to explicitly say /bin/pwd or somesuch...\n>>>\n>>> Indeed:\n>>>\n>>> [davem@hera ~]$ pwd\n>>> /home/davem\n>>> [davem@hera ~]$ cd git\n>>> [davem@hera git]$ pwd\n>>> /home/davem/git\n>>> [davem@hera git]$ /bin/pwd\n>>> /home/ftp/pub/scm/linux/kernel/git/davem\n>>> [davem@hera git]$ \n>>\n>> Thanks.\n>\n> This would fix it, but I find this kind of ugly.\n\nSide note.  Earlier you said:\n\n   master.kernel.org just upgraded to git-1.5.1.4 and I notice\n   that doing something like this:\n\n           git clone --bare -n -l -s ../torvalds/linux-2.6.git test-2.6.git\n\n   is no longer an instantaneous operation, it seems to be doing a lot\n   of stuff now:\n\nBut I do not see any difference between v1.5.1.3 and v1.5.1.4 in\nthis area.  In fact, that get_repo_base() shell function has not\nchanged since v0.99.\n"},{"id":"41691","messageId":"20070509.172906.71874810.davem@davemloft.net","threadId":"8052","inReplyTo":"7v7irhr08y.fsf@assigned-by-dhcp.cox.net","subject":"Re: quick bare clones taking longer?","fromName":"David Miller","fromEmail":"davem@davemloft.net","sentAt":"2007-05-10T00:29:06Z","receivedAt":"2007-05-10T00:29:06Z","isPatch":false,"sender":{"key":"davem@davemloft.net","avatar":null},"body":"From: Junio C Hamano <junkio@cox.net>\nDate: Wed, 09 May 2007 17:27:41 -0700\n\n> Side note.  Earlier you said:\n> \n>    master.kernel.org just upgraded to git-1.5.1.4 and I notice\n>    that doing something like this:\n> \n>            git clone --bare -n -l -s ../torvalds/linux-2.6.git test-2.6.git\n> \n>    is no longer an instantaneous operation, it seems to be doing a lot\n>    of stuff now:\n> \n> But I do not see any difference between v1.5.1.3 and v1.5.1.4 in\n> this area.  In fact, that get_repo_base() shell function has not\n> changed since v0.99.\n\nCorrect.  I happened to create and start using that symlink\naround the same time they upgraded, that's why I made that\n(false) connection.\n\nThere is no connection between git version and this problem, it's just\nthe symlink thing.\n"},{"id":"41719","messageId":"vpqtzul3xzm.fsf@bauges.imag.fr","threadId":"8052","inReplyTo":"7vd519r10c.fsf@assigned-by-dhcp.cox.net","subject":"Re: quick bare clones taking longer?","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2007-05-10T08:05:01Z","receivedAt":"2007-05-10T08:05:01Z","isPatch":false,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Junio C Hamano <junkio@cox.net> writes:\n\n>  get_repo_base() {\n> -\t(cd \"$1\" && (cd .git ; pwd)) 2> /dev/null\n> +\t(\n> +\t\tcd \"`/bin/pwd`\" &&\n> +\t\tcd \"$1\" &&\n> +\t\t(\n> +\t\t\tcd .git\n> +\t\t\tpwd\n> +\t\t)\n> +\t) 2>/dev/null\n>  }\n\nWill this work on windows?\n\n-- \nMatthieu\n"},{"id":"41721","messageId":"7vejlpkruy.fsf@assigned-by-dhcp.cox.net","threadId":"8052","inReplyTo":"vpqtzul3xzm.fsf@bauges.imag.fr","subject":"Re: quick bare clones taking longer?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-05-10T08:25:25Z","receivedAt":"2007-05-10T08:25:25Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Matthieu Moy <Matthieu.Moy@imag.fr> writes:\n\n> Junio C Hamano <junkio@cox.net> writes:\n>\n>>  get_repo_base() {\n>> -\t(cd \"$1\" && (cd .git ; pwd)) 2> /dev/null\n>> +\t(\n>> +\t\tcd \"`/bin/pwd`\" &&\n>> +\t\tcd \"$1\" &&\n>> +\t\t(\n>> +\t\t\tcd .git\n>> +\t\t\tpwd\n>> +\t\t)\n>> +\t) 2>/dev/null\n>>  }\n>\n> Will this work on windows?\n\nIs that a serious question?\n\nIf so, my answer is \"I do not know, but the update is not any\nmore complex than the existing code -- both are perfectly fine\nPOSIX shell\".  Besides, if there are enough users who care about\nWindows, there must be some competent ones among them, and we\nwill hear from them soon enough with an improvement patch.\n\nIf not, welcome to my killfile ;-).\n\nNB.  No, the last one is not serious.  I do not have a\nkillfile.\n"},{"id":"41725","messageId":"vpq4pmlys5b.fsf@bauges.imag.fr","threadId":"8052","inReplyTo":"7vejlpkruy.fsf@assigned-by-dhcp.cox.net","subject":"Re: quick bare clones taking longer?","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2007-05-10T08:55:28Z","receivedAt":"2007-05-10T08:55:28Z","isPatch":false,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Junio C Hamano <junkio@cox.net> writes:\n\n> Is that a serious question?\n\nIt is. I have to admit that my knowledge about POSIX kind of things on\nwindows approaches zero, but a hardcoded /bin/something path sounds\nsuspicious to me.\n\nNothing more, nothing less in my question.\n\n-- \nMatthieu\n"},{"id":"41726","messageId":"4642DE52.F9F0A5B2@eudaptics.com","threadId":"8052","inReplyTo":"vpqtzul3xzm.fsf@bauges.imag.fr","subject":"Re: quick bare clones taking longer?","fromName":"Johannes Sixt","fromEmail":"j.sixt@eudaptics.com","sentAt":"2007-05-10T08:56:50Z","receivedAt":"2007-05-10T08:56:50Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Matthieu Moy wrote:\n> \n> Junio C Hamano <junkio@cox.net> writes:\n> \n> >  get_repo_base() {\n> > -     (cd \"$1\" && (cd .git ; pwd)) 2> /dev/null\n> > +     (\n> > +             cd \"`/bin/pwd`\" &&\n> > +             cd \"$1\" &&\n> > +             (\n> > +                     cd .git\n> > +                     pwd\n> > +             )\n> > +     ) 2>/dev/null\n> >  }\n> \n> Will this work on windows?\n\nYes. As does the alternative that uses cd -P. MinGW uses bash (3.1\nhere).\n\n-- Hannes\n"},{"id":"41747","messageId":"2FFB6305-AB01-4C78-9831-18522C0FFE79@silverinsanity.com","threadId":"8052","inReplyTo":"vpq4pmlys5b.fsf@bauges.imag.fr","subject":"Re: quick bare clones taking longer?","fromName":"Brian Gernhardt","fromEmail":"benji@silverinsanity.com","sentAt":"2007-05-10T15:38:59Z","receivedAt":"2007-05-10T15:38:59Z","isPatch":false,"sender":{"key":"benji@silverinsanity.com","avatar":"https://gravatar.com/avatar/e06c101dbc25c68114d859b4a9ec7cf8a2c52fd2b0270ef0eac0e2e63ff22311?d=mp&s=160"},"body":"\nOn May 10, 2007, at 4:55 AM, Matthieu Moy wrote:\n\n> Junio C Hamano <junkio@cox.net> writes:\n>\n>> Is that a serious question?\n>\n> It is. I have to admit that my knowledge about POSIX kind of things on\n> windows approaches zero, but a hardcoded /bin/something path sounds\n> suspicious to me.\n\nI think every POSIX environment provides _something_ for /bin and / \nusr/bin.  There are too many scripts that start \"#!/bin/bash\" or \"#!/ \nusr/bin/env interpreter\" for it not to.  And to be POSIX, the basic  \nutilities (like pwd and env) should be in there.  Someday Git may  \nwork on Windows without a funny (for MS) environment.  But that day  \nis not today.  Tomorrow doesn't look too good either.  ;-)\n\n~~ Brian\n"},{"id":"41754","messageId":"464350B7.3030601@shadowen.org","threadId":"8052","inReplyTo":"7vd519r10c.fsf@assigned-by-dhcp.cox.net","subject":"Re: quick bare clones taking longer?","fromName":"Andy Whitcroft","fromEmail":"apw@shadowen.org","sentAt":"2007-05-10T17:04:55Z","receivedAt":"2007-05-10T17:04:55Z","isPatch":false,"sender":{"key":"apw@shadowen.org","avatar":"https://gravatar.com/avatar/d3088262854661a913ef35cc40fedcc270142d4461791142bc1ea0b2a4e2e147?d=mp&s=160"},"body":"Junio C Hamano wrote:\n> Junio C Hamano <junkio@cox.net> writes:\n> \n>> David Miller <davem@davemloft.net> writes:\n>>\n>>> From: Junio C Hamano <junkio@cox.net>\n>>> Date: Wed, 09 May 2007 15:59:23 -0700\n>>>\n>>>> The above sequence is called before we create the new directory\n>>>> and chdir to it.  Maybe pwd has funny behaviour (e.g. $PWD) and\n>>>> we need to explicitly say /bin/pwd or somesuch...\n>>> Indeed:\n>>>\n>>> [davem@hera ~]$ pwd\n>>> /home/davem\n>>> [davem@hera ~]$ cd git\n>>> [davem@hera git]$ pwd\n>>> /home/davem/git\n>>> [davem@hera git]$ /bin/pwd\n>>> /home/ftp/pub/scm/linux/kernel/git/davem\n>>> [davem@hera git]$ \n>> Thanks.\n> \n> This would fix it, but I find this kind of ugly.\n> \n> -- >8 --\n> git-clone: don't get fooled by $PWD\n> \n> If you have /home/me/git symlink pointing at /pub/git/mine,\n> trying to clone from /pub/git/his/ using relative path would not\n> work as expected:\n> \n> \t$ cd /home/me\n>         $ cd git\n>         $ ls ../\n>         his    mine\n>         $ git clone -l -s -n ../his/stuff.git\n> \n> This is because \"cd ../his/stuff.git\" done inside git-clone to\n> check if the repository is local is confused by $PWD, which is\n> set to /home/me, and tries to go to /home/his/stuff.git which is\n> different from /pub/git/his/stuff.git.\n> \n> We could probably say \"set -P\" (or \"cd -P\") instead, if we know\n> the shell is POSIX, but the way the patch is coded is probably\n> more portable.\n> \n> Signed-off-by: Junio C Hamano <junkio@cox.net>\n> ---\n> \n> diff --git a/git-clone.sh b/git-clone.sh\n> index cad5c0c..c5852a2 100755\n> --- a/git-clone.sh\n> +++ b/git-clone.sh\n> @@ -18,7 +18,14 @@ usage() {\n>  }\n>  \n>  get_repo_base() {\n> -\t(cd \"$1\" && (cd .git ; pwd)) 2> /dev/null\n> +\t(\n> +\t\tcd \"`/bin/pwd`\" &&\n> +\t\tcd \"$1\" &&\n> +\t\t(\n> +\t\t\tcd .git\n> +\t\t\tpwd\n> +\t\t)\n> +\t) 2>/dev/null\n>  }\n>  \n>  if [ -n \"$GIT_SSL_NO_VERIFY\" ]; then\n\nThat is pretty much how I have seen this solved in the past.  One thing\nwhile you are playing with this code.  There seems to be an extra\nsub-shell in there unnecesarily and the error redirection seems a little\naggressive?\n\nThis seems to be semantically equivalent:\n\nget_repo_base() {\n\t(\n\t\tcd \"`/bin/pwd`\" &&\n\t\tcd \"$1\" &&\n\t\t{\n\t\t\tcd .git 2>/dev/null\n\t\t\tpwd\n\t\t}\n\t)\n}\n\n-apw\n"},{"id":"41777","messageId":"loom.20070510T224750-851@post.gmane.org","threadId":"8052","inReplyTo":"4642DE52.F9F0A5B2@eudaptics.com","subject":"Re: quick bare clones taking longer?","fromName":"Dan Nicholson","fromEmail":"dbn.lists@gmail.com","sentAt":"2007-05-10T20:52:15Z","receivedAt":"2007-05-10T20:52:15Z","isPatch":false,"sender":{"key":"dbn.lists@gmail.com","avatar":null},"body":"Johannes Sixt <J.Sixt <at> eudaptics.com> writes:\n> \n> Matthieu Moy wrote:\n> > \n> > Junio C Hamano <junkio <at> cox.net> writes:\n> > \n> > >  get_repo_base() {\n> > > -     (cd \"$1\" && (cd .git ; pwd)) 2> /dev/null\n> > > +     (\n> > > +             cd \"`/bin/pwd`\" &&\n> > > +             cd \"$1\" &&\n> > > +             (\n> > > +                     cd .git\n> > > +                     pwd\n> > > +             )\n> > > +     ) 2>/dev/null\n> > >  }\n> > \n> > Will this work on windows?\n> \n> Yes. As does the alternative that uses cd -P. MinGW uses bash (3.1\n> here).\n\nIn fact, all POSIX shells should support `cd -P' according to the spec, so it\nshould probably just be used directly instead of hoping that /bin/pwd exists.\n\n(cd -P \"$1\" && (cd .git ; pwd)) 2>/dev/null\n\nhttp://www.opengroup.org/onlinepubs/009695399/utilities/cd.html\n\n--\nDan\n"},{"id":"41779","messageId":"7vbqgsibrr.fsf@assigned-by-dhcp.cox.net","threadId":"8052","inReplyTo":"loom.20070510T224750-851@post.gmane.org","subject":"Re: quick bare clones taking longer?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-05-10T21:55:52Z","receivedAt":"2007-05-10T21:55:52Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Dan Nicholson <dbn.lists@gmail.com> writes:\n\n> In fact, all POSIX shells should support `cd -P' according to the spec, so it\n> should probably just be used directly instead of hoping that /bin/pwd exists.\n>\n> (cd -P \"$1\" && (cd .git ; pwd)) 2>/dev/null\n>\n> http://www.opengroup.org/onlinepubs/009695399/utilities/cd.html\n\nYes but no ;-).  I've said this a few times on the list in the\npast, but I'll repeat it again for new people.\n\nWe reject something whose portability in question by saying\n\"It's not _even in_ POSIX\".  We on the other hand try to refrain\nfrom saying \"POSIX says you are supposed to have it, so screw\npeople that are not fully POSIX\".\n"},{"id":"41784","messageId":"91705d080705101508y26eabb37oaf90aa4d9a7e239a@mail.gmail.com","threadId":"8052","inReplyTo":"7vbqgsibrr.fsf@assigned-by-dhcp.cox.net","subject":"Re: quick bare clones taking longer?","fromName":"Dan Nicholson","fromEmail":"dbn.lists@gmail.com","sentAt":"2007-05-10T22:08:01Z","receivedAt":"2007-05-10T22:08:01Z","isPatch":false,"sender":{"key":"dbn.lists@gmail.com","avatar":null},"body":"On 5/10/07, Junio C Hamano <junkio@cox.net> wrote:\n> Dan Nicholson <dbn.lists@gmail.com> writes:\n>\n> > In fact, all POSIX shells should support `cd -P' according to the spec, so it\n> > should probably just be used directly instead of hoping that /bin/pwd exists.\n> >\n> > (cd -P \"$1\" && (cd .git ; pwd)) 2>/dev/null\n> >\n> > http://www.opengroup.org/onlinepubs/009695399/utilities/cd.html\n>\n> Yes but no ;-).  I've said this a few times on the list in the\n> past, but I'll repeat it again for new people.\n>\n> We reject something whose portability in question by saying\n> \"It's not _even in_ POSIX\".  We on the other hand try to refrain\n> from saying \"POSIX says you are supposed to have it, so screw\n> people that are not fully POSIX\".\n\nYes, I suppose. At the same time, git already implicitly requires more\nthan, say, a Bourne shell. Functions, $( ) command substitution, ${}\nparameter expansion, $(( )) arithmetic expansion, etc. These are all\nstandard in a POSIX shell, but may or may not exist in other shell\nvariants.\n\n--\nDan\n"},{"id":"41793","messageId":"7v3b24i7s0.fsf@assigned-by-dhcp.cox.net","threadId":"8052","inReplyTo":"91705d080705101508y26eabb37oaf90aa4d9a7e239a@mail.gmail.com","subject":"Re: quick bare clones taking longer?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-05-10T23:22:07Z","receivedAt":"2007-05-10T23:22:07Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Dan Nicholson\" <dbn.lists@gmail.com> writes:\n\n> On 5/10/07, Junio C Hamano <junkio@cox.net> wrote:\n> ...\n>> We reject something whose portability is in question by saying\n>> \"It's not _even in_ POSIX\".  We on the other hand try to refrain\n>> from saying \"POSIX says you are supposed to have it, so screw\n>> people that are not fully POSIX\".\n>\n> Yes, I suppose. At the same time, git already implicitly requires more\n> than, say, a Bourne shell.\n\nYes, and the line is fuzzy and case by case.  I am playing it\nsafe as we are in pre-release freeze, also I condider /bin/pwd\nmuch more universally available than \"cd -P\".\n"},{"id":"41927","messageId":"Pine.LNX.4.64.0705121724000.4167@racer.site","threadId":"8052","inReplyTo":"2FFB6305-AB01-4C78-9831-18522C0FFE79@silverinsanity.com","subject":"Win32 version, was Re: quick bare clones taking longer?","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-05-12T15:25:47Z","receivedAt":"2007-05-12T15:25:47Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 10 May 2007, Brian Gernhardt wrote:\n\n> Someday Git may work on Windows without a funny (for MS) environment.  \n> But that day is not today.  Tomorrow doesn't look too good either.  ;-)\n\nIt sure sounds like you would like that day rather sooner than later. In \nrelated news, that day will be sooner rather than later, if people who \nactually care deeply about this _do_ something about it.\n\nHth,\nDscho\n"},{"id":"41934","messageId":"5DA7B946-A0A4-4C23-B339-31984FA468A3@silverinsanity.com","threadId":"8052","inReplyTo":"Pine.LNX.4.64.0705121724000.4167@racer.site","subject":"Re: Win32 version, was Re: quick bare clones taking longer?","fromName":"Brian Gernhardt","fromEmail":"benji@silverinsanity.com","sentAt":"2007-05-12T15:48:57Z","receivedAt":"2007-05-12T15:48:57Z","isPatch":false,"sender":{"key":"benji@silverinsanity.com","avatar":"https://gravatar.com/avatar/e06c101dbc25c68114d859b4a9ec7cf8a2c52fd2b0270ef0eac0e2e63ff22311?d=mp&s=160"},"body":"\nOn May 12, 2007, at 11:25 AM, Johannes Schindelin wrote:\n\n> On Thu, 10 May 2007, Brian Gernhardt wrote:\n>\n>> Someday Git may work on Windows without a funny (for MS) environment.\n>> But that day is not today.  Tomorrow doesn't look too good  \n>> either.  ;-)\n>\n> It sure sounds like you would like that day rather sooner than  \n> later. In\n> related news, that day will be sooner rather than later, if people who\n> actually care deeply about this _do_ something about it.\n\nActually, at the moment, my only Windows environment is inside a VM  \nbox on my Mac.  So as long as it works on my Mac, I don't care how  \nlong it takes.  And I have neither the time nor build environment to  \ntry to fix it.  If that changes, I'll produce patches like a good  \ncode monkey.\n\n~~ Brian\n"}]}