0

Is there a way in Git to have a nice commit graph like this gives,

git log --graph --oneline --all --decorate

But with additional information, which would be retrieved from a custom executable?

Something like:

* 69f1774e fix: RD-5673 message ...
*   7174524f [DEPLOYED-DEV1] (origin/master, origin/HEAD, master) 
|\
| * 7912bf16 [TESTS OK] fix: RD-5673 ...
| * 916800f7 [FAILED 12]fix: RD-5673 ...
|/
*   9b58498e [DEPLOYED-EUROPE] Merge branch 'feature/RD-5673-seed-the-legacy-ID-generators' into 'master'
|\
...

Use cases:

  • I would like to know for each commit whether it has been built by the continuous integration, and whether the resulting artifact / image has been pushed;

  • The log could display labels for the commits which are currently deployed in production environments.

I looked at --pretty=... but that one seems not to have anything dynamic. Or does it?

1
  • No. I can’t find any formatting options for executables. Commented Nov 26, 2024 at 20:22

1 Answer 1

1

For labels on what is deployed in various environments this should be possible to achieve with plain labels. The deployment step just needs to create/update the label and push it.

For info on if a commit is tested or not you can look at how git test is using git notes to store its test result.

The following example project

$ mkdir /tmp/so
$ cd /tmp/so     
$ git init
Initialized empty Git repository in /tmp/so/.git/
$ touch .gitignore
$ git add .gitignore 
$ git commit -m .gitignore 
[main (root-commit) a9c37f1] .gitignore
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 .gitignore
$ git commit --allow-empty -m c1
[main c188f60] c1
$ git commit --allow-empty -m c2
[main a63c75a] c2
$ git commit --allow-empty -m c3
[main 73068f1] c3
$ git test add -t dummy-test /bin/true 
$ git test run -t dummy-test c188f60..main

...

a63c75a64fa913d5c9be85b2a82bd4fa141198d5^{tree} good
Marked tree a63c75a64fa913d5c9be85b2a82bd4fa141198d5^{tree} to be good for test dummy-test
73068f1aeaf8d8423cb545fa7aba9a85b27ed20a^{tree} known-good
Tree 73068f1^{tree} is already known to be good for test dummy-test.

ALL dummy-test TESTS SUCCESSFUL
$ gitk --all &
[1] 2356370
$

will generate the following screenshot with gitk:

gitk screenshot

where you can see the additional notes stored (Notice that git test stores notes from tree objects and not commits but that should not be impossible to do instead).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.