Conversation
|
we don't have the whole git in the docker image |
|
Actually never mind the previous comment |
|
it is also possible to get the commit hash head just by reading the file .git/FETCH_HEAD |
|
if that works for you then that would be the simplest, yeah. anyway after having read https://dev.to/hasan_ashab/from-12gb-to-54mb-my-docker-image-went-on-a-diet-apj i'll always have concerns about the way images are built/huge... but that's not my problem :) relying on popen and spawning a git subprocess feels ugly, at least that's only done once at |
feels like poking in the git internals, that would be potentially fragile, no ? |
I guess just reading this file is okay, it is what probably does the rev-parse command |
|
soo... |
|
that's not a good idea, because FETCH_HEAD contains the sha of the fetched remotes, not necessarely the sha of the current worktree.. after a the next option is to read |
yes (mawk binded as awk) but i would keep the logic in python than depend on cmd installed on the system |
|
yeah that looks .. simpler than |
relies on 'git rev-parse HEAD' and thus the presence of the git command, and a repository..
this way no need for popen nor git binary show 'version inconnue' if we failed finding the ref
56bf1bc to
c1cd3c3
Compare
|
@jeanmi151 if you can retry this branch, i think i've handled most cases (sometimes .git/HEAD contains a commit sha when you've checked out a given tag) |
|
perfect ;) |

relies on
git rev-parse HEADand thus the presence of the git command, and a repository..requested by @fphg
@jeanmi151 how would that work for docker stuff ?