Investigate Branch model in onedev/server source code #3108
Zak Siddiqui opened 2 days ago

Need to find the Branch.java model and understand how branch ownership/author is tracked today. Also check if there are any existing 'isDraft' or unnamed-related concepts already implemented.

  • Service Desk commented 2 days ago

    I found no Branch.java or persistent Branch entity in the current non-commercial server source.

    Current representation and identity handling:

    • Branches are native Git refs under refs/heads/. Project.getBranchRefs() obtains them from GitService, and RefFacade contains only the ref name plus the referenced/peeled Git objects.
    • The repository REST API likewise exposes a branch as refName and tip commitHash; it does not expose an owner or creator.
    • The branches page displays the tip commit author/committer via ContributorPanel. That is commit authorship, not branch ownership.
    • A Git push creates a RefUpdated event carrying the authenticated OneDev user, so listeners can identify who performed that update. This is event context, not durable per-branch metadata. Server-side branch creation through GitService.createBranch(...) emits the event without a user.
    • Branch authorization is evaluated from project permissions and branch protection rules for the acting user; it is not based on an owner field.
    • Issue-to-branch association is also not persisted on a branch model. Issue.getBranch() scans refs and recognizes the issue-<number>[-<title>] naming convention.

    I also found no branch-related isDraft, getDraft, setDraft, or equivalent draft field. Branch names are required and validated as Git ref names, so there is no unnamed-branch state. The few source occurrences of “unnamed” or “draft” are unrelated infrastructure/UI-library terminology.

    So if branch ownership, draft branches, or unnamed placeholders are needed, they would be new persisted metadata rather than extensions to an existing branch model.

  • Service Desk changed state to 'Closed' 2 days ago
    Previous Value Current Value
    Open
    Closed
1/1
Type
Question
Priority
Normal
Assignee
Labels
No labels
Issue Votes (0)
Watchers (3)
Reference
OD-3108
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover