I have on occasion wondered if it really makes sense to READ the
version files, instead of just using READ-LINE or something. Now I
know why READ is good. :)
#.(flet ((git (command &rest args)
(sb-ext:run-program "/path/to/git" (cons command args)
(format nil "~A.~A~@[-dirty~]"
(with-input-from-string (s (git "branch"))
(loop for line = (read-line s)
when (eql #\* (char line 0))
return (subseq line 2)))
(count #\newline (git "rev-list" "HEAD...master"))
(plusp (length (git "diff" "HEAD")))))
Assuming your tree is a gitified one, this gives you
with an additional -dirty postfix if there are uncommitted changes.
(This is pretty much the first version of this I cooked up, so there
are uncommon edge-cases this doesn't handle, more things one might
want to do, or better ways to pull this information -- but #. in
branch-version.lisp-expr is the big idea I wanted to share, this is
just an example of what to do with it.)
Get latest updates about Open Source Projects, Conferences and News.