Git Product home page Git Product logo

objective-git's Introduction

ObjectiveGit

Carthage compatible Build Status

ObjectiveGit provides Cocoa bindings to the libgit2 library, packaged as a dynamic framework for OS X and iOS 8 or better.

Features

A brief summary of the available functionality:

  • Read: log, diff, blame, reflog, status
  • Write: init, checkout, commit, branch, tag, reset
  • Internals: configuration, tree, blob, object database
  • Network: clone, fetch, push, pull
  • Transports: HTTP, HTTPS, SSH, local filesystem

Not all libgit2 features are available, but if you run across something missing, please consider contributing a pull request!

Many classes in the ObjectiveGit API wrap a C struct from libgit2 and expose the underlying data and operations using Cocoa idioms. The underlying libgit2 types are prefixed with git_ and are often accessible via a property so that your application can take advantage of the libgit2 API directly.

The ObjectiveGit API makes extensive use of the Cocoa NSError pattern. The public API is also decorated with nullability attributes so that you will get compile-time feedback of whether nil is allowed or not. This also makes the framework much nicer to use in Swift.

Getting Started

Xcode

ObjectiveGit requires Xcode 7 or greater to build the framework and run unit tests. Projects that must use an older version of Xcode can use Carthage to install pre-built binaries or download them manually.

Other Tools

Simply run the script/bootstrap script to automatically install dependencies needed to start building the framework. This script uses Homebrew to install these tools. If your Mac does not have Homebrew, you will need to install the following manually:

  • cmake
  • libtool
  • autoconf
  • automake
  • pkg-config
  • libssh2
    • symlinks: lib/libssh2.a include/libssh2.h include/libssh2_sftp.h include/libssh2_publickey.h

To develop ObjectiveGit on its own, open the ObjectiveGitFramework.xcworkspace file.

Installation

There are three ways of including ObjectiveGit in a project:

  1. Carthage <-- recommended
  2. Manual
  3. Subproject

Carthage

  1. Add ObjectiveGit to your Cartfile.
github "libgit2/objective-git"
  1. Run carthage update.
  2. Mac targets
  • On your application targets' "General" settings tab, in the "Embedded Binaries" section, drag and drop the ObjectiveGit.framework from the Carthage/Build/Mac folder on disk.

Embedded Binaries

  1. iOS targets
  • On your application targets' "General" settings tab, in the "Linked Frameworks and Libraries" section, drag and drop the ObjectiveGit.framework from the Carthage/Build/iOS folder on disk. Linked Frameworks

  • On your application targets' "Build Phases" settings tab, click the “+” icon and choose “New Run Script Phase”. Create a Run Script with the following contents:

/usr/local/bin/carthage copy-frameworks

and add the paths to the frameworks you want to use under “Input Files”, e.g.:

$(SRCROOT)/Carthage/Build/iOS/ObjectiveGit.framework

Carthage Copy Frameworks

  1. Commit the Cartfile.resolved

  2. Under “Build Settings”, add the following to “Header Search Paths”: $(SRCROOT)/Carthage/Build/iOS/ObjectiveGit.framework/Headers/ to avoid git2/filter.h file not found errors.

The different instructions for iOS works around an App Store submission bug triggered by universal binaries.

Copying debug symbols for debugging and crash reporting

dSYM files are not currently included in the GitHub release zip files. You will need to pass --no-use-binaries to carthage in order to build locally and generate the dSYM files alongside the framework.

  1. On your application target's "Build Phases" settings tab, click the "+" icon and choose "New Copy Files Phase".
  2. Click the “Destination” drop-down menu and select "Products Directory".
  3. Drag and drop the ObjectiveGit.framework.dSYM file from Carthage/Build/[platform] into the list.

Copy dSYM Files

Manual

  1. Download the latest ObjectiveGit.framework.zip from releases.
  2. Unzip the file.
  3. Follow the Carthage instructions #3 or #4, depending on platform.

Note that the iOS framework we release is a "fat" framework containing slices for both the iOS Simulator and devices. This makes it easy to get started with your iOS project. However, Apple does not currently allow apps containing frameworks with simulator slices to be submitted to the app store. Carthage (above) already has a solution for this. If you're looking to roll your own, take a look at Realm's strip frameworks script.

Subproject

Examples

  1. Add ObjectiveGit as a submodule to your project:
git submodule add https://github.com/libgit2/objective-git.git External/ObjectiveGit
  1. Run script/bootstrap.
  2. Drag the ObjectiveGitFramework.xcodeproj file into the Project Navigator pane of your project.
  3. Add ObjectiveGit-Mac or ObjectiveGit-iOS as a target dependency of your application, depending on platform.
  4. Link your application with ObjectiveGit.framework.
  5. Set the “Header Search Paths” (HEADER_SEARCH_PATHS) build setting to the correct path for the libgit2 headers in your project. For example, if you added the submodule to your project as External/ObjectiveGit, you would set this build setting to External/ObjectiveGit/External/libgit2/include. If you see build errors saying that git2/filter.h cannot be found, then double-check that you set this setting correctly.
  6. Add a new "Copy Files" build phase, set the destination to "Frameworks" and add ObjectiveGit.framework to the list. This will package the framework with your application as an embedded private framework.
  • It's hard to tell the difference between the platforms, but the Mac framework is in build/Debug whereas the iOS framework is in build/Debug-iphoneos
  1. Don't forget to #import <ObjectiveGit/ObjectiveGit.h> or @import ObjectiveGit; as you would with any other framework.

Contributing

  1. Fork this repository
  2. Make it awesomer (preferably in a branch named for the topic)
  3. Send a pull request

All contributions should match GitHub's Objective-C coding conventions.

You can see all the amazing people that have contributed to this project here.

License

ObjectiveGit is released under the MIT license. See the LICENSE file.

objective-git's People

Contributors

5sw avatar aidansteele avatar alanjrogers avatar alehed avatar ben avatar bigboybad avatar boidanny avatar ctimmerm avatar davedelong avatar diederich avatar dleehr avatar isaac avatar jmah avatar joshaber avatar joshvera avatar jrgoodle avatar jspahrsummers avatar mdiep avatar onecrayon avatar pbendersky avatar phatblat avatar pietbrauer avatar robrix avatar rowanj avatar rwilcox avatar sagmor avatar slavikus avatar tclem avatar tiennou avatar wilshipley avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

objective-git's Issues

Checkout branch or commit

Is it possible to checkout the whole branch or particular commit?

I saw that libgit2 had checkout.h but couldn't find anything in Objective-Git

iOS build is broken

The iOS build is broken. First some classes aren't a member of the "Objectiv-Git-iOS" target. The deployment target is also too low for ARC. I played a bit around and was able to fix these issues, but encountered a few others. I stopped because there are a few open pull requests which might solve the problems. (I didn't check them out, just read their titles)

Can't get integrated with iOS & Xcode 4.2

I have followed all of the steps in the documentation. I still can't seem to get this project to work.

Here are the steps I've followed:

  1. Dragged the ObjectiveGitFramework.xcodeproj file to the Navigator of my Project (I know the documentation says to drag ObjectiveGit.xcodeproj, but there isn't one)
  2. Added "ObjectiveGit-iOS" as a Target Dependencies
  3. Added "ObjectiveGit" to Link Binary With Libraries

I'm creating a GitHelper File that does tasks throughout my application. So I've put #import <ObjectiveGit/ObjectiveGit.h> in the header file of the helper.

Two Issues:

When Archiving I get:

In my project: Lexical or Preprocessor Error "ObjectiveGit/ObjectiveGit.h" file not found

libgit2-ios: blob.c Lexical or Preprocessor Error "git2/common.h" file not found
*I also get that same git2/common.h file not found error on common.h and commit.c

I have tried numerous things and can't seem to get this thing to work when archiving.

What am I doing wrong?

Thanks

Matt

Analyze target ObjectiveGit-iOS failed

Hi,

I just tried to compile ObjectiveGit project before including it inside my project has a framework, by following the step described in your README.

I can't pass the Analyze phase, i get these errors:

Analyze target ObjectiveGit-iOS

CompileC /Users/drca/Library/Developer/Xcode/DerivedData/ObjectiveGitFramework-fposjuciisdfgrcppcotevctqisz/Build/Intermediates/ObjectiveGitFramework.build/Debug-iphonesimulator/ObjectiveGit-iOS.build/Objects-normal/i386/GTRepository.o Classes/GTRepository.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
    cd /Users/drca/Projects/obj-git
    setenv LANG en_US.US-ASCII
    setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -arch i386 -fmessage-length=0 -std=gnu99 -fobjc-arc -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wreturn-type -Wno-implicit-atomic-properties -Wformat -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-sign-compare -Wno-shorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wno-undeclared-selector -Wno-deprecated-implementations -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk -fexceptions -fasm-blocks -Wprotocol -Wdeprecated-declarations -mmacosx-version-min=10.6 -g -Wno-conversion -Wno-sign-conversion -fobjc-abi-version=2 -fobjc-legacy-dispatch "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -D__IPHONE_OS_VERSION_MIN_REQUIRED=50100 -iquote /Users/drca/Library/Developer/Xcode/DerivedData/ObjectiveGitFramework-fposjuciisdfgrcppcotevctqisz/Build/Intermediates/ObjectiveGitFramework.build/Debug-iphonesimulator/ObjectiveGit-iOS.build/ObjectiveGit-iOS-generated-files.hmap -I/Users/drca/Library/Developer/Xcode/DerivedData/ObjectiveGitFramework-fposjuciisdfgrcppcotevctqisz/Build/Intermediates/ObjectiveGitFramework.build/Debug-iphonesimulator/ObjectiveGit-iOS.build/ObjectiveGit-iOS-own-target-headers.hmap -I/Users/drca/Library/Developer/Xcode/DerivedData/ObjectiveGitFramework-fposjuciisdfgrcppcotevctqisz/Build/Intermediates/ObjectiveGitFramework.build/Debug-iphonesimulator/ObjectiveGit-iOS.build/ObjectiveGit-iOS-all-target-headers.hmap -iquote /Users/drca/Library/Developer/Xcode/DerivedData/ObjectiveGitFramework-fposjuciisdfgrcppcotevctqisz/Build/Intermediates/ObjectiveGitFramework.build/Debug-iphonesimulator/ObjectiveGit-iOS.build/ObjectiveGit-iOS-project-headers.hmap -I/Users/drca/Library/Developer/Xcode/DerivedData/ObjectiveGitFramework-fposjuciisdfgrcppcotevctqisz/Build/Products/Debug-iphonesimulator/include -I/Users/drca/Projects/obj-git/libgit2/include -I/Users/drca/Library/Developer/Xcode/DerivedData/ObjectiveGitFramework-fposjuciisdfgrcppcotevctqisz/Build/Intermediates/ObjectiveGitFramework.build/Debug-iphonesimulator/ObjectiveGit-iOS.build/DerivedSources/i386 -I/Users/drca/Library/Developer/Xcode/DerivedData/ObjectiveGitFramework-fposjuciisdfgrcppcotevctqisz/Build/Intermediates/ObjectiveGitFramework.build/Debug-iphonesimulator/ObjectiveGit-iOS.build/DerivedSources -F/Users/drca/Library/Developer/Xcode/DerivedData/ObjectiveGitFramework-fposjuciisdfgrcppcotevctqisz/Build/Products/Debug-iphonesimulator -include /Users/drca/Projects/obj-git/ObjectiveGitFramework_Prefix.pch -MMD -MT dependencies -MF /Users/drca/Library/Developer/Xcode/DerivedData/ObjectiveGitFramework-fposjuciisdfgrcppcotevctqisz/Build/Intermediates/ObjectiveGitFramework.build/Debug-iphonesimulator/ObjectiveGit-iOS.build/Objects-normal/i386/GTRepository.d --serialize-diagnostics /Users/drca/Library/Developer/Xcode/DerivedData/ObjectiveGitFramework-fposjuciisdfgrcppcotevctqisz/Build/Intermediates/ObjectiveGitFramework.build/Debug-iphonesimulator/ObjectiveGit-iOS.build/Objects-normal/i386/GTRepository.dia -c /Users/drca/Projects/obj-git/Classes/GTRepository.m -o /Users/drca/Library/Developer/Xcode/DerivedData/ObjectiveGitFramework-fposjuciisdfgrcppcotevctqisz/Build/Intermediates/ObjectiveGitFramework.build/Debug-iphonesimulator/ObjectiveGit-iOS.build/Objects-normal/i386/GTRepository.o

/Users/drca/Projects/obj-git/Classes/GTRepository.m:237:76: error: unexpected '@' in program
        NSURL *fileURL = [payload->repository.fileURL URLByAppendingPathComponent:@(relativeFilePath)];
                                                                                  ^
/Users/drca/Projects/obj-git/Classes/GTRepository.m:64:6: error: use of undeclared identifier '_configuration'; did you mean 'GTConfiguration'?
        if (_configuration != nil) {
            ^
/Users/drca/Projects/obj-git/Classes/GTRepository.m:90:115: error: unexpected '@' in program
                if (error != NULL) *error = [NSError errorWithDomain:NSCocoaErrorDomain code:kCFURLErrorUnsupportedURL userInfo:@{ NSLocalizedDescriptionKey: @"not a local file URL" }];
                                                                                                                                ^
/Users/drca/Projects/obj-git/Classes/GTRepository.m:95:115: error: unexpected '@' in program
                if (error != NULL) *error = [NSError errorWithDomain:NSCocoaErrorDomain code:kCFURLErrorUnsupportedURL userInfo:@{ NSLocalizedDescriptionKey: @"not a valid file path URL" }];
                                                                                                                                ^
/Users/drca/Projects/obj-git/Classes/GTRepository.m:428:23: error: unexpected '@' in program
                NSString *refName = @(array.strings[i]);
                                    ^
/Users/drca/Projects/obj-git/Classes/GTRepository.m:452:32: error: unexpected '@' in program
        return [NSURL fileURLWithPath:@(path) isDirectory:YES];
                                      ^
/Users/drca/Projects/obj-git/Classes/GTRepository.m:459:32: error: unexpected '@' in program
        return [NSURL fileURLWithPath:@(path) isDirectory:YES];
                                      ^
/Users/drca/Projects/obj-git/Classes/GTRepository.m:463:6: error: use of undeclared identifier '_objectDatabase'; did you mean 'GTObjectDatabase'?
        if (_objectDatabase == nil) {
            ^
/Users/drca/Projects/obj-git/Classes/GTRepository.m:467:9: error: use of undeclared identifier '_objectDatabase'; did you mean 'GTObjectDatabase'?
        return _objectDatabase;
               ^
/Users/drca/Projects/obj-git/Classes/GTRepository.m:471:6: error: use of undeclared identifier '_enumerator'
        if (_enumerator == nil) {
            ^
/Users/drca/Projects/obj-git/Classes/GTRepository.m:475:9: error: use of undeclared identifier '_enumerator'
        return _enumerator;
               ^
/Users/drca/Projects/obj-git/Classes/GTRepository.m:496:6: error: use of undeclared identifier '_weakEnumerators'
        if (_weakEnumerators == nil) {
            ^
/Users/drca/Projects/obj-git/Classes/GTRepository.m:500:9: error: use of undeclared identifier '_weakEnumerators'
        return _weakEnumerators;
               ^
/Users/drca/Projects/obj-git/Classes/GTRepository.m:504:6: error: use of undeclared identifier '_configuration'; did you mean 'GTConfiguration'?
        if (_configuration == nil) {
            ^
/Users/drca/Projects/obj-git/Classes/GTRepository.m:514:9: error: use of undeclared identifier '_configuration'; did you mean 'GTConfiguration'?
        return _configuration;
               ^
/Users/drca/Projects/obj-git/Classes/GTRepository.m:518:6: error: use of undeclared identifier '_index'
        if (_index == nil) {
            ^
/Users/drca/Projects/obj-git/Classes/GTRepository.m:526:9: error: use of undeclared identifier '_index'
        return _index;
               ^
/Users/drca/Projects/obj-git/Classes/GTRepository.m:52:17: warning: property 'weakEnumerators' requires method 'setWeakEnumerators:' to be defined - use @synthesize, @dynamic or provide a method implementation in this class implementation
@implementation GTRepository
                ^
/Users/drca/Projects/obj-git/Classes/GTRepository.m:48:45: note: property declared here
@property (nonatomic, strong) NSMutableSet *weakEnumerators;
                                            ^
/Users/drca/Projects/obj-git/Classes/GTRepository.m:52:17: warning: property 'index' requires method 'setIndex:' to be defined - use @synthesize, @dynamic or provide a method implementation in this class implementation
@implementation GTRepository
                ^
/Users/drca/Projects/obj-git/Classes/GTRepository.h:73:50: note: property declared here
@property (nonatomic, readonly, strong) GTIndex *index;
                                                 ^
/Users/drca/Projects/obj-git/Classes/GTRepository.m:52:17: warning: property 'configuration' requires method 'setConfiguration:' to be defined - use @synthesize, @dynamic or provide a method implementation in this class implementation
@implementation GTRepository
                ^
/Users/drca/Projects/obj-git/Classes/GTRepository.h:75:58: note: property declared here
@property (nonatomic, readonly, strong) GTConfiguration *configuration;
                                                         ^
/Users/drca/Projects/obj-git/Classes/GTRepository.m:52:17: warning: property 'objectDatabase' requires method 'setObjectDatabase:' to be defined - use @synthesize, @dynamic or provide a method implementation in this class implementation
@implementation GTRepository
                ^
/Users/drca/Projects/obj-git/Classes/GTRepository.h:74:59: note: property declared here
@property (nonatomic, readonly, strong) GTObjectDatabase *objectDatabase;
                                                          ^
/Users/drca/Projects/obj-git/Classes/GTRepository.m:52:17: warning: property 'git_repository' requires method 'git_repository' to be defined - use @synthesize, @dynamic or provide a method implementation in this class implementation
@implementation GTRepository
                ^
/Users/drca/Projects/obj-git/Classes/GTRepository.h:67:57: note: property declared here
@property (nonatomic, assign, readonly) git_repository *git_repository;
                                                        ^
/Users/drca/Projects/obj-git/Classes/GTRepository.m:52:17: warning: property 'git_repository' requires method 'setGit_repository:' to be defined - use @synthesize, @dynamic or provide a method implementation in this class implementation
@implementation GTRepository
                ^
/Users/drca/Projects/obj-git/Classes/GTRepository.h:67:57: note: property declared here
@property (nonatomic, assign, readonly) git_repository *git_repository;
                                                        ^
/Users/drca/Projects/obj-git/Classes/GTRepository.m:52:17: warning: property 'enumerator' requires method 'setEnumerator:' to be defined - use @synthesize, @dynamic or provide a method implementation in this class implementation
@implementation GTRepository
                ^
/Users/drca/Projects/obj-git/Classes/GTRepository.h:72:55: note: property declared here
@property (nonatomic, readonly, strong) GTEnumerator *enumerator; // should only be used on the main thread
                                                      ^
7 warnings and 17 errors generated.

Is there anything missing in my project ?
Do you have a solution ?

Thanks.

GTReferenceTypesSymbolic is misspelled

GTReference.h declares this enum:

typedef enum {
    GTReferenceTypesOid = GIT_REF_OID,              /** A reference which points at an object id */
    GTReferenceTypesSymoblic = GIT_REF_SYMBOLIC,    /** A reference which points at another reference */
    GTReferenceTypesPacked = GIT_REF_PACKED,
    GTReferenceTypesHasPeel = GIT_REF_HAS_PEEL,
    GTReferenceTypesListAll = GIT_REF_LISTALL,
} GTReferenceTypes;

Note that GTReferenceTypesSymoblic is not the same thing as GTReferenceTypesSymbolic.

Lack of properties

I've just been writing an example project (soon to appear!) using ObjectiveGit.

There seems to be a lack of properties for a lot of the objects. And many manually created KVC type setters that take an NSError** parameter.

That meant that I had to do more work than I needed to to set up Bindings for the UI.

Before I undertake a large refactor of this , is there any reason why properties have been avoided?

Issues with building on Mavericks with Xcode 5 for iOS

I am new to ObjectiveGit so this may just be a newbie problem.

I am trying to follow the roadmap for using the framework.

  1. needed brew, so installed that first
  2. git clone https://github.com/libgit2/objective-git.git
  3. cd objective-git; ./script/bootstrap

All that worked.

Then in Xcode 5, selected ObjectiveGit-IOS as target and built. Failed in libssl.

Building for x86_64 i386 armv7 armv7s arm64
Building OpenSSL for iphonesimulator7.0.3 x86_64
Please stand by...
/tmp/openssl-x86_64.log

Looking in the log, it shows -isysroot with no following value (${SDKROOT} seemed to result in nothing.

Configured for BSD-generic64.
making all in crypto...
( echo "#ifndef MK1MF_BUILD";
echo ' /* auto-generated by crypto/Makefile for crypto/cversion.c */';
echo ' #define CFLAGS "/usr/bin/xcrun clang -miphoneos-version-min=6.0 -arch x86_64 -isysroot -DOPENSSL_THREADS -pthread -D_THREAD_SAFE -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DTERMIOS -O3 -Wall"';
echo ' #define PLATFORM "BSD-generic64"';
echo " #define DATE "LC_ALL=C LC_TIME=C date"";
echo '#endif' ) >buildinf.h
/usr/bin/xcrun clang -miphoneos-version-min=6.0 -arch x86_64 -I. -I.. -I../include -isysroot -DOPENSSL_THREADS -pthread -D_THREAD_SAFE -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DTERMIOS -O3 -Wall -c -o cryptlib.o cryptlib.c
clang: warning: no such sysroot directory: '-DOPENSSL_THREADS'
In file included from cryptlib.c:117:
./cryptlib.h:62:10: fatal error: 'stdlib.h' file not found

include <stdlib.h>

     ^

1 error generated.
make[1]: *** [cryptlib.o] Error 1
make: *** [build_crypto] Error 1

I tried to inject the right SDKROOT, but ended up removing the -isysroot instead. That led to a full compile, but the linker then fails with....

shlib_target=; if [ -n "" ]; then
shlib_target="bsd-gcc-shared";
elif [ -n "" ]; then
FIPSLD_CC="/usr/bin/xcrun clang -miphoneos-version-min=6.0 -arch x86_64 "; CC=/usr/local/ssl/fips-2.0/bin/fipsld; export CC FIPSLD_CC;
fi;
LIBRARIES="-L.. -lssl -L.. -lcrypto" ;
make -f ../Makefile.shared -e
APPNAME=openssl OBJECTS="openssl.o verify.o asn1pars.o req.o dgst.o dh.o dhparam.o enc.o passwd.o gendh.o errstr.o ca.o pkcs7.o crl2p7.o crl.o rsa.o rsautl.o dsa.o dsaparam.o ec.o ecparam.o x509.o genrsa.o gendsa.o genpkey.o s_server.o s_client.o speed.o s_time.o apps.o s_cb.o s_socket.o app_rand.o version.o sess_id.o ciphers.o nseq.o pkcs12.o pkcs8.o pkey.o pkeyparam.o pkeyutl.o spkac.o smime.o cms.o rand.o engine.o ocsp.o prime.o ts.o srp.o"
LIBDEPS=" $LIBRARIES "
link_app.${shlib_target}
( :; LIBDEPS="${LIBDEPS:--L.. -lssl -L.. -lcrypto }"; LDCMD="${LDCMD:-/usr/bin/xcrun clang -miphoneos-version-min=6.0 -arch x86_64 }"; LDFLAGS="${LDFLAGS:--DOPENSSL_THREADS -pthread -D_THREAD_SAFE -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DTERMIOS -O3 -Wall}"; LIBPATH=for x in $LIBDEPS; do echo $x; done | sed -e 's/^ *-L//;t' -e d | uniq; LIBPATH=echo $LIBPATH | sed -e 's/ /:/g'; LD_LIBRARY_PATH=$LIBPATH:$LD_LIBRARY_PATH ${LDCMD} ${LDFLAGS} -o ${APPNAME:=openssl} openssl.o verify.o asn1pars.o req.o dgst.o dh.o dhparam.o enc.o passwd.o gendh.o errstr.o ca.o pkcs7.o crl2p7.o crl.o rsa.o rsautl.o dsa.o dsaparam.o ec.o ecparam.o x509.o genrsa.o gendsa.o genpkey.o s_server.o s_client.o speed.o s_time.o apps.o s_cb.o s_socket.o app_rand.o version.o sess_id.o ciphers.o nseq.o pkcs12.o pkcs8.o pkey.o pkeyparam.o pkeyutl.o spkac.o smime.o cms.o rand.o engine.o ocsp.o prime.o ts.o srp.o ${LIBDEPS} )
clang: warning: argument unused during compilation: '-pthread'
ld: building for iOS Simulator, but linking against dylib built for MacOSX file '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/lib/libSystem.dylib' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [link_app.] Error 1
make[1]: *** [openssl] Error 2
make: *** [build_apps] Error 1

Do I have my machine set up wrong or am I approaching this wrong?

Move Tests to Specta/Expecta

It's nicer in basically every way.

We should also use the opportunity to consolidate our fixture setup and teardown. My current Diff branch suffers from a bit of schizophrenia as we need to make sure the fixtures are available for our existing (non specta) tests.

Clone from Bitbucket repositories

I tried to use the clone functionality with a bitbucket account, but it does not work as Bitbucket is using https or ssh. Is it possible to compile libgit2 to be used with https?

'reference' property of GTBranch should be retained

In some cases, the GTReference object that is used to create the GTBranch object (using -initWithReference) may be autoreleased. Since the GTBranch object relies upon the GTReference in order to retrieve values like the name, etc. attempting to use these properties will result in EXC_BAD_ACCESS if the GTReference has been released. I believe the reference property should be retained to avoid this problem.

Getting Error: Fatal: unable to read OID

With this code:

GTCommit *commit = [self.repo lookupObjectByRefspec:@"refs/heads/master" error:nil];
GTTree *tree = [commit objectByPeelingToType:GTObjectTypeTree error:&error];

GTTreeBuilder *builder = [[GTTreeBuilder alloc]initWithTree:tree error:nil];
GTOID *OID = [GTOID OIDByHashingData:[document.userText dataUsingEncoding:NSUTF8StringEncoding] type:GTObjectTypeBlob error:nil];

[builder addEntryWithOID:OID fileName:@"filename.txt" fileMode:GTFileModeBlob error:nil];
tree = [builder writeTreeToRepository:self.repo error:nil];

GTCommit *createdCommit = [self.repo createCommitWithTree:tree message:self.commitMessageTextView.text author:signature committer:signature parents:@[commit] updatingReferenceNamed:@"HEAD" error:&error];

I get this result (with git status):
fatal: unable to read 3f476edc948bced50a3ba01ab7b89144e09d7f64
Where 3f476edc948bced50a3ba01ab7b89144e09d7f64 is filename.txt.

Running git fsck produces this result:

Checking object directories: 100% (256/256), done.
Checking objects: 100% (130/130), done.
broken link from    tree 89e7672edc13cf40534c2d1d0c4dae6f8bb7c91a
              to    blob 3f476edc948bced50a3ba01ab7b89144e09d7f64
missing blob 3f476edc948bced50a3ba01ab7b89144e09d7f64

I've struggled with this problem for a while. Any help would be appreciated.

GTSignature does not support non-UTF8 name or email

Related to #195, we assume that the author name and email are UTF-8, which results in nil when they're actually not.

Maybe we should use a more lenient encoding for all our strings, or at least figure out how git determines the encoding to use.

Undefined symbols for architecture x86_64: "_git_repository_head_unborn"

Undefined symbols for architecture x86_64:
    "_git_repository_head_unborn", referenced from:
     -[GTRepository isHEADUnborn] in GTRepository.o
ld: symbol(s) not found for architecture x86_64

Indeed, I cannot find anything like this mentioned in External/libgit2/include/git2/repository.h. What is it? It's killing the build, for me.

Typo in ObjectiveGitTests/GTTreeBuilderSpec.m?

In GTTreeBuilderSpec, I think this should be filemode:GTFileModeBlob, not filemode:GTFileModeTree?

        GTBlob *blob = [GTBlob blobWithString:@"Hi, how are you?" inRepository:repo error:&error];
        expect(blob).notTo.beNil();
        expect(error).to.beNil();

        [builder addEntryWithSHA:blob.sha filename:@"hi.txt" filemode:GTFileModeTree error:&error];

Use libgit2's Xcode target

I learned from libgit2/libgit2#1724 that there's apparently some way to get CMake to generate an Xcode project. We should do that, and use subprojects, instead of the janky shell script we have right now.

Blame

It looks like blame support is in libgit2 now (libgit2/libgit2#1317). Is wrapping that on the near-term radar? I might try my hand at it of no one beats me to it...

KVC/KVO compatibility

For reference, here's more or less how GitX works : there's a PBGitRepository class (mostly equivalent to GTRepository). It has a few properties (like -remotes, -branches and the like), that are kept in sync by listening to file-system events to refresh their contents when something is changed (e.g. it adds/removes references if there's movement in the .git directory). Right now we're trying to move everything to moar Objective-Git but I'm longing for that kind of ability in the new code I'm going to write. And we have a longstanding problem when there are 2 "clients" doing stuff in the repo (I know sometimes interactive rebases on the CLI do weird things because GitX is busily refreshing stuff).

I've been thinking about it for a while and I'm wondering if that's in scope for Objective-Git, or if I should keep that layer in GitX.

Add documentation to project (Code).

We need to setup the project so that we can generate all kinds of awesome documentation so that people can use a secondary source as a reference for the library. Please assign this to me as I've already begun the effort, thanks!

ObjectiveGit/ObjectiveGit.h not found – iOS

I have added ObjectiveGit-iOS as a target dependency and linked binary with libObjectiveGit-iOS.a since there was no ObjectiveGit as described in the readme file.

image of error

Inside the ObjectiveGit framework everything builds fine but I can't seem to link my project correctly to it.

First I had major issues with making the ObjectiveGit project build without errors, but i finally solved it.
Edit

This may not an "issue", but some extended "how to setup" steps would be useful in the readme-file.

Add API for individual file status

#239 just reminded me that I recently had to write a bunch of libgit2 code to check the status of an individual file; because it seems we don't have a wrapper for git_status_file yet.

Can't Compile libssh2 Target

Using PR #269 I'm getting this log output.

I don't think all of it is important, just the last 2 lines:
autom4te: cannot rename autom4te.cache/traces.0t as autom4te.cache/traces.0: No such file or directory
automake: error: autoconf failed with exit status: 1

Any help with this would be greatly appreciated.
Thanks!

P.S: What's the policy on opening an issue when using an unmerged-PR? I thought it would be sensible too make this a comment on #269 but I have a sinking feeling that this is unrelated.

Get GTTag objects for a GTRepository

Is there any way to get all the GTTag objects for a GTRepository? I can get a list of reference names from the GTRepository object (which includes tag references) and then create a GTReference object from the reference name, but (as far as I can see) there is no way to create a GTTag object from this.

Build fails on OS X 10.7

Building on 10.7 Lion fails with the following error:

Expected method to write dictionary element not found on object of type 'NSMutableDictionary *'

Changing Base SDK from "Current OS X" to "Latest OS X" or explicitly to 10.8 fixes the problem. If this is a bug I'd love to do a pull request but I don't know how to run the tests (doing CMD-U in Xcode results in EXC_BAD_ACCESS in libobjc.A.dylib`objc_msgSend:).

NSError category class method problem

As it is, *+ (NSString )gitLastErrorDescriptionWithCode:(NSInteger)code is declared before the other class methods. When I build any target, it fails because two of the other methods in the NSError category call that class method. Fixed by moving *+ (NSString )gitLastErrorDescriptionWithCode:(NSInteger)code method to the top of the category.

GTEnumerator performance

One of my longest-running tasks on rowanj/gitx (OS X Git GUI) is to replace the parsing of command-line git output with libgit2 and Objective-Git.

I've recently got a working branch which replaces the loading of the commit info from git log with GTEnumerator, but I've noticed that it's taking around 1.5x the time to load the same commits (isolating the parsing/enumeration thread).

Running on a clone of the mainline Linux repo, generating and parsing the command line output took around 10s total; but the GTEnumerator approach is taking around 12s in git_revwalk_next (close enough that it doesn't really matter), but then another 4.5s in -[GTRepository lookupObjectBySha:objectType:error:]

pom-pom:linux rowan$ time (git log --branches --remotes --tags > /dev/null)

real    0m10.872s
user    0m9.665s
sys 0m0.914s

screen shot 2013-06-18 at 10 22 41 am

Cannot build ObjectiveGitFramework.xcodeproj after git submodule update

If I copy the objective-git folder from the CommitsViewer demo into my project I can built the project fine. However, if I add my own submodule for git://github.com/libgit2/objective-git.git and then git submodule update --init --recursive I cannot build the project. I get the following error:

clang: error: no such file or directory: '/Users/cynicaljoy/Documents/ImageBundle/objective-git/libgit2/src/hashtable.c'
clang: error: no input files
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1

Better Documentation (Quickstart)

Objective-Git should really have a 5-minute quickstart to using the Objective-Git framework in an new/existing XCode project. The framework article linked to in the README is okay as a generic guide to frameworks, but not really for using Objective-Git specifically.

For Instance:
  • Drag X to Linked Frameworks

  • Modify Y build settings in the target Info Window

  • Link Z dependencies

  • Etc. Etc. Etc.

    #import <ObjectiveGit/ObjectiveGit.h>
    
Other examples of good Quickstarts:

Xcode 4.3 Issue

I updated to the latest Xcode release, 4.3, and now receive this error when I build my project.

Semantic Issue
Category is implementing a method which will also be implemented by its primary class

I generated a brand new project and added the Framework to it as directed in the README with a fresh checkout of the code and it still happens.

I'm very new to Objective-C, so I don't really know where to start. I commented out the method and the project builds, but I don't have much code around the Framework just yet, so I'm not sure how to test it out.

Compilation issues compiling iOS on Snow Leopard 10.6 Xcode 4.2

Hi, I've been struggling to get this to compile on Snow Leopard for the last couple of days.

Unfortunately, I've stupidly been trying to fix things by adding to my path and adding aliases in my system folders to make the right files show up, but I realize now that I should have modified the project both A) because I can always make a clean build of the project, and B) I could make a pull request of my fixes. :/ I know it's because I was trying to do all of this at like 4 am, which is never a good idea. I apologize for that!

But hopefully I can remember everything that's been changed. :/

Anyway, I'm still stuck. I've gotten CMake to work now, but it's running into errors compiling, and it seems to be because it can't find the #include "git2.h" files.

SO: In summary from the top of my head, these are some problems I had:
1)
CMake Error: your C compiler: "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2" was not found. Please set CMAKE_C_COMPILER to a valid compiler path or name.
and
CMake Error: your C compiler: "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2" was not found. Please set CMAKE_C_COMPILER to a valid compiler path or name.

My llvm-gcc-4.2 is actually apparently installed in
/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2
for some reason.

To fix this, I actually created the expected file structure and just made a ln to the actual location. Stupid, I know. Perhaps this value should be conditional on which version of Xcode is installed? I don't know why those files are in the wrong place.

2.a)
/usr/include/machine/_types.h:36:24: error: arm/_types.h: No such file or directory

(This is the same for all the arm/ files). I was reallllly not sure about this one. To attack the problem, I tried adding the ACTUAL location of the arm/ directory to my C_INCLUDE_PATH in bash and all sorts of stuff, but none of it worked. Finally, I just did the same thing as above, and ran
sudo ln -s /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/usr/include /usr/include/arm

again, not great.

2.b) Then I ran into similar errors and added
sudo ln -s /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/usr/include/mach/arm /usr/include/mach/arm

and

sudo ln -s /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/usr/include/libkern/arm /usr/include/libkern/arm

So, I'm not sure why these didn't show up when I modified my C_INCLUDE_PATH, and also not sure why they weren't even being included in the first place.

  1. Once I specified the arm directories, I ran into the issue that it couldn't locate arm-apple-darwin10-llvm-gcc-4.2. I think this one might be because I have downloaded llvm from macports, so it was looking for it in /opt/usr/llvm-gcc-4.2/... but it wasn't there,
    so below the macports line in my bash_profile, I added:
# ADD apple's llvm compilers to path
PATH=/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/bin:$PATH
export PATH

Which, again, fixed the problem but feels dumb.

  1. Now, I've gotten CMake to work now, but it's running into errors compiling, and it seems to be because it can't find the `#include "git2.h" files.
/Users/Daly/Documents/School/EECS/Labs/iOS/iDevCompiler/objective-git/Classes/GTRepository.h:57:14: error: unnamed enumeration must be a definition [1]
typedef enum : git_reset_t {

/Users/Daly/Documents/School/EECS/Labs/iOS/iDevCompiler/objective-git/Classes/GTDiffDelta.h:27:14: error: unnamed enumeration must be a definition [1]
 typedef enum : git_delta_t {

Since both git_reset_t and git_delta_t are declared in git2/, I think that somehow they're not being included, despite not getting "could not find file" errors on the include statements..

I'm not really sure what to do about this one.
But yeah, I think I've listed everything I changed, so I hope that helps. I'd love to get this to build, and hopefully we can fix this permanently so it isn't an issue for anyone else! :)
Thanks!
~Nathan Daly

Inclusion in iOS project is confusing / broken?

Out of the box, build_framework_ios builds a framework named ObjectiveGit-iOS.framework. This in itself is fine, but the files in <ObjectiveGit-iOS/ObjectiveGit.h> (itself somewhat confusingly inconsistent) include lines like:

#import <ObjectiveGit/GTRepository.h>

which obviously doesn't work as Xcode thinks the framework is named ObjectiveGit-iOS.framework. Renaming the framework to ObjectiveGit.framework solves this issue just fine, but then the .gitignore entry no longer applies. Should I submit a patch for this myself or is it intended behaviour?

Building objective git on a 32 bit system

I am trying to set up and environment to build objective-git on a 32bit Core Duo system due to its use as a submodule in some other projects I am following.

I keep getting "-fobjc-arc is not supported with fragile abi" errors whenever it tries to compile.

Are there any settings I can change to successfully build on an i386 architecture? Would it be possible to build a 32 bit version on a newer x86_86 architecture? I am attempting to perform the build on xcode 4.2 on OS X 10.6

Any tips are appreciated.

bootstrap can't install automake

I've got CMake and Homebrew installed. Here's what I get currently:

$ objective-git/script/bootstrap 
*** Updating submodules...
Submodule 'Configuration' () registered for path 'External/Configuration'
Submodule 'libgit2' () registered for path 'External/libgit2'
Submodule 'libssh2' () registered for path 'External/libssh2'
Submodule 'openssl' () registered for path 'External/openssl'
Submodule 'ObjectiveGitTests/expecta' () registered for path 'ObjectiveGitTests/expecta'
Submodule 'ObjectiveGitTests/specta' () registered for path 'ObjectiveGitTests/specta'
*** Installing automake with Homebrew...
Error: You must `brew link autoconf' before automake can be installed
$ brew link autoconf
Linking /usr/local/Cellar/autoconf/2.69... Warning: Could not link autoconf. Unlinking...

Error: Could not symlink file: /usr/local/Cellar/autoconf/2.69/share/emacs/site-lisp/autotest-mode.elc
/usr/local/share/emacs/site-lisp is not writable. You should change its permissions.
$ ls -l /usr/local/share/emacs/
total 0
drwxrwxr-x  8 root  wheel  272 Aug  2  2012 site-lisp

Looks writable to me. What did I miss?

(OS X 10.8.5, Xcode 5.0.1)

GTRepository enumerateCommitsBeginningAtSha: not enumerating through all commits

I'm using the following code to get the all the commits for a specific branch:

NSMutableArray *commits = [NSMutableArray array];
    [self.repository enumerateCommitsBeginningAtSha:self.sha sortOptions:options error:error usingBlock:^(GTCommit *commit, BOOL *stop) {
        [commits addObject:commit];
    }];

I'm not sure if this the best approach to go about doing that, but this seems to enumerate through a certain number of commits but never all of them. It seems to stop at random numbers, for one of my repositories it stops at 135 commits and for another one it stops at 623, but it doesn't show all the commits for either of them. Is this a limitation purposely put in place or is there a specific reason for it to stop at a certain commit (or is my code wrong?)

Merge fetched Branches

I_m working on implementing pull(fetch->merge). fetching works so far. calculating ahead/behind also gives the correct values but merging with + (GTCommit *)mergeBaseOf:(GTBranch *)branch1 andBranch:(GTBranch *)branch2 error:(NSError _)error doest update anything.

I can't compile Objetictive-git with Xcode 4.5 and iOS 6.0 SDK

Hi. I'm trying to compile objective-git with my iOS project (Xcode 4.5 and iOS 6.0). But I have an error like this:

-- The C compiler identification is GNU 4.2.1
CMake Warning at /Applications/CMake 2.8-10.app/Contents/share/cmake-2.8/Modules/Platform/Darwin.cmake:158 (message):
Ignoring CMAKE_OSX_SYSROOT value:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk

because the directory does not exist.
Call Stack (most recent call first):
/Applications/CMake 2.8-10.app/Contents/share/cmake-2.8/Modules/CMakeSystemSpecificInformation.cmake:36 (include)
CMakeLists.txt:14 (PROJECT)

CMake Error at /Applications/CMake 2.8-10.app/Contents/share/cmake-2.8/Modules/Platform/Darwin.cmake:190 (message):
CMAKE_OSX_DEPLOYMENT_TARGET is '10.6' but CMAKE_OSX_SYSROOT:

""

is not set to a MacOSX SDK with a recognized version. Either set
CMAKE_OSX_SYSROOT to a valid SDK or set CMAKE_OSX_DEPLOYMENT_TARGET to
empty.
Call Stack (most recent call first):
/Applications/CMake 2.8-10.app/Contents/share/cmake-2.8/Modules/CMakeSystemSpecificInformation.cmake:36 (include)
CMakeLists.txt:14 (PROJECT)

-- Configuring incomplete, errors occurred!
Command /bin/sh failed with exit code 1

I think it's a problem with iOS 6.0 SDK, but I don't know how to fix this.

Compile Problem "git2.h file not found"

I'm trying to integrate objective-git into an iPad project and I've hit the 'git2.h' file not found issue.

I've seen a few mentions of this problem that are several months ( or years ) old but I haven't been able to correct my issue from any of those threads.

I have followed all of the steps listed in the Readme, but when I include objective git in my project's source files:

# import ObjectiveGit/ObjectiveGit.h

I run into an error stating - 'git2.h' file not found - in ObjectiveGit.h

How should I specify the correct header path in my Xcode project to get this to compile into an application?

Thanks for your help.

P.S. One other issue I thought was strange. When I link libObjectiveGit-iOS.a to my project it appears in the 'Link Binary With Libraries' menu in a red font. Does that mean that it's not linking correctly?

libssh2.h not found

I recently synced to the master branch (at 64e32d2), and made sure the submodules were all in order, and now I get the following build error with the ObjectiveGit target:

objective-git/External/libgit2/include/git2/transport.h:15:10: 'libssh2.h' file not found

I'm running Xcode 4.6.3 on OS X 10.8.5.

Diffs do not support non-UTF8 content

For example, fetching the diff for graphics.ai in mhettler/accuratelockandhardware.com@4e77bd2 will result in many nil hunk headers and lines.

libgit2 is giving us valid C strings — at least in the sense that they represent the file's content, but may be in an unknown encoding. We should use Cocoa's text encoding functions or implement some fallbacks to handle more possible cases.

GTRepository.fileURL appends 'file:' to the beginning of the fileURL

On iOS 7 beta calling GTRepository.fileURL returns an invalid file path. So instead of /private/var/mobile/Applications/application/Documents/repo/ it's file:/private/var/mobile/Applications/application/Documents/repo/.

Debugging this issue we can see that:
1.git_repository_workdir() returns a properly formed file path.
2. Thus it must be [NSURL fileURLWithPath: isDirectory:].

Sorry for the earlier confusion I accidentally tapped on the submit button.

GTReference class method missing

- (BOOL)setName:(NSString *)newName error:(NSError **)error
- (BOOL)setTarget:(NSString *)newTarget error:(NSError **)error
- (BOOL)deleteWithError:(NSError **)error
- (BOOL)reloadWithError:(NSError **)error

These GTReference methods all contain *error = [[self class] invalidReferenceError]; yet the class method is declared at the bottom of the implementation. Moving it to the top fixes it.

<git2.h> not found

I've followed the instructions just fine I thought, but I'm getting the error <git2.h> not found in ObjectiveGit/ObjectiveGit.h

in my delegate implementation file, I have the following:

#import <ObjectiveGit/ObjectiveGit.h>

but under "Other Sources", in ObjectiveGit, the "ObjectiveGit.h" file seems to be next to "git2.h", as follows...

git2

Memory leaks in GTReference / GTRepository

Instruments is reporting a couple leaks in the objective-git classes. I'm inclined to think that some of these are false alarms because I can't see anything wrong here myself, but maybe one of you guys can confirm. The first leak is in GTReference in this method (I've pointed out the line where Instruments claims the leak is occuring):

+ (NSArray *)referenceNamesInRepository:(GTRepository *)theRepo types:(GTReferenceTypes)types error:(NSError **)error {

    NSParameterAssert(theRepo != nil);
    NSParameterAssert(theRepo.repository != nil);

    git_strarray array;

    int gitError = git_reference_listall(&array, theRepo.repo, types);  <--- leak here
    if(gitError != GIT_SUCCESS) {
        if(error != NULL)
            *error = [NSError gitErrorForListAllRefs:gitError];
        return nil;
    }

    NSMutableArray *references = [NSMutableArray arrayWithCapacity:array.count];
    for(int i=0; i< array.count; i++) {
        [references addObject:[NSString stringWithUTF8String:array.strings[i]]];
    }

    return references;
}

The second leak is in GTRepository (once again, I've pointed out which line Instrument reports as the source of the leak):

- (GTObject *)lookupObjectByOid:(git_oid *)oid objectType:(GTObjectType)type error:(NSError **)error {

    git_object *obj;

    int gitError = git_object_lookup(&obj, self.repo, oid, type);   <--- leak here
    if(gitError != GIT_SUCCESS) {
        if(error != NULL)
            *error = [NSError gitErrorForLookupObject:gitError];
        return nil;
    }

    return [GTObject objectWithObj:obj inRepository:self];
}

Instruments seems to have an issue with int gitError in both cases, but it doesn't make any sense that a primitive would be leaking memory. Safe to call this a false alarm?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.