Advertisement
Guest User

Untitled

a guest
Sep 29th, 2012
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. $ pry
  2. [1] pry(main)> require 'rugged'
  3. => true
  4. [2] pry(main)> repo=Rugged::Repository.new '.'
  5. => #<Rugged::Repository:0xb70b9b4c>
  6. [3] pry(main)> author={ :email=>'[email protected]', :time=>Time.now, :name=>'Jeff Welling' }
  7. => {:email=>"[email protected]",
  8. :time=>Sat Sep 29 11:38:05 -0700 2012,
  9. :name=>"Jeff Welling"}
  10. [4] pry(main)> parents=[ repo.lookup( repo.head.target ).oid ]=> ["300febdd0d599ae44c529004fb438a25495750b3"]
  11. [5] pry(main)> puts `git status`# On branch master
  12. # Changes to be committed:
  13. # (use "git reset HEAD <file>..." to unstage)
  14. #
  15. # new file: second_fakefile
  16. #
  17. # Untracked files:
  18. # (use "git add <file>..." to include in what will be committed)
  19. #
  20. # fakedir/
  21. => nil
  22. [6] pry(main)> tree= repo.lookup( repo.index.write_tree )
  23. => #<Rugged::Tree:0xb709dd48
  24. @owner=
  25. #<Rugged::Repository:0xb70b9b4c
  26. @index=
  27. #<Rugged::Index:0xb709dd84 @owner=#<Rugged::Repository:0xb70b9b4c ...>>>>
  28. [7] pry(main)>
  29. [8] pry(main)> puts `git cat-file #{tree.oid}`
  30. usage: git cat-file (-t|-s|-e|-p|<type>|--textconv) <object>
  31. or: git cat-file (--batch|--batch-check) < <list_of_objects>
  32.  
  33. <type> can be one of: blob, tree, commit, tag
  34. -t show object type
  35. -s show object size
  36. -e exit with zero when there's no error
  37. -p pretty-print object's content
  38. --textconv for blob objects, run textconv on object's content
  39. --batch show info and content of objects fed from the standard input
  40. --batch-check show info about objects fed from the standard input
  41.  
  42.  
  43. => nil
  44. [9] pry(main)> puts `git cat-file -p #{tree.oid}`
  45. 100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 fakefile
  46. 100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 second_fakefile
  47. => nil
  48. [10] pry(main)> x=Rugged::Commit.create( repo, :author=>author, :message=>"Hello world\n\n", :committer=>author, :parents=>parents, :tree=>tree )
  49. TypeError: wrong argument type nil (expected String)
  50. from (pry):9:in `create'
  51. [11] pry(main)>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement