Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
68a19ca9
Commit
68a19ca9
authored
Feb 20, 2014
by
Russell Belfer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clarify C compatibility policy
and a couple of other minor doc fixups.
parent
978a4ed5
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
17 deletions
+32
-17
CONTRIBUTING.md
+17
-9
CONVENTIONS.md
+14
-7
README.md
+1
-1
No files found.
CONTRIBUTING.md
View file @
68a19ca9
...
@@ -5,9 +5,13 @@ your help.
...
@@ -5,9 +5,13 @@ your help.
## Licensing
## Licensing
By contributing to libgit2, you agree to release your contribution under the terms of the license.
By contributing to libgit2, you agree to release your contribution under
For code under
`examples`
, this is governed by the
[
CC0 Public Domain Dedication
](
examples/COPYING
)
.
the terms of the license. Except for the
`examples`
directory, all code
All other code is released under the
[
GPL v2 with linking exception
](
COPYING
)
.
is released under the
[
GPL v2 with linking exception
](
COPYING
)
.
The
`examples`
code is governed by the
[
CC0 Public Domain Dedication
](
examples/COPYING
)
, so that you may copy
from them into your own application.
## Discussion & Chat
## Discussion & Chat
...
@@ -76,15 +80,19 @@ you're porting code *from* to see what you need to do. As a general rule,
...
@@ -76,15 +80,19 @@ you're porting code *from* to see what you need to do. As a general rule,
MIT and BSD (3-clause) licenses are typically no problem. Apache 2.0
MIT and BSD (3-clause) licenses are typically no problem. Apache 2.0
license typically doesn't work due to GPL incompatibility.
license typically doesn't work due to GPL incompatibility.
If you are pulling in code from core Git, another project or code you've pulled from
If you are pulling in code from core Git, another project or code you've
a forum / Stack Overflow then please flag this in your PR and also make sure you've
pulled from a forum / Stack Overflow then please flag this in your PR and
given proper credit to the original author in the code snippet.
also make sure you've given proper credit to the original author in the
code snippet.
## Style Guide
## Style Guide
`libgit2`
is written in
[
ANSI C
](
http://en.wikipedia.org/wiki/ANSI_C
)
The public API of
`libgit2`
is
[
ANSI C
](
http://en.wikipedia.org/wiki/ANSI_C
)
(a.k.a. C89) with some specific conventions for function and type naming,
(a.k.a. C89) compatible. Internally,
`libgit2`
is written using a portable
code formatting, and testing.
subset of C99 - in order to compiler with GCC, Clang, MSVC, etc., we keep
local variable declarations at the tops of blocks only and avoid
`//`
style
comments. Additionally,
`libgit2`
follows some extra conventions for
function and type naming, code formatting, and testing.
We like to keep the source code consistent and easy to read. Maintaining
We like to keep the source code consistent and easy to read. Maintaining
this takes some discipline, but it's been more than worth it. Take a look
this takes some discipline, but it's been more than worth it. Take a look
...
...
CONVENTIONS.md
View file @
68a19ca9
...
@@ -6,14 +6,18 @@ guidelines that should help with that.
...
@@ -6,14 +6,18 @@ guidelines that should help with that.
## Compatibility
## Compatibility
`libgit2`
runs on many different platforms with many different compilers.
`libgit2`
runs on many different platforms with many different compilers.
It is written in
[
ANSI C
](
http://en.wikipedia.org/wiki/ANSI_C
)
(
a.k.a.
C89)
with some specific standards for function and type naming, code formatting,
and testing.
We try to avoid more recent extensions to maximize portability. We also, to
The public API of
`libgit2`
is
[
ANSI C
](
http://en.wikipedia.org/wiki/ANSI_C
)
the greatest extent possible, try to avoid lots of
`#ifdef`
s inside the core
(a.k.a. C89) compatible.
code base. This is somewhat unavoidable, but since it can really hamper
maintainability, we keep it to a minimum.
Internally,
`libgit2`
is written using a portable subset of C99 - in order
to maximize compatibility (e.g. with MSVC) we avoid certain C99
extensions. Specifically, we keep local variable declarations at the tops
of blocks only and we avoid
`//`
style comments.
Also, to the greatest extent possible, we try to avoid lots of
`#ifdef`
s
inside the core code base. This is somewhat unavoidable, but since it can
really hamper maintainability, we keep it to a minimum.
## Match Surrounding Code
## Match Surrounding Code
...
@@ -209,6 +213,9 @@ All inlined functions must be declared as:
...
@@ -209,6 +213,9 @@ All inlined functions must be declared as:
GIT_INLINE(result_type) git_modulename_functionname(arg_list);
GIT_INLINE(result_type) git_modulename_functionname(arg_list);
```
```
`GIT_INLINE`
(or
`inline`
) should not be used in public headers in order
to preserve ANSI C compatibility.
## Tests
## Tests
`libgit2`
uses the
[
clar
](
https://github.com/vmg/clar
)
testing framework.
`libgit2`
uses the
[
clar
](
https://github.com/vmg/clar
)
testing framework.
...
...
README.md
View file @
68a19ca9
...
@@ -65,7 +65,7 @@ Under Unix-like systems, like Linux, \*BSD and Mac OS X, libgit2 expects `pthrea
...
@@ -65,7 +65,7 @@ Under Unix-like systems, like Linux, \*BSD and Mac OS X, libgit2 expects `pthrea
they should be installed by default on all systems. Under Windows, libgit2 uses the native Windows API
they should be installed by default on all systems. Under Windows, libgit2 uses the native Windows API
for threading.
for threading.
The
`libgit2`
library is built using
`CMake 2.6+`
(
<http://www.cmake.org>
) on all platforms.
The
`libgit2`
library is built using
[
CMake
](
<
http://www.cmake.org
>
)
(
version
2.6 or newer
) on all platforms.
On most systems you can build the library using the following commands
On most systems you can build the library using the following commands
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment