RFR: 2163: Add API to Repository for working "git notes"
Erik Duveblad
ehelin at openjdk.org
Tue Jan 30 12:59:44 UTC 2024
On Tue, 30 Jan 2024 00:15:47 GMT, Zhao Song <zsong at openjdk.org> wrote:
>> Hi all,
>>
>> please review this patch that adds the methods `addNote`. `notes` and `pushNotes` to `Repository.java` to allow Skara code to work with [git notes](https://git-scm.com/docs/git-notes). This will be used in another patch to implement a "git note"-notifier (see https://bugs.openjdk.org/browse/SKARA-2164).
>>
>> I opted for a fairly minimal API here even though the `git notes` command exposes many more features. I also decided to add the `pushNotes` method although callers could use the `push(String refspec, URI uri)` variant because I don't like the notes refspec to "leak" out into other parts of the code.
>>
>> Also added a couple of unit tests.
>>
>> Thanks,
>> Erik
>
> vcs/src/main/java/org/openjdk/skara/vcs/Repository.java line 195:
>
>> 193:
>> 194: void addNote(Hash hash,
>> 195: List<String> note,
>
> Just out of curiosity, is there a specific reason for using `List<String>` in the interface and then concatenating the list? Why not use `String` directly?
I just think it is more clear for a user of the API how lines are handled. If the method accepts `String hash` then it is (to me) harder to know if the API supports a single line or multiple lines (and the caller is responsible for inserting `\n` characters). With `List<String>` it is to me more clear, although I could have named the parameter `lines` to make it obvious 😄
-------------
PR Review Comment: https://git.openjdk.org/skara/pull/1607#discussion_r1471164109
More information about the skara-dev
mailing list