Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git-browse doesn't check if a commit exists on upstream #1153

Open
mattcen opened this issue Aug 8, 2024 · 2 comments · May be fixed by #1155
Open

git-browse doesn't check if a commit exists on upstream #1153

mattcen opened this issue Aug 8, 2024 · 2 comments · May be fixed by #1155

Comments

@mattcen
Copy link

mattcen commented Aug 8, 2024

When using git-browse to generate a web link to a repo, it constructs a URL based on the commit at the HEAD of the local repo, but doesn't actually check if this HEAD exists on the remote. This means that if I have a local commit that I've yet to push, and I run git-browse, it will fail because the remote end doesn't know about the commit the URL references.

Ideally, we should test whether the commit exists upstream first, using:

git branch --remotes --contains "${commit_or_branch}" 2>/dev/null | grep -q "\<${remote}\>/"

Which will exit non-zero if there's no remote ref for this commit. We could then display an error to the user.

@spacewander
Copy link
Collaborator

LGTM. Would you submit this change?

@mattcen
Copy link
Author

mattcen commented Aug 10, 2024

Sure. See #1155

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants