[gitalisk][repository] Add tracking branch detection in Gitalisk
Problem to Solve
The CoreGitaliskRepository needs the ability to detect which remote branch a local branch is tracking.
Proposal
- Add
get_tracking_branch_name()method to CoreGitaliskRepository in Rust - Implement tracking branch detection using git config commands to find upstream configuration
- Query
branch.<name>.mergeandbranch.<name>.remotegit config settings - Handle cases where no tracking branch is configured (return None/undefined)
- Return properly formatted remote branch reference (e.g., "origin/main")
- Expose method through NAPI bindings to Node.js as
getTrackingBranchName() - Update TypeScript definitions with new method
Further Details
Acceptance Criteria:
- Method returns tracking branch name when configured (e.g., "origin/main")
- Returns None/undefined when no tracking branch is configured
- Handles various remote configurations (origin, upstream, custom remotes)
- Proper error handling for repositories without remotes or invalid configurations
- Handles detached HEAD state appropriately
- Test coverage for different tracking branch scenarios
Implementation Notes:
- Use
git config branch.<current-branch>.mergeto get tracking branch reference - Use
git config branch.<current-branch>.remoteto get remote name - Combine remote name and branch reference for full tracking branch name
- Handle edge cases like missing remote or malformed configuration
Links / References
- Epic: Replace Repository Service with Gitalisk (gitlab-org/rust&14)