JGit how do i get the SHA1 from a RevCommit?
Do note that getName()
only works with SHA-1 repositories: JGit does not yet work with SHA-256 repositories.
That is why, for instance, Git 2.30 (Q1 2021) does mark the tests that uses JGit not to run unless we are testing with ShA-1 repositories.
See commit ea699b4 (13 Nov 2020) by SZEDER Gábor (szeder
).
(Merged by Junio C Hamano -- gitster
-- in commit d302170, 25 Nov 2020)
t5310-pack-bitmaps
: skip JGit tests with SHA256Signed-off-by: SZEDER Gábor
Reviewed-by: Taylor Blau
In 't5310-pack-bitmaps.sh' two tests make sure that our pack bitmaps are compatible with JGit's bitmaps.
Alas, not even the most recent JGit version (5.9.0.202009080501-r) supports SHA256 yet, so when this test script is run withGIT_TEST_DEFAULT_HASH=sha256
on a setup with JGit installed inPATH
, then these two tests fail.Protect these two tests with the SHA1 prereq in order to skip them when testing with SHA256.
RevCommit
inherits from AnyObjectId
which has a getName
function.
getName
public final String getName()
Returns:
string form of the SHA-1, in lower case hexadecimal.