Search code examples
objective-cgitobjective-git

How to get file content with Objective-git from some specific commit?


Im using this code to get file content of commit:

 GTBlob *blob = [repo lookUpObjectBySHA:@"d39a07ef51533a32da4bf0474462a71a40dc59e4" objectType:GTObjectTypeBlob error:NULL];
        NSLog(@"Blob: %@",[blob content]);

where SHA - some specific commit. But I always get the latest version of this file. What Im doing wrong ?


Solution

  • I found, that to get file in some past states you need:

    get GTTree from GTCommit, then get GTTreeEntry from GTTree and after that get GTBlob as GTObject via objectWithTreeEntry:GTTreeEntry