Description
In #1307 a tooltip was added for SUBMODULES in the left sidebar, showing the current SHA and submodule URL.
This tooltip also shows a status indication icon/badge : normal
, not initialized
, modified
, revision changed
, unmerged
.
(Of these, the modified
indication is based on a single extra call to git status
, checking only those submodules that are initially detected as normal
. It does NOT show untracked/unstaged changes, due to the -uno
flag being used.)
In addition to the above info in the submodule tooltip, it would be very helpful if it could also show the Author
, Timestamp
and Subject
of the current submodule commit. (This would make it much easier to determine if the submodule is "pointing at" the intended commit in the sub-repo.)
That info could be requested in QuerySubmodules
for all the submodules at once, using a single extra call to a variant of git submodule
:
git submodule foreach -q 'git log HEAD -1 --format="$sm_path;%aN;%at;%s" || :'
The above command outputs a single-line like this for each submodule:
<submodule-path>;<author-name>;<author-timestamp>;<subject>
Notes on the above command :
- Uninitialized (not checked-out) submodules will be ignored by this command.
- The '
|| :
' at the end of the "inner" command is added (as recommended in the Git docs) to avoid terminating theforeach
processing if the "inner" command returns non-zero. - The '
$sm_path
' variable is one of a few provided by thegit submodule foreach
command. - The '
;
' separator can be changed to any separator character/string of choice.