RFR: 2335: Avoid creating unneeded objects

Pavel Rappo prappo at openjdk.org
Tue Jul 23 10:00:20 UTC 2024


On Mon, 22 Jul 2024 18:20:59 GMT, Zhao Song <zsong at openjdk.org> wrote:

>> This PR removes needless objects, some of which are resources. Removing those objects should have no effect.
>
> vcs/src/test/java/org/openjdk/skara/vcs/RepositoryTests.java line 745:
> 
>> 743:         try (var dir = new TemporaryDirectory()) {
>> 744:             var r = TestableRepository.init(dir.path(), vcs);
>> 745:             assertEquals(List.of(), r.branches());
> 
> I am just curious about the expected behavior when testing on a mercurial (hg) repository.
> 
> When I initialize a new hg repository and run `hg branch`, it returns "default". However, when I use `hg branches`, it returns empty. So is "default" branch ignored?

>From my experiments, Git (2.45.2) and Mercurial (6.8) behave identically in that regard. Here's a newly initialised Git repo:

    % git branch --list --all
    % git branch --show-current
    master
    %

It's only after I make the first commit to the default branch, be it Git or Mercurial, that branch shows up in the output.

-------------

PR Review Comment: https://git.openjdk.org/skara/pull/1680#discussion_r1687782133


More information about the skara-dev mailing list