githug icon indicating copy to clipboard operation
githug copied to clipboard

Potential issue in checkout_tag.rb (level 34)

Open mamouneyya opened this issue 2 years ago • 0 comments

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

mamouneyya avatar Mar 26 '22 22:03 mamouneyya