Created
April 30, 2011 03:47
-
-
Save runemadsen/949382 to your computer and use it in GitHub Desktop.
Grit inconsistensy?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ree-1.8.7-2011.03 :003 > include Grit | |
=> Object | |
ree-1.8.7-2011.03 :004 > | |
ree-1.8.7-2011.03 :005 > # create repo | |
ree-1.8.7-2011.03 :006 > r = Repo.init_bare 'myrepo.git' | |
=> #<Grit::Repo "/Users/Rune/Projects/versionize/irbtest/myrepo.git"> | |
ree-1.8.7-2011.03 :007 > i = r.index | |
=> #<Grit::Index:0x101eb7880 @repo=#<Grit::Repo "/Users/Rune/Projects/versionize/irbtest/myrepo.git">, @tree={}, @current_tree=nil> | |
ree-1.8.7-2011.03 :008 > | |
ree-1.8.7-2011.03 :009 > # first commit to master | |
ree-1.8.7-2011.03 :010 > i.add('myfile.txt', 'my file contents') | |
=> "my file contents" | |
ree-1.8.7-2011.03 :011 > i.commit("This is my commit") | |
=> "658610298015d496c7e47e2fc42b3aa37531a52c" | |
ree-1.8.7-2011.03 :012 > | |
ree-1.8.7-2011.03 :013 > # second commit to master | |
ree-1.8.7-2011.03 :014 > i.read_tree("master") | |
=> #<Grit::Tree "master"> | |
ree-1.8.7-2011.03 :015 > i.add('myfile2.txt', 'my file 2 contents') | |
=> "my file 2 contents" | |
ree-1.8.7-2011.03 :016 > i.commit("This is my second commit", [r.commit("master")]) | |
=> "e14deeaafad97de36e2672d23200b69db8c145bd" | |
ree-1.8.7-2011.03 :017 > | |
ree-1.8.7-2011.03 :018 > # first commit to newbranch | |
ree-1.8.7-2011.03 :019 > i.read_tree("master") | |
=> #<Grit::Tree "master"> | |
ree-1.8.7-2011.03 :020 > i.add('myfile3.txt', 'my file 3 contents') | |
=> "my file 3 contents" | |
ree-1.8.7-2011.03 :021 > i.commit("This is my third commit", [r.commit("master")], nil, nil, 'newbranch') | |
=> "aa500abb71f4d7042c367e2924f561e2320cbeef" | |
ree-1.8.7-2011.03 :022 > | |
ree-1.8.7-2011.03 :023 > # Add another commit to this branch | |
ree-1.8.7-2011.03 :024 > i.read_tree("newbranch") | |
=> #<Grit::Tree "newbranch"> | |
ree-1.8.7-2011.03 :025 > i.add('myfile4.txt', 'my file 4 contents') | |
=> "my file 4 contents" | |
ree-1.8.7-2011.03 :026 > i.commit("This is my fourth commit", [r.commit("newbranch")], nil, nil, 'newbranch') | |
=> "2dff7818721fa4258d48e67cef60f214368c452c" | |
ree-1.8.7-2011.03 :027 > | |
ree-1.8.7-2011.03 :028 > # get commits | |
ree-1.8.7-2011.03 :029 > r.commits # commits for master | |
=> [#<Grit::Commit "658610298015d496c7e47e2fc42b3aa37531a52c">, #<Grit::Commit "e14deeaafad97de36e2672d23200b69db8c145bd">] | |
ree-1.8.7-2011.03 :030 > r.commits.first | |
=> #<Grit::Commit "658610298015d496c7e47e2fc42b3aa37531a52c"> | |
ree-1.8.7-2011.03 :031 > r.commits_between("master", "newbranch") | |
=> [#<Grit::Commit "aa500abb71f4d7042c367e2924f561e2320cbeef">, #<Grit::Commit "2dff7818721fa4258d48e67cef60f214368c452c">] | |
ree-1.8.7-2011.03 :032 > r.log | |
=> [#<Grit::Commit "e14deeaafad97de36e2672d23200b69db8c145bd">, #<Grit::Commit "658610298015d496c7e47e2fc42b3aa37531a52c">] | |
ree-1.8.7-2011.03 :033 > r.commit("master") | |
=> #<Grit::Commit "e14deeaafad97de36e2672d23200b69db8c145bd"> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment