build: name the revision without Git where there is no Git 6b218d3faaaf
GIT_REV asked Git unconditionally. Outside a Git checkout (an Oxygen
workspace, as on narvi, or a Flow job's workspace) every compile then
printed Git's usage text, 36 lines of it containing "warning", before
falling back:
warning: Not a git repository. Use --no-index to compare two paths outside a working tree
usage: git diff --no-index [<options>] <path> <path>
which buried the compiler's own output in the build log, and the
version string read "0000000+".
Git is now asked only inside a Git work tree, with the same command as
before. Otherwise `oxy describe` names the state (riscv-1-ffa902be), and
where neither exists the revision is 00000000. Checked in all three: a
Git checkout still gives da994445.
- Author
- Andy McCall @andymccall <[email protected]>
- via
- agent
agent:claude@andymccall <[email protected]> · keyless, under your grant for changes,refs,seal · key d6ea60db88d4
- When
- · 2026-10-20 23:53 UTC
- Signature
- ◈ sealed by agent:claude@andymccall
- Hash
6b218d3faaaffff04280826be759421e92e7922d09c3662a9194a316c9c5d750- Depends on
- 03a3459e6372
- Depended on by
- nothing yet
- In bookmarks
- main riscv-1
- Edits
- 2 atoms, 0 tree operations, 1 file
Browse the tree at this change
modified Makefile +6 −0
| … | 36 unchanged lines |
||
| 37 | 37 | X16_OUTPUT=x16emu |
|
| 38 | 38 | MAKECART_OUTPUT=makecart |
|
| 39 | 39 | ||
| 40 | + | # The revision: Git's in a Git checkout, `oxy describe` in an Oxygen one, |
|
| 41 | + | # otherwise zeros (a source tarball, or a CI workspace with neither). |
|
| 42 | + | ifeq ($(shell git rev-parse --is-inside-work-tree 2>/dev/null),true) |
|
| 40 | 43 | GIT_REV=$(shell git diff --quiet && /bin/echo -n $$(git rev-parse --short=8 HEAD || /bin/echo "00000000") || /bin/echo -n $$( /bin/echo -n $$(git rev-parse --short=7 HEAD || /bin/echo "0000000"); /bin/echo -n '+')) |
|
| 44 | + | else |
|
| 45 | + | GIT_REV=$(shell oxy describe 2>/dev/null || /bin/echo -n "00000000") |
|
| 46 | + | endif |
|
| 41 | 47 | ||
| 42 | 48 | CFLAGS+=-D GIT_REV='"$(GIT_REV)"' |
|
| 43 | 49 | ||
| … | 102 unchanged lines |