Skip to content

Commit 7ed2bae

Browse files
committed
Document the UTF-8 encoding of names and link targets
Git and SWHID treat file names and symbolic link targets as bytes with no defined encoding, and this class encodes both as UTF-8, so its identifiers match theirs only when the originals were UTF-8. The paragraph is the one proposed in the review, with link targets added.
1 parent 052af8a commit 7ed2bae

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎src/main/java/org/apache/commons/codec/digest/GitIdentifiers.java‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939
* <p>When the hash algorithm is SHA-1, the identifiers produced by this class are identical to those used by Git.
4040
* Other hash algorithms produce generalized identifiers as described by the SWHID specification.</p>
4141
*
42+
* <p>Git and SWHID treat file names and symbolic link targets as opaque byte sequences with no defined encoding. The
43+
* identifiers produced here coincide with Git's or SWHID's own identifiers only if the original names and targets were
44+
* UTF-8 encoded.</p>
45+
*
4246
* <p>This class is immutable and thread-safe. However, the {@link MessageDigest} instances passed to it generally won't be.</p>
4347
*
4448
* @see <a href="https://git-scm.com/book/en/v2/Git-Internals-Git-Objects">Git Internals – Git Objects</a>

0 commit comments

Comments
 (0)