Go to file
Russell Belfer a1683f28ce More tests and bug fixes for status with rename
This changes the behavior of the status RENAMED flags so that they
will be combined with the MODIFIED flags if appropriate.  If a file
is modified in the index and also renamed, then the status code
will have both the GIT_STATUS_INDEX_MODIFIED and INDEX_RENAMED bits
set.  If it is renamed but the OID has not changed, then just the
GIT_STATUS_INDEX_RENAMED bit will be set.  Similarly, the flags
GIT_STATUS_WT_MODIFIED and GIT_STATUS_WT_RENAMED can both be set
independently of one another.

This fixes a serious bug where the check for unmodified files that
was done at data load time could end up erasing the RENAMED state
of a file that was renamed with no changes.

Lastly, this contains a bunch of new tests for status with renames,
including tests where the only rename changes are case changes.
The expected results of these tests have to vary by whether the
platform uses a case sensitive filesystem or not, so the expected
data covers those platform differences separately.
2013-06-17 10:03:49 -07:00
cmake/Modules Build with the system's http-parser installation if available 2013-05-30 21:14:05 +03:00
deps Several warnings detected by static code analyzer fixed 2013-03-18 03:30:26 +04:00
docs Implement regex pattern diff driver 2013-06-11 11:22:22 -07:00
examples Extend diff example 2013-05-17 17:33:03 -07:00
include Clarify some docs and minor reordering 2013-06-17 10:03:48 -07:00
packaging/rpm libgit2.pc.in: also switch to LIB_INSTALL_DIR 2012-07-16 13:30:23 +02:00
src More tests and bug fixes for status with rename 2013-06-17 10:03:49 -07:00
tests-clar More tests and bug fixes for status with rename 2013-06-17 10:03:49 -07:00
.gitattributes Add git attributes settings for *.c and *.h to force line endings to LF. 2011-05-08 12:30:16 -07:00
.gitignore Added libssh2 cmake module 2013-05-07 14:26:33 -04:00
.HEADER Switch the license from BSD to GPL+libgcc exception 2008-11-01 15:55:47 -07:00
.mailmap mailmap: Coalesce some identities 2013-04-21 09:04:01 +02:00
.travis.yml travis: test push 2013-04-29 02:15:51 +02:00
api.docurium update examples content to be compilable and up to date 2011-06-15 09:40:06 -07:00
AUTHORS Added Sven Strickroth to AUTHORS 2013-01-31 19:48:00 +01:00
CMakeLists.txt cmake: Add option to specify the name of the binary 2013-06-13 10:12:44 +02:00
CONTRIBUTING.md Fixed a couple typos 2013-03-02 13:58:05 -08:00
CONVENTIONS.md Fixed a couple typos 2013-03-02 13:58:05 -08:00
COPYING update copyrights 2013-01-08 17:31:27 -06:00
git.git-authors Merge pull request #1202 from martinwoodward/add-florian 2013-01-07 07:06:18 -08:00
libgit2_clar.supp Add a valgrind suppression for glibc's getaddrinfo cache 2013-03-25 18:15:54 -04:00
libgit2.pc.in Use standard CMake variable names for installation paths 2012-10-20 02:56:35 +03:00
Makefile.embed makefile: Fix the builtin Makefile 2012-11-13 14:05:43 -08:00
README.md Fix some minor issues 2013-04-19 10:29:50 -07:00

libgit2 - the Git linkable library

Build Status

libgit2 is a portable, pure C implementation of the Git core methods provided as a re-entrant linkable library with a solid API, allowing you to write native speed custom Git applications in any language with bindings.

libgit2 is licensed under a very permissive license (GPLv2 with a special Linking Exception). This basically means that you can link it (unmodified) with any kind of software without having to release its source code.

What It Can Do

libgit2 is already very usable.

  • SHA conversions, formatting and shortening
  • abstracted ODB backend system
  • commit, tag, tree and blob parsing, editing, and write-back
  • tree traversal
  • revision walking
  • index file (staging area) manipulation
  • reference management (including packed references)
  • config file management
  • high level repository management
  • thread safety and reentrancy
  • descriptive and detailed error messages
  • ...and more (over 175 different API calls)

Building libgit2 - Using CMake

libgit2 builds cleanly on most platforms without any external dependencies. Under Unix-like systems, like Linux, *BSD and Mac OS X, libgit2 expects pthreads to be available; they should be installed by default on all systems. Under Windows, libgit2 uses the native Windows API for threading.

The libgit2 library is built using CMake 2.6+ (http://www.cmake.org) on all platforms.

On most systems you can build the library using the following commands

$ mkdir build && cd build
$ cmake ..
$ cmake --build .

Alternatively you can point the CMake GUI tool to the CMakeLists.txt file and generate platform specific build project or IDE workspace.

To install the library you can specify the install prefix by setting:

$ cmake .. -DCMAKE_INSTALL_PREFIX=/install/prefix
$ cmake --build . --target install

For more advanced use or questions about CMake please read http://www.cmake.org/Wiki/CMake_FAQ.

The following CMake variables are declared:

  • BIN_INSTALL_DIR: Where to install binaries to.
  • LIB_INSTALL_DIR: Where to install libraries to.
  • INCLUDE_INSTALL_DIR: Where to install headers to.
  • BUILD_SHARED_LIBS: Build libgit2 as a Shared Library (defaults to ON)
  • BUILD_CLAR: Build Clar-based test suite (defaults to ON)
  • THREADSAFE: Build libgit2 with threading support (defaults to OFF)
  • STDCALL: Build libgit2 as stdcall. Turn off for cdecl (Windows; defaults to ON)

Compiler and linker options

CMake lets you specify a few variables to control the behavior of the compiler and linker. These flags are rarely used but can be useful for 64-bit to 32-bit cross-compilation.

  • CMAKE_C_FLAGS: Set your own compiler flags
  • CMAKE_FIND_ROOT_PATH: Override the search path for libraries
  • ZLIB_LIBRARY, OPENSSL_SSL_LIBRARY AND OPENSSL_CRYPTO_LIBRARY: Tell CMake where to find those specific libraries

MacOS X

If you want to build a universal binary for Mac OS X, CMake sets it all up for you if you use -DCMAKE_OSX_ARCHITECTURES="i386;x86_64" when configuring.

Windows

You need to run the CMake commands from the Visual Studio command prompt, not the regular or Windows SDK one. Select the right generator for your version with the `-G "Visual Studio X" option.

See [the wiki] (https://github.com/libgit2/libgit2/wiki/Building-libgit2-on-Windows) for more detailed instructions.

Language Bindings

Here are the bindings to libgit2 that are currently available:

If you start another language binding to libgit2, please let us know so we can add it to the list.

How Can I Contribute?

Check the contribution guidelines.

License

libgit2 is under GPL2 with linking exemption. This means you can link to the library with any program, commercial, open source or other. However, you cannot modify libgit2 and distribute it without supplying the source.

See the COPYING file for the full license text.