]> gitweb.factorcode.org Git - factor.git/commitdiff
system: Make the git version code more robust.
authorDoug Coleman <doug.coleman@gmail.com>
Sun, 22 Jul 2018 16:32:02 +0000 (11:32 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Sun, 22 Jul 2018 16:45:50 +0000 (11:45 -0500)
Really confusing sequence errors if Factor vm isn't compiled with proper git label.

e.g. good: -DFACTOR_GIT_LABEL="heads/master-102fe6154e9deec5dff38ee70519f7bbe506f6ce"

bad: -DFACTOR_GIT_LABEL=""
before this patch gave an integer comparison error comparing ``f 16 <``

core/system/system.factor

index a694d074fffe0b5144c1dce165c0ab9003bacfae..4fcdefc02402a40b1fa63042bec13f4128a161f9 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (c) 2007, 2010 slava pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors assocs continuations init io kernel kernel.private make
-math math.parser namespaces sequences ;
+USING: accessors assocs continuations init io kernel
+kernel.private make math.parser namespaces sequences splitting ;
 IN: system
 
 PRIMITIVE: (exit) ( n -- * )
@@ -27,10 +27,10 @@ UNION: unix macosx linux ;
 : vm-git-label ( -- string ) \ vm-git-label get-global ;
 
 : vm-git-ref ( -- string )
-    vm-git-label CHAR: - over last-index head ;
+    vm-git-label "-" split1-last drop ;
 
 : vm-git-id ( -- string )
-    vm-git-label CHAR: - over last-index 1 + tail ;
+    vm-git-label "-" split1-last nip ;
 
 : vm-compiler ( -- string ) \ vm-compiler get-global ;