Skip to content

Commit

Permalink
fix: abort githubUrl if commit has not been pushed yet
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisgrieser committed Dec 15, 2024
1 parent 1f18850 commit 846fc41
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lua/tinygit/commands/github.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ function M.githubUrl(what)
if u.notInGitRepo() then return end
local repo = M.getGithubRemote()
if not repo then return end -- not on github
local alreadyPushed = u.syncShellCmd { "git", "branch", "--remote", "--contains", "HEAD" } ~= ""
if not alreadyPushed then
u.notify("Cannot open at GitHub, current commit has not been pushed yet.", "warn")
return
end

-- PARAMETERS
if not what then what = "file" end
Expand Down

0 comments on commit 846fc41

Please sign in to comment.