[SOLVED] How To Get RetroPie Commit Date
-
How can I get the "Last Commit" value on my system like on the RetroPie-Setup screen?
I found the RetroPie version number in
opt/retropie/VERSION
but I'm trying to reverse engineer the RetroPie-Setup script to figure out how it's getting commit date and I'm obviously missing something.I can see where the setup screen is outputting the commit variable
and I can see where the
commit
variable is being definedbut when I try to get the date using a simple bash script I'm getting something different than what shows up on my setup screen.
commit=$(git log -1 --pretty=format:"%cr (%h)") echo "Last Commit: $commit"
Last Commit: 4 months ago (d7f5016)
I'm assuming it's because I need to tell the git command to pull from a different file/directory? I don't know enough about git or RetroPie to know where that should be.
-
-
@meleu said in How To Get RetroPie Commit Date:
@obsidianspider
Did you try to execute?:git log -1 --pretty=format:"%cr (%h)"
;-)
Yes ;-)
$ git log -1 --pretty=format:"%cr (%h)" 4 months ago (d7f5016)
It seems to be pulling a date from something different than what the RetroPie setup screen is using.
-
@obsidianspider
I looked here: https://git-scm.com/docs/pretty-formats
And I think you can get what you want with this command:git log -1 --pretty=format:"%cD"
Description of some formats that might interest you:
'%cd': committer date (format respects --date= option) '%cD': committer date, RFC2822 style '%cr': committer date, relative '%ct': committer date, UNIX timestamp '%ci': committer date, ISO 8601-like format '%cI': committer date, strict ISO 8601 format
Hope it helps.
-
@meleu I think the problem is that I need to know what to run the
git
command against. -
It does it on the current git repository you are in - so what is your current directory ?
-
I got it!
I had to use the
--git-dir
parameter to tell git where to point and it looks like/home/pi/RetroPie-Setup/.git
is the right location (it matches what's in the RetroPie-Setup screen)commit=$(git --git-dir /home/pi/RetroPie-Setup/.git log -1 --pretty=format:"%cr (%h)") echo "Last Commit: $commit"
$ ./version.sh Last Commit: 11 days ago (a60c9b3)
-
@BuZz
git
is something I know very little about, but I think I figured out how to get the versioning. Thanks :)
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.