<div dir="ltr">Hi Jakob, Hi Fabio,<div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 20, 2018 at 11:43 PM, Fabio Niephaus <span dir="ltr"><<a href="mailto:lists@fniephaus.com" target="_blank">lists@fniephaus.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"> <br><div dir="ltr">Hi all,<div><div class="gmail-m_3992481729335392904GmSign"><br></div><div class="gmail-m_3992481729335392904GmSign">On Wed, Feb 21, 2018 at 8:17 AM Alistair Grant <<a href="mailto:akgrant0710@gmail.com" target="_blank">akgrant0710@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><br>
Hi Tim & Eliot,<br>
<br>
On 21 February 2018 at 04:11, Eliot Miranda <<a href="mailto:eliot.miranda@gmail.com" target="_blank">eliot.miranda@gmail.com</a>> wrote:<br>
><br>
> Hi Tim,<br>
><br>
> On Tue, Feb 20, 2018 at 6:29 PM, tim Rowledge <<a href="mailto:tim@rowledge.org" target="_blank">tim@rowledge.org</a>> wrote:<br>
>><br>
>><br>
>> OK, I know that the entire point of git is to drive people insane but this is an especially silly problem.<br>
>><br>
>> clone the repository with<br>
>> git clone <a href="https://github.com/OpenSmalltalk/opensmalltalk-vm.git" rel="noreferrer" target="_blank">https://github.com/<wbr>OpenSmalltalk/opensmalltalk-<wbr>vm.git</a><br>
>> wait...<br>
>> cd opensmalltalk-vm/<br>
>> ./scripts/updateSCCSVersions -><br>
>> fatal: Not a git repository: '.git'<br>
>> fatal: unrecognized input<br>
>><br>
>> What?<br></blockquote><div><br></div><div>As part of the transition from SVN to Git, we had to add a script that runs after certain Git commands and inserts a timestamp into the code which is then compiled into the VM as a part of its version string. This approach does not only sound hacky, it actually is hacky, but a Git commit hash was not good enough. Unfortunately, there are many ways to work with Git repositories (e.g. submodules), so Jakob proposed a change that seemed to fix things for some use cases while apparently breaking things for other users.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
>> The annoying part is that it worked (at least, so far as I remember) last time I loaded up a clone of the vm repo.<br></blockquote><div><br></div><div>I've reverted Jakob's change, so please try again.</div></div></div></div></blockquote><div><br></div><div>Thanks.  It's good to know what the change is :-). </div><div><br></div><div>So we're talking about this change, right? :</div><div><br></div><div>diff --git a/scripts/updateSCCSVersions b/scripts/updateSCCSVersions</div><div>index 179b008..8593f2f 100755</div><div>--- a/scripts/updateSCCSVersions</div><div>+++ b/scripts/updateSCCSVersions</div><div>@@ -3,15 +3,13 @@</div><div> # platforms/Cross/vm/sqSCCSVersion.h to be checked-in so that its version</div><div> # info reflects that of the current check-in.</div><div><br></div><div>-if [ -d `dirname $0`/../.git ]; then</div><div>-       hooks_dir="`git rev-parse --git-dir`/hooks"</div><div>-    mkdir -p $hooks_dir</div><div>-    cp -f $0 $hooks_dir/post-commit</div><div>-    cp -f $0 $hooks_dir/post-merge</div><div>-    cp -f $0 $hooks_dir/post-checkout</div><div>-    cd `dirname $0`/..</div><div>+if [ "$(cd "$(dirname $0)" && git rev-parse --is-inside-git-dir)" = false ]; then</div><div>+    hooks_dir="`git rev-parse --git-dir`/hooks"</div><div>+    mkdir -p "$hooks_dir"</div><div>+    cp -f "$0" "$hooks_dir/post-commit"</div><div>+    cp -f "$0" "$hooks_dir/post-merge"</div><div>+    cp -f "$0" "$hooks_dir/post-checkout"</div><div> else</div><div>-    cd `dirname $0`/../..</div><div>     if [[ "$(basename $0)" == "post-checkout" ]]; then</div><div>         prevHEAD=$1</div><div>         newHEAD=$2</div><div><br></div><div>Jakob, my understanding is that in shell if one wants to evaluate something enc capture its output one must use backpacks.  e.g. using the dirname $0 example above one can say either `dirname $0` or "`dirname $0`", the difference being that the first can expand to multiple tokens but the last will be considered a single then.  I don't understand what the intent of "$(cd "$(dirname $0)" && git rev-parse --is-inside-git-dir)" = false is.  But in any case if "$(cd "$(dirname $0)" did work the same as "`cd \`dirname $0\` `", it would;t have the desired effect because the command is evaluated in a sub-shell and hence doesn't change the working directory for the git rev-parse --is-inside-git-dir command.  I think you need to say something like</div><div><br></div><div>if (cd `dirname $0`; git rev-parse --is-inside-git-dir); then<br></div><div><br></div><div>This evaluates the cd in a sub-shell established by the parentheses, and hence also changes the current directory for the git rev-parse --is-inside-git-dir command.  Since "if" takes a command ( /bin/[ is merely a link to /bin/test ) one doesn't need the sub-shell evaluation and can run the git command directly.  If we were in the right directory then we could write</div><div><br></div><div>if git rev-parse --is-inside-git-dir; then</div><div><br></div><div>The next issue is to get rid of the "fatal: not a git directory" output.  You can redirect stderr to /dev/null.  hence what I *think* you want to write is</div><div><br></div><div><div>if (cd `dirname $0`; git rev-parse --is-inside-git-dir 2>/dev/null); then<br></div></div><div><br></div><div>HTH</div><div><br></div><div>And Jakob, I hope you're not offended!  The request to revert was not in any way a criticism of you.  We all make mistakes and often those who make most mistakes are contributing the most.</div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
> Agreed.  It is incumbent upon whoever made the change to fix this.  "you break it, you fix it".  so please, step up :-)<br>
><br>
> _,,,^..^,,,_<br>
> best, Eliot<br>
><br><br>
The offending commit is 0458c6a92651fc8d0bf86158a0407f<wbr>87470ade50 from<br>
6 Feb.  I'm not familiar enough with git to easily fix it, but backing<br>
out the change should be straightforward.<br></blockquote><div><br></div><div>Thanks for looking into this, Alistair.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<br>
Cheers,<br>
Alistair<br>
</blockquote></div></div>
</blockquote></div><br><br><div class="gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div>
</div></div>