Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Objective-C bindings to libgit2

License

NotificationsYou must be signed in to change notification settings

libgit2/objective-git

Repository files navigation

Carthage compatibleBuild Status

ObjectiveGit provides Cocoa bindings to thelibgit2 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 considercontributing 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 withgit_ and are often accessible via a property so that your application can take advantage of thelibgit2 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 useCarthage to install pre-built binariesor download themmanually.

Other Tools

Simply run thescript/bootstrap script to automatically installdependencies needed to start building the framework. This script usesHomebrew to install these tools. If your Mac does not haveHomebrew, 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 theObjectiveGitFramework.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 yourCartfile.
github "libgit2/objective-git"
  1. Runcarthage update.
  2. Mac targets
  • On your application targets' "General" settings tab, in the "Embedded Binaries" section, drag and drop theObjectiveGit.framework from theCarthage/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 theObjectiveGit.framework from theCarthage/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 theCartfile.resolved

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

The different instructions for iOS works around anApp 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 theObjectiveGit.framework.dSYM file fromCarthage/Build/[platform] into the list.

Copy dSYM Files

Manual

  1. Download the latestObjectiveGit.framework.zip fromreleases.
  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'sstrip 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. Runscript/bootstrap.
  2. Drag theObjectiveGitFramework.xcodeproj file into the Project Navigator pane of your project.
  3. AddObjectiveGit-Mac orObjectiveGit-iOS as a target dependency of your application, depending on platform.
  4. Link your application withObjectiveGit.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 asExternal/ObjectiveGit, you would set this build setting toExternal/ObjectiveGit/External/libgit2/include. If you see build errors saying thatgit2/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 addObjectiveGit.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 inbuild/Debug whereas the iOS framework is inbuild/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'sObjective-C codingconventions.

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

License

ObjectiveGit is released under the MIT license. SeetheLICENSE file.

About

Objective-C bindings to libgit2

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors73

Languages


[8]ページ先頭

©2009-2025 Movatter.jp