]> git.ipfire.org Git - thirdparty/git.git/commit
builtin/cat-file: let the oid determine the output algorithm
authorEric W. Biederman <ebiederm@xmission.com>
Mon, 2 Oct 2023 02:40:27 +0000 (21:40 -0500)
committerJunio C Hamano <gitster@pobox.com>
Mon, 2 Oct 2023 21:57:40 +0000 (14:57 -0700)
commitd6222a2d05c93b22d5ef19b7361f7b1ef2964eb4
tree3ea25fc1bc7bdb7191b92cf17540651d663da9e4
parentd7446c89b8ed57f1fa0a5b2ea5e4b7e5fcb7d9cd
builtin/cat-file: let the oid determine the output algorithm

Use GET_OID_HASH_ANY when calling get_oid_with_context.  This
implements the semi-obvious behaviour that specifying a sha1 oid shows
the output for a sha1 encoded object, and specifying a sha256 oid
shows the output for a sha256 encoded object.

This is useful for testing the the conversion of an object to an
equivalent object encoded with a different hash function.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/cat-file.c