Gazler / githug

Git your game on!
MIT License
6.84k stars 1.03k forks source link

Potential issue in checkout_tag.rb (level 34) #318

Open mamouneyya opened 2 years ago

mamouneyya commented 2 years ago

If you checkout the tag v1.2 in this level, there will be 3 commits only in the history:

  repo.init
  FileUtils.touch("app.rb")
  repo.add("app.rb")
  repo.commit_all("Initial commit")

  `echo "Some code" >> app.rb`
  repo.add("app.rb")
  repo.commit_all("Some changes")
  repo.git.tag( { 'f' => true }, "v1.0" )

  `echo "Buggy code" >> app.rb`
  repo.add("app.rb")
  repo.commit_all("Some more changes")
  repo.git.tag( { 'f' => true }, "v1.2" )

Hence, shouldn't the count here be 3 instead of 5:

solution do
  return false unless repo.commits.length == 5
  //...

I couldn't pass the level until I created 2 more empty commits with the same message (since there's another check for the last commit's message).

Am I missing something?

Edit: Same for next level: checkout_tag_over_branch.rb