Skip to content

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

@mamouneyya

Description

@mamouneyya

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions