Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 349664 - Repository#getBranch() returns 'master' when the repo has no branches.
Summary: Repository#getBranch() returns 'master' when the repo has no branches.
Status: CLOSED WONTFIX
Alias: None
Product: JGit
Classification: Technology
Component: JGit (show other bugs)
Version: 1.0   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 349663
  Show dependency tree
 
Reported: 2011-06-17 05:29 EDT by Szymon Brandys CLA
Modified: 2011-06-18 05:32 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Szymon Brandys CLA 2011-06-17 05:29:04 EDT
Repository#getBranch() returns 'master' when the repo has no branches. I would expect to see 'null' or an exception.

Steps:
Try to clone git://github.com/bokowski/empty.git and check what the active branch is using #getBranch for it.
Comment 1 Robin Rosenberg CLA 2011-06-18 05:32:33 EDT
This is correct. The current branch IS master, but it has no commits and is therefore sometimes called and "unborn" branch. If you commit now, the commit will be created on the master branch.

If you want to see that the branch is unborn, just resolve it and you'll get a null.