import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import javax.annotation.CheckForNull;
import javax.annotation.concurrent.Immutable;
*/
@Immutable
public class ProjectBranches {
+ // matches server-side default when creating a project. See BranchDto#DEFAULT_MAIN_BRANCH_NAME
+ private static final String DEFAULT_MAIN_BRANCH_NAME = "master";
+
private final Map<String, BranchInfo> branches;
private final String defaultBranchName;
mainBranchName = branchName;
}
}
- this.defaultBranchName = mainBranchName;
+
+ this.defaultBranchName = Objects.requireNonNullElse(mainBranchName, DEFAULT_MAIN_BRANCH_NAME);
}
@CheckForNull