Skip to content

Commit

Permalink
'git log': Print error message when current branch does not have any …
Browse files Browse the repository at this point in the history
…commits yet
  • Loading branch information
WithGJR committed Aug 20, 2021
1 parent 435f2b1 commit c669991
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/regit.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ func (regit *ReGit) Log() {
if head.PointsToBranch {
current_branch := NewBranch(head.Content, regit.RootDir)
current_branch.Read()
if len(current_branch.Commit()) == 0 {
fmt.Println("Error: your current branch '" + head.Content + "' does not have any commits yet")
os.Exit(1)
}
root_commit.ReadFromExistingObject(current_branch.Commit())
} else {
root_commit.ReadFromExistingObject(head.Content)
Expand Down

0 comments on commit c669991

Please sign in to comment.