frostming / legit

Git for Humans, Inspired by GitHub for Mac™.
https://frostming.github.io/legit
BSD 3-Clause "New" or "Revised" License
5.7k stars 218 forks source link

Control errors when working on empty repo #272

Closed ramonpin closed 1 year ago

ramonpin commented 3 years ago

When we try to use legit over an initialized but empty repo it breaks with an stacktrace.

Now we control that the repo has at least one head and for 'undo' command also that we have at least two commits on the branch. This is needed because 'git reset' cannot work on empty repo or undo 'root' commit.

Also added a chore fix to remove pytest warnings about marks used but not registered.

weakish commented 1 year ago

The test coverage drops but since PR is from one year ago, I will merge it anyway.

A test for undo at a branch containing only one commit may be added later, as a separate pull request.