Search for Branch entity definition and author logic #3105
Zak Siddiqui opened 2 days ago

Look at the core model for Branch in onedev/server to understand current authorship tracking

  • Service Desk commented 2 days ago

    I traced this through the core model and Git event flow.

    There is no persistent Branch entity/table in OneDev. A branch is represented by a Git ref (refs/heads/<name>), exposed at runtime as RefFacade. RefFacade contains the ref name plus the referenced/peeled Git objects; it has no creator, owner, or author field. Project.getBranchRefs() obtains these refs from GitService.

    The author information shown on the Branches page is the author of the current tip commit, not the user who created the branch. The page reads the tip RevCommit and displays its Git author and, when different, committer. A Git identity is linked to a OneDev user only when its email matches one of that user’s verified email addresses. Commit queries such as authored by me use the same verified-email association.

    The authenticated actor who pushes a ref can be attached to the transient RefUpdated event. Receive-hook updates populate it from the authenticated OneDev user, and branch-update triggers use that value for “pushed by” matching. However, this is event context rather than durable branch metadata, and some internal createBranch paths emit the event without a user. Issue-named branch creation converts that event into an IssueBranchCreated event and falls back to the system user when the actor is absent.

    So the current model cannot reliably answer “who created/owns this branch” after creation. It can answer who authored/committed the tip commit, and event consumers can sometimes know who performed a particular ref update. Durable branch authorship would require separately persisted branch metadata or an audit record keyed by project and full ref name.

  • Zak Siddiqui 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-3105
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover