Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ pry
- [1] pry(main)> require 'rugged'
- => true
- [2] pry(main)> repo=Rugged::Repository.new '.'
- => #<Rugged::Repository:0xb70b9b4c>
- [3] pry(main)> author={ :email=>'[email protected]', :time=>Time.now, :name=>'Jeff Welling' }
- => {:email=>"[email protected]",
- :time=>Sat Sep 29 11:38:05 -0700 2012,
- :name=>"Jeff Welling"}
- [4] pry(main)> parents=[ repo.lookup( repo.head.target ).oid ]=> ["300febdd0d599ae44c529004fb438a25495750b3"]
- [5] pry(main)> puts `git status`# On branch master
- # Changes to be committed:
- # (use "git reset HEAD <file>..." to unstage)
- #
- # new file: second_fakefile
- #
- # Untracked files:
- # (use "git add <file>..." to include in what will be committed)
- #
- # fakedir/
- => nil
- [6] pry(main)> tree= repo.lookup( repo.index.write_tree )
- => #<Rugged::Tree:0xb709dd48
- @owner=
- #<Rugged::Repository:0xb70b9b4c
- @index=
- #<Rugged::Index:0xb709dd84 @owner=#<Rugged::Repository:0xb70b9b4c ...>>>>
- [7] pry(main)>
- [8] pry(main)> puts `git cat-file #{tree.oid}`
- usage: git cat-file (-t|-s|-e|-p|<type>|--textconv) <object>
- or: git cat-file (--batch|--batch-check) < <list_of_objects>
- <type> can be one of: blob, tree, commit, tag
- -t show object type
- -s show object size
- -e exit with zero when there's no error
- -p pretty-print object's content
- --textconv for blob objects, run textconv on object's content
- --batch show info and content of objects fed from the standard input
- --batch-check show info about objects fed from the standard input
- => nil
- [9] pry(main)> puts `git cat-file -p #{tree.oid}`
- 100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 fakefile
- 100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 second_fakefile
- => nil
- [10] pry(main)> x=Rugged::Commit.create( repo, :author=>author, :message=>"Hello world\n\n", :committer=>author, :parents=>parents, :tree=>tree )
- TypeError: wrong argument type nil (expected String)
- from (pry):9:in `create'
- [11] pry(main)>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement