Repository navigation
Handle repositories with no commits - #533
Conversation
|
This is almost certainly going to collide a bunch with #524, but having the test cases in place will be helpful for not breaking this case moving forward. |
|
Coming along! Mostly now I'm deciding how to represent a detached HEAD in various bits of the UI, like the |
|
Okay, this now adapts to unborn and detached HEADs in what I think is a reasonable way. While you're on an unborn HEAD (a new repository), the only real change in behavior is that the "amend" control isn't rendered (well, and it doesn't spew errors into your console). When you're on a detached HEAD: |
| name: (await this.exec(['describe', '--contains', '--all', 'HEAD'])).trim(), | ||
| isDetached: true, | ||
| }; | ||
| } |
There was a problem hiding this comment.
☝️ This bit is done consistently with the way that git-prompt.sh decorates your PS1. A bit messy but it should be fairly robust?
|
@smashwilson I apologize, but do you mind updating to include the Yubikiri changes before I review? (Alternatively I can do it for you since it's my fault you have conflicts 😅) |
BinaryMuse
left a comment
There was a problem hiding this comment.
Another thought: could it be interesting to prompt a user (like Git does) if they make a detached commit and then change to a branch?
| branchName: React.PropTypes.string, | ||
| currentBranch: React.PropTypes.shape({ | ||
| name: React.PropTypes.string, | ||
| isDetached: React.PropTypes.bool, |
There was a problem hiding this comment.
Let's mark name and isDetached as .isRequired
| branchName: React.PropTypes.string, | ||
| currentBranch: React.PropTypes.shape({ | ||
| name: React.PropTypes.string, | ||
| isDetached: React.PropTypes.bool, |
There was a problem hiding this comment.
Same here (even better, extract this into prop-types.js)
There was a problem hiding this comment.
Done. Much cleaner 🎨
| branchName: React.PropTypes.string, | ||
| currentBranch: React.PropTypes.shape({ | ||
| name: React.PropTypes.string, | ||
| isDetached: React.PropTypes.bool, |
There was a problem hiding this comment.
Strong .gif game as always 😀
❤️ Well worth doing. I'll make a follow-on issue 👍 |




Gracefully handle repositories that have been freshly initialized and have no commits. You should be able to create that initial commit without 💥.
git symbolic-refto retrieve the current branch if HEAD is a symbolic reference.git describe --contains --allto retrieve a human-readable branch description.Fixes #217.