zephyrproject-rtos/west

Still difficult to tell for which repos HEAD == manifest-rev in `west compare`

marc-hb opened this issue · 1 comments

In very recent #643 I made the initial suggestion to add git log --oneline -n 1 --decorate manifest-rev in the brand new (and awesome) west compare command to make it possible to see whether HEAD == manifest-rev. Now I'm realizing it's much better than nothing but still very far ideal because the mental process to check whether HEAD == manifest-rev is inconsistent hence error-prone.

For instance try for i in modules/*/*; do touch $i/foo; done and then west compare.

Some repos appear like this:

--- manifest-rev: 
0d225ddd3143 (HEAD, manifest-rev) zephyr: update include paths to use <zephyr/...>
--- status:
HEAD detached at refs/heads/manifest-rev

Others like this

--- manifest-rev: 
7fcde7cfe818 (HEAD, manifest-rev)  app: zephyr still requires c...
--- status:
HEAD detached at 7fcde7cfe818

Others like this

--- manifest-rev: 
93b5d5f2ad44 (HEAD, tag: 1.8.1, manifest-rev) Version 1.8.1
--- status:
HEAD detached at 93b5d5f2ad44

Others like this

--- manifest-rev: 
343b6d863da5 (HEAD -> mybranch, manifest-rev) Revert "config:tgl/tglh: Do not set cached/uncached address aliases"
--- status:
    On branch mybranch

HEAD == manifest-rev is true for ALL the above repos yet they all look different so none clearly stands out from the other ones where HEAD != manifest-rev

So there is no simple, instant visual check for HEAD == manifest-rev right now.

I have an idea inspired by git submodules:

git diff some_submodule

--- a/some_submodule
+++ b/some_submodule
@@ -1 +1 @@
-Subproject commit 9643a986dda97c6cb339d5c75c0eaa178d8317da
+Subproject commit 808b4b85b74dbd57bc04b9368f1c6b5fd0bac239

So I think west could/should do something like this:

    if HEAD != manifest-rev~0:
        git status -n 1 --oneline --decorate manifest-rev # SHA1 in RED
        git status -n 1 --oneline --decorate HEAD         # SHA1 in GREEN

Showing this:

<red>  1851950977d5</red>   (manifest-rev) drivers: dmic: clear MIC_MUTE bit for ACE
<green>afd00256ccf0</green> (HEAD -> master) Revert "arch: xtensa: Fix xtensa error handler"

As a bonus, this would make the start of some modules stand out more and partly help solve