Guest User

Untitled

a guest
Apr 26th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. /*
  2. Just playing around with ObjectiveGit.
  3.  
  4. MacRuby and Hotcocoa are kind of 'crashy' when I try using things like Grit or Buttons.
  5.  
  6. Gonna try building up the basic functionality that is available in my homebrew-web Rakefile here.
  7. Then work on importing everything into a proper Cocoa app.
  8.  
  9. */
  10.  
  11. #import "ObjGit.h"
  12.  
  13. int main (int argc, char const *argv[])
  14. {
  15. NSAutoreleasePool *pool = [NSAutoreleasePool new];
  16.  
  17. ObjGit *repo = [[ObjGit alloc] init];
  18.  
  19. if([repo openRepo:@"/usr/local/.git"] == TRUE){
  20. printf("Successfully opened Git repo!\n");
  21. printf("Git name: %s\n", [[repo gitName] cString]);
  22. printf("Object Count: %lu\n", [[repo getAllRefs] count]);
  23.  
  24. NSArray *refs = [repo getAllRefs];
  25.  
  26. unsigned int objectCount = [refs count];
  27. unsigned int index = 0;
  28.  
  29. for(index=0; index < objectCount; index += 1)
  30. {
  31. id collection = [refs objectAtIndex:index];
  32. printf("Object is: %s\n", [[collection objectAtIndex:0] cString]);
  33. printf("SHA is: %s\n", [[collection objectAtIndex:1] cString]);
  34. }
  35.  
  36. } else {
  37. printf("Could not open Git repo :(\n");
  38. }
  39.  
  40. [pool release];
  41. return 0;
  42. }
Add Comment
Please, Sign In to add comment