Sha256: 568652a0bdef1ce39290f6705cd200c7dc0cfb4b7ab3e890fa45098cfbde4b87

Contents?: true

Size: 779 Bytes

Versions: 2

Compression:

Stored size: 779 Bytes

Contents

difficulty 3
description "You forgot to branch at the previous commit and made a commit on top of it. Create branch 'test_branch' at the commit before the last" 

setup do
  repo.init
  FileUtils.touch("file1")
  repo.add("file1")
  repo.commit_all("Adding file1")
  File.open("file1", 'w') { |f| f.write("content") }
  repo.add("file1")
  repo.commit_all("Updating file1")
  File.open("file1", 'a') { |f| f.write("\nAdding some more text") }
  repo.add("file1")
  repo.commit_all("Updating file1 again")
end

solution do
  solved = false
  solved = true if repo.branches.map(&:name).include?("test_branch") and (repo.commits("test_branch").last.message ==  "Updating file1")
  solved
end

hint do
  puts "Just like creating a branch, but you have to pass an extra argument"
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
githug-0.1.7 levels/branch_at.rb
githug-0.1.6 levels/branch_at.rb