You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
commits off detached HEAD should not be linkable #1478
We need to be better at handling detached HEAD and getting people back to a happy place, but this is some low-hanging fruit around ensuring we detect unpublished commits correctly and not linking off to GitHub (because they aren't there).
Version
GitHub Desktop version: 0.5.1
OS version: macOS Sierra 10.12.4
Steps to Reproduce
Create a new repository locally with some initialized results (so you have a commit created)
Create another commit, so you have two of them
Publish the repository to GitHub
Launch Repository -> Open in Terminal to open the repository in a shell
Move the repository back to the first commit: git checkout HEAD~1
Create a new file touch FOO.md
Switch back to the application and commit this change
Switch to the History tab, and select the first commit
Expected behaviour: commit should not be linkable
Actual behaviour: it's totally linkable
Reproduces how often: 100%
Additional Information
This isn't urgent, but implementing it might help us understand more about how to work better with repositories in a detached HEAD state.
If this exists in any of the refs in the remote, this will emit one or more rows of text. If not, the stdout will be empty. This can be rather expensive if a repository has a lot of refs, so I would be careful with it's usage (defer it until you're displaying the commit details?).
Activity
shiftkey commentedon Jul 26, 2017
While the commit view has changed a bit, the new View on GitHub button should not be visible for an unpublished commit like this:
Repro steps:
git checkout HEAD~1shiftkey commentedon Feb 14, 2018
This came up in a chat with @iAmWillShepherd and I got to thinking about it again and realised we have a way out of this.
If your repository is up to date, you can run this command to see if a SHA exists on a given remote:
If this exists in any of the refs in the remote, this will emit one or more rows of text. If not, the
stdoutwill be empty. This can be rather expensive if a repository has a lot of refs, so I would be careful with it's usage (defer it until you're displaying the commit details?).Disable GitHub links for commits no remote has