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
e172cf08
Commit
e172cf08
authored
May 18, 2012
by
Vicent Martí
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
errors: Rename the generic return codes
parent
2e2e9785
Hide whitespace changes
Inline
Side-by-side
Showing
90 changed files
with
404 additions
and
369 deletions
+404
-369
examples/diff.c
+2
-2
examples/general.c
+1
-1
examples/network/git2.c
+2
-2
examples/network/index-pack.c
+3
-3
examples/network/ls-remote.c
+5
-5
include/git2/blob.h
+5
-5
include/git2/branch.h
+4
-4
include/git2/commit.h
+5
-5
include/git2/config.h
+17
-17
include/git2/errors.h
+42
-5
include/git2/index.h
+9
-9
include/git2/notes.h
+5
-5
include/git2/object.h
+1
-1
include/git2/odb.h
+12
-12
include/git2/oid.h
+3
-3
include/git2/reflog.h
+4
-4
include/git2/refs.h
+13
-13
include/git2/refspec.h
+1
-1
include/git2/remote.h
+9
-9
include/git2/repository.h
+7
-7
include/git2/revwalk.h
+11
-11
include/git2/signature.h
+2
-2
include/git2/status.h
+2
-2
include/git2/submodule.h
+2
-2
include/git2/tag.h
+11
-11
include/git2/tree.h
+8
-9
src/attr.c
+7
-7
src/attr_file.c
+7
-7
src/branch.c
+1
-1
src/commit.c
+3
-3
src/config.c
+8
-8
src/config_cache.c
+4
-4
src/config_file.c
+6
-6
src/crlf.c
+3
-3
src/delta-apply.c
+1
-1
src/delta-apply.h
+1
-1
src/diff.c
+1
-1
src/fileops.c
+5
-5
src/fileops.h
+3
-3
src/filter.c
+2
-2
src/filter.h
+1
-1
src/ignore.c
+1
-1
src/index.c
+1
-1
src/indexer.c
+4
-4
src/iterator.c
+3
-3
src/notes.c
+5
-5
src/object.c
+6
-6
src/odb.c
+12
-12
src/odb.h
+2
-2
src/odb_loose.c
+1
-1
src/odb_pack.c
+5
-5
src/pack.c
+7
-7
src/path.c
+2
-2
src/pkt.c
+2
-2
src/protocol.c
+1
-1
src/refs.c
+4
-4
src/refspec.c
+2
-2
src/refspec.h
+1
-1
src/remote.c
+5
-5
src/repository.c
+5
-5
src/revwalk.c
+11
-11
src/signature.c
+2
-2
src/status.c
+1
-1
src/submodule.c
+2
-2
src/tag.c
+7
-7
src/transport.c
+3
-3
src/transports/git.c
+5
-5
src/transports/http.c
+3
-3
src/tree.c
+7
-7
src/vector.c
+3
-3
tests-clar/commit/signature.c
+2
-2
tests-clar/config/multivar.c
+2
-2
tests-clar/config/write.c
+2
-2
tests-clar/core/path.c
+2
-2
tests-clar/core/vector.c
+1
-1
tests-clar/index/tests.c
+3
-3
tests-clar/network/remotelocal.c
+1
-1
tests-clar/network/remotes.c
+1
-1
tests-clar/notes/notes.c
+1
-1
tests-clar/object/lookup.c
+4
-4
tests-clar/object/tag/read.c
+2
-2
tests-clar/object/tree/frompath.c
+9
-9
tests-clar/refs/branches/delete.c
+1
-1
tests-clar/refs/branches/move.c
+1
-1
tests-clar/repo/discover.c
+5
-5
tests-clar/repo/open.c
+2
-3
tests-clar/revwalk/basic.c
+6
-6
tests-clar/revwalk/mergebase.c
+1
-1
tests-clar/status/submodules.c
+2
-2
tests-clar/status/worktree.c
+4
-4
No files found.
examples/diff.c
View file @
e172cf08
...
@@ -36,7 +36,7 @@ int resolve_to_tree(git_repository *repo, const char *identifier, git_tree **tre
...
@@ -36,7 +36,7 @@ int resolve_to_tree(git_repository *repo, const char *identifier, git_tree **tre
}
}
if
(
obj
==
NULL
)
if
(
obj
==
NULL
)
return
GIT_
E
NOTFOUND
;
return
GIT_NOTFOUND
;
switch
(
git_object_type
(
obj
))
{
switch
(
git_object_type
(
obj
))
{
case
GIT_OBJ_TREE
:
case
GIT_OBJ_TREE
:
...
@@ -47,7 +47,7 @@ int resolve_to_tree(git_repository *repo, const char *identifier, git_tree **tre
...
@@ -47,7 +47,7 @@ int resolve_to_tree(git_repository *repo, const char *identifier, git_tree **tre
git_object_free
(
obj
);
git_object_free
(
obj
);
break
;
break
;
default:
default:
err
=
GIT_
E
NOTFOUND
;
err
=
GIT_NOTFOUND
;
}
}
return
err
;
return
err
;
...
...
examples/general.c
View file @
e172cf08
...
@@ -335,7 +335,7 @@ int main (int argc, char** argv)
...
@@ -335,7 +335,7 @@ int main (int argc, char** argv)
// We can then lookup and parse the commited pointed at by the returned OID;
// We can then lookup and parse the commited pointed at by the returned OID;
// note that this operation is specially fast since the raw contents of the commit object will
// note that this operation is specially fast since the raw contents of the commit object will
// be cached in memory
// be cached in memory
while
((
git_revwalk_next
(
&
oid
,
walk
))
==
GIT_SUCCESS
)
{
while
((
git_revwalk_next
(
&
oid
,
walk
))
==
0
)
{
error
=
git_commit_lookup
(
&
wcommit
,
repo
,
&
oid
);
error
=
git_commit_lookup
(
&
wcommit
,
repo
,
&
oid
);
cmsg
=
git_commit_message
(
wcommit
);
cmsg
=
git_commit_message
(
wcommit
);
cauth
=
git_commit_author
(
wcommit
);
cauth
=
git_commit_author
(
wcommit
);
...
...
examples/network/git2.c
View file @
e172cf08
...
@@ -25,12 +25,12 @@ int run_command(git_cb fn, int argc, char **argv)
...
@@ -25,12 +25,12 @@ int run_command(git_cb fn, int argc, char **argv)
// repository and pass it to the function.
// repository and pass it to the function.
error
=
git_repository_open
(
&
repo
,
".git"
);
error
=
git_repository_open
(
&
repo
,
".git"
);
if
(
error
<
GIT_SUCCESS
)
if
(
error
<
0
)
repo
=
NULL
;
repo
=
NULL
;
// Run the command. If something goes wrong, print the error message to stderr
// Run the command. If something goes wrong, print the error message to stderr
error
=
fn
(
repo
,
argc
,
argv
);
error
=
fn
(
repo
,
argc
,
argv
);
if
(
error
<
GIT_SUCCESS
)
{
if
(
error
<
0
)
{
if
(
giterr_last
()
==
NULL
)
if
(
giterr_last
()
==
NULL
)
fprintf
(
stderr
,
"Error without message"
);
fprintf
(
stderr
,
"Error without message"
);
else
else
...
...
examples/network/index-pack.c
View file @
e172cf08
...
@@ -80,13 +80,13 @@ int index_pack_old(git_repository *repo, int argc, char **argv)
...
@@ -80,13 +80,13 @@ int index_pack_old(git_repository *repo, int argc, char **argv)
// Create a new indexer
// Create a new indexer
error
=
git_indexer_new
(
&
indexer
,
argv
[
1
]);
error
=
git_indexer_new
(
&
indexer
,
argv
[
1
]);
if
(
error
<
GIT_SUCCESS
)
if
(
error
<
0
)
return
error
;
return
error
;
// Index the packfile. This function can take a very long time and
// Index the packfile. This function can take a very long time and
// should be run in a worker thread.
// should be run in a worker thread.
error
=
git_indexer_run
(
indexer
,
&
stats
);
error
=
git_indexer_run
(
indexer
,
&
stats
);
if
(
error
<
GIT_SUCCESS
)
if
(
error
<
0
)
return
error
;
return
error
;
// Write the information out to an index file
// Write the information out to an index file
...
@@ -98,5 +98,5 @@ int index_pack_old(git_repository *repo, int argc, char **argv)
...
@@ -98,5 +98,5 @@ int index_pack_old(git_repository *repo, int argc, char **argv)
git_indexer_free
(
indexer
);
git_indexer_free
(
indexer
);
return
GIT_SUCCESS
;
return
0
;
}
}
examples/network/ls-remote.c
View file @
e172cf08
...
@@ -9,7 +9,7 @@ static int show_ref__cb(git_remote_head *head, void *payload)
...
@@ -9,7 +9,7 @@ static int show_ref__cb(git_remote_head *head, void *payload)
char
oid
[
GIT_OID_HEXSZ
+
1
]
=
{
0
};
char
oid
[
GIT_OID_HEXSZ
+
1
]
=
{
0
};
git_oid_fmt
(
oid
,
&
head
->
oid
);
git_oid_fmt
(
oid
,
&
head
->
oid
);
printf
(
"%s
\t
%s
\n
"
,
oid
,
head
->
name
);
printf
(
"%s
\t
%s
\n
"
,
oid
,
head
->
name
);
return
GIT_SUCCESS
;
return
0
;
}
}
int
use_unnamed
(
git_repository
*
repo
,
const
char
*
url
)
int
use_unnamed
(
git_repository
*
repo
,
const
char
*
url
)
...
@@ -20,13 +20,13 @@ int use_unnamed(git_repository *repo, const char *url)
...
@@ -20,13 +20,13 @@ int use_unnamed(git_repository *repo, const char *url)
// Create an instance of a remote from the URL. The transport to use
// Create an instance of a remote from the URL. The transport to use
// is detected from the URL
// is detected from the URL
error
=
git_remote_new
(
&
remote
,
repo
,
NULL
,
url
,
NULL
);
error
=
git_remote_new
(
&
remote
,
repo
,
NULL
,
url
,
NULL
);
if
(
error
<
GIT_SUCCESS
)
if
(
error
<
0
)
goto
cleanup
;
goto
cleanup
;
// When connecting, the underlying code needs to know wether we
// When connecting, the underlying code needs to know wether we
// want to push or fetch
// want to push or fetch
error
=
git_remote_connect
(
remote
,
GIT_DIR_FETCH
);
error
=
git_remote_connect
(
remote
,
GIT_DIR_FETCH
);
if
(
error
<
GIT_SUCCESS
)
if
(
error
<
0
)
goto
cleanup
;
goto
cleanup
;
// With git_remote_ls we can retrieve the advertised heads
// With git_remote_ls we can retrieve the advertised heads
...
@@ -44,11 +44,11 @@ int use_remote(git_repository *repo, char *name)
...
@@ -44,11 +44,11 @@ int use_remote(git_repository *repo, char *name)
// Find the remote by name
// Find the remote by name
error
=
git_remote_load
(
&
remote
,
repo
,
name
);
error
=
git_remote_load
(
&
remote
,
repo
,
name
);
if
(
error
<
GIT_SUCCESS
)
if
(
error
<
0
)
goto
cleanup
;
goto
cleanup
;
error
=
git_remote_connect
(
remote
,
GIT_DIR_FETCH
);
error
=
git_remote_connect
(
remote
,
GIT_DIR_FETCH
);
if
(
error
<
GIT_SUCCESS
)
if
(
error
<
0
)
goto
cleanup
;
goto
cleanup
;
error
=
git_remote_ls
(
remote
,
&
show_ref__cb
,
NULL
);
error
=
git_remote_ls
(
remote
,
&
show_ref__cb
,
NULL
);
...
...
include/git2/blob.h
View file @
e172cf08
...
@@ -27,7 +27,7 @@ GIT_BEGIN_DECL
...
@@ -27,7 +27,7 @@ GIT_BEGIN_DECL
* @param blob pointer to the looked up blob
* @param blob pointer to the looked up blob
* @param repo the repo to use when locating the blob.
* @param repo the repo to use when locating the blob.
* @param id identity of the blob to locate.
* @param id identity of the blob to locate.
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_INLINE
(
int
)
git_blob_lookup
(
git_blob
**
blob
,
git_repository
*
repo
,
const
git_oid
*
id
)
GIT_INLINE
(
int
)
git_blob_lookup
(
git_blob
**
blob
,
git_repository
*
repo
,
const
git_oid
*
id
)
{
{
...
@@ -44,7 +44,7 @@ GIT_INLINE(int) git_blob_lookup(git_blob **blob, git_repository *repo, const git
...
@@ -44,7 +44,7 @@ GIT_INLINE(int) git_blob_lookup(git_blob **blob, git_repository *repo, const git
* @param repo the repo to use when locating the blob.
* @param repo the repo to use when locating the blob.
* @param id identity of the blob to locate.
* @param id identity of the blob to locate.
* @param len the length of the short identifier
* @param len the length of the short identifier
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_INLINE
(
int
)
git_blob_lookup_prefix
(
git_blob
**
blob
,
git_repository
*
repo
,
const
git_oid
*
id
,
unsigned
int
len
)
GIT_INLINE
(
int
)
git_blob_lookup_prefix
(
git_blob
**
blob
,
git_repository
*
repo
,
const
git_oid
*
id
,
unsigned
int
len
)
{
{
...
@@ -99,7 +99,7 @@ GIT_EXTERN(size_t) git_blob_rawsize(git_blob *blob);
...
@@ -99,7 +99,7 @@ GIT_EXTERN(size_t) git_blob_rawsize(git_blob *blob);
* this repository cannot be bare
* this repository cannot be bare
* @param path file from which the blob will be created,
* @param path file from which the blob will be created,
* relative to the repository's working dir
* relative to the repository's working dir
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_blob_create_fromfile
(
git_oid
*
oid
,
git_repository
*
repo
,
const
char
*
path
);
GIT_EXTERN
(
int
)
git_blob_create_fromfile
(
git_oid
*
oid
,
git_repository
*
repo
,
const
char
*
path
);
...
@@ -111,7 +111,7 @@ GIT_EXTERN(int) git_blob_create_fromfile(git_oid *oid, git_repository *repo, con
...
@@ -111,7 +111,7 @@ GIT_EXTERN(int) git_blob_create_fromfile(git_oid *oid, git_repository *repo, con
* @param repo repository where the blob will be written.
* @param repo repository where the blob will be written.
* this repository can be bare or not
* this repository can be bare or not
* @param path file from which the blob will be created
* @param path file from which the blob will be created
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_blob_create_fromdisk
(
git_oid
*
oid
,
git_repository
*
repo
,
const
char
*
path
);
GIT_EXTERN
(
int
)
git_blob_create_fromdisk
(
git_oid
*
oid
,
git_repository
*
repo
,
const
char
*
path
);
...
@@ -123,7 +123,7 @@ GIT_EXTERN(int) git_blob_create_fromdisk(git_oid *oid, git_repository *repo, con
...
@@ -123,7 +123,7 @@ GIT_EXTERN(int) git_blob_create_fromdisk(git_oid *oid, git_repository *repo, con
* @param repo repository where to blob will be written
* @param repo repository where to blob will be written
* @param buffer data to be written into the blob
* @param buffer data to be written into the blob
* @param len length of the data
* @param len length of the data
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_blob_create_frombuffer
(
git_oid
*
oid
,
git_repository
*
repo
,
const
void
*
buffer
,
size_t
len
);
GIT_EXTERN
(
int
)
git_blob_create_frombuffer
(
git_oid
*
oid
,
git_repository
*
repo
,
const
void
*
buffer
,
size_t
len
);
...
...
include/git2/branch.h
View file @
e172cf08
...
@@ -41,7 +41,7 @@ GIT_BEGIN_DECL
...
@@ -41,7 +41,7 @@ GIT_BEGIN_DECL
*
*
* @param force Overwrite existing branch.
* @param force Overwrite existing branch.
*
*
* @return
GIT_SUCCESS
or an error code.
* @return
0
or an error code.
* A proper reference is written in the refs/heads namespace
* A proper reference is written in the refs/heads namespace
* pointing to the provided target commit.
* pointing to the provided target commit.
*/
*/
...
@@ -63,7 +63,7 @@ GIT_EXTERN(int) git_branch_create(
...
@@ -63,7 +63,7 @@ GIT_EXTERN(int) git_branch_create(
* @param branch_type Type of the considered branch. This should
* @param branch_type Type of the considered branch. This should
* be valued with either GIT_BRANCH_LOCAL or GIT_BRANCH_REMOTE.
* be valued with either GIT_BRANCH_LOCAL or GIT_BRANCH_REMOTE.
*
*
* @return
GIT_SUCCESS on success, GIT_E
NOTFOUND if the branch
* @return
0 on success, GIT_
NOTFOUND if the branch
* doesn't exist or an error code.
* doesn't exist or an error code.
*/
*/
GIT_EXTERN
(
int
)
git_branch_delete
(
GIT_EXTERN
(
int
)
git_branch_delete
(
...
@@ -88,7 +88,7 @@ GIT_EXTERN(int) git_branch_delete(
...
@@ -88,7 +88,7 @@ GIT_EXTERN(int) git_branch_delete(
* listing. Valid values are GIT_BRANCH_LOCAL, GIT_BRANCH_REMOTE
* listing. Valid values are GIT_BRANCH_LOCAL, GIT_BRANCH_REMOTE
* or a combination of the two.
* or a combination of the two.
*
*
* @return
GIT_SUCCESS
or an error code.
* @return
0
or an error code.
*/
*/
GIT_EXTERN
(
int
)
git_branch_list
(
GIT_EXTERN
(
int
)
git_branch_list
(
git_strarray
*
branch_names
,
git_strarray
*
branch_names
,
...
@@ -108,7 +108,7 @@ GIT_EXTERN(int) git_branch_list(
...
@@ -108,7 +108,7 @@ GIT_EXTERN(int) git_branch_list(
*
*
* @param force Overwrite existing branch.
* @param force Overwrite existing branch.
*
*
* @return
GIT_SUCCESS on success, GIT_E
NOTFOUND if the branch
* @return
0 on success, GIT_
NOTFOUND if the branch
* doesn't exist or an error code.
* doesn't exist or an error code.
*/
*/
GIT_EXTERN
(
int
)
git_branch_move
(
GIT_EXTERN
(
int
)
git_branch_move
(
...
...
include/git2/commit.h
View file @
e172cf08
...
@@ -28,7 +28,7 @@ GIT_BEGIN_DECL
...
@@ -28,7 +28,7 @@ GIT_BEGIN_DECL
* @param repo the repo to use when locating the commit.
* @param repo the repo to use when locating the commit.
* @param id identity of the commit to locate. If the object is
* @param id identity of the commit to locate. If the object is
* an annotated tag it will be peeled back to the commit.
* an annotated tag it will be peeled back to the commit.
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_INLINE
(
int
)
git_commit_lookup
(
git_commit
**
commit
,
git_repository
*
repo
,
const
git_oid
*
id
)
GIT_INLINE
(
int
)
git_commit_lookup
(
git_commit
**
commit
,
git_repository
*
repo
,
const
git_oid
*
id
)
{
{
...
@@ -46,7 +46,7 @@ GIT_INLINE(int) git_commit_lookup(git_commit **commit, git_repository *repo, con
...
@@ -46,7 +46,7 @@ GIT_INLINE(int) git_commit_lookup(git_commit **commit, git_repository *repo, con
* @param id identity of the commit to locate. If the object is
* @param id identity of the commit to locate. If the object is
* an annotated tag it will be peeled back to the commit.
* an annotated tag it will be peeled back to the commit.
* @param len the length of the short identifier
* @param len the length of the short identifier
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_INLINE
(
int
)
git_commit_lookup_prefix
(
git_commit
**
commit
,
git_repository
*
repo
,
const
git_oid
*
id
,
unsigned
len
)
GIT_INLINE
(
int
)
git_commit_lookup_prefix
(
git_commit
**
commit
,
git_repository
*
repo
,
const
git_oid
*
id
,
unsigned
len
)
{
{
...
@@ -135,7 +135,7 @@ GIT_EXTERN(const git_signature *) git_commit_author(git_commit *commit);
...
@@ -135,7 +135,7 @@ GIT_EXTERN(const git_signature *) git_commit_author(git_commit *commit);
*
*
* @param tree_out pointer where to store the tree object
* @param tree_out pointer where to store the tree object
* @param commit a previously loaded commit.
* @param commit a previously loaded commit.
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_commit_tree
(
git_tree
**
tree_out
,
git_commit
*
commit
);
GIT_EXTERN
(
int
)
git_commit_tree
(
git_tree
**
tree_out
,
git_commit
*
commit
);
...
@@ -163,7 +163,7 @@ GIT_EXTERN(unsigned int) git_commit_parentcount(git_commit *commit);
...
@@ -163,7 +163,7 @@ GIT_EXTERN(unsigned int) git_commit_parentcount(git_commit *commit);
* @param parent Pointer where to store the parent commit
* @param parent Pointer where to store the parent commit
* @param commit a previously loaded commit.
* @param commit a previously loaded commit.
* @param n the position of the parent (from 0 to `parentcount`)
* @param n the position of the parent (from 0 to `parentcount`)
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_commit_parent
(
git_commit
**
parent
,
git_commit
*
commit
,
unsigned
int
n
);
GIT_EXTERN
(
int
)
git_commit_parent
(
git_commit
**
parent
,
git_commit
*
commit
,
unsigned
int
n
);
...
@@ -221,7 +221,7 @@ GIT_EXTERN(const git_oid *) git_commit_parent_oid(git_commit *commit, unsigned i
...
@@ -221,7 +221,7 @@ GIT_EXTERN(const git_oid *) git_commit_parent_oid(git_commit *commit, unsigned i
* array may be NULL if `parent_count` is 0 (root commit). All the
* array may be NULL if `parent_count` is 0 (root commit). All the
* given commits must be owned by the `repo`.
* given commits must be owned by the `repo`.
*
*
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
* The created commit will be written to the Object Database and
* The created commit will be written to the Object Database and
* the given reference will be updated to point to it
* the given reference will be updated to point to it
*/
*/
...
...
include/git2/config.h
View file @
e172cf08
...
@@ -62,7 +62,7 @@ typedef struct {
...
@@ -62,7 +62,7 @@ typedef struct {
* global configuration file.
* global configuration file.
*
*
* @param global_config_path Buffer of GIT_PATH_MAX length to store the path
* @param global_config_path Buffer of GIT_PATH_MAX length to store the path
* @return
GIT_SUCCESS
if a global configuration file has been
* @return
0
if a global configuration file has been
* found. Its path will be stored in `buffer`.
* found. Its path will be stored in `buffer`.
*/
*/
GIT_EXTERN
(
int
)
git_config_find_global
(
char
*
global_config_path
,
size_t
length
);
GIT_EXTERN
(
int
)
git_config_find_global
(
char
*
global_config_path
,
size_t
length
);
...
@@ -74,7 +74,7 @@ GIT_EXTERN(int) git_config_find_global(char *global_config_path, size_t length);
...
@@ -74,7 +74,7 @@ GIT_EXTERN(int) git_config_find_global(char *global_config_path, size_t length);
* %PROGRAMFILES%\Git\etc\gitconfig.
* %PROGRAMFILES%\Git\etc\gitconfig.
* @param system_config_path Buffer of GIT_PATH_MAX length to store the path
* @param system_config_path Buffer of GIT_PATH_MAX length to store the path
* @return
GIT_SUCCESS
if a system configuration file has been
* @return
0
if a system configuration file has been
* found. Its path will be stored in `buffer`.
* found. Its path will be stored in `buffer`.
*/
*/
GIT_EXTERN
(
int
)
git_config_find_system
(
char
*
system_config_path
,
size_t
length
);
GIT_EXTERN
(
int
)
git_config_find_system
(
char
*
system_config_path
,
size_t
length
);
...
@@ -86,7 +86,7 @@ GIT_EXTERN(int) git_config_find_system(char *system_config_path, size_t length);
...
@@ -86,7 +86,7 @@ GIT_EXTERN(int) git_config_find_system(char *system_config_path, size_t length);
* and opens the located file, if it exists.
* and opens the located file, if it exists.
*
*
* @param out Pointer to store the config instance
* @param out Pointer to store the config instance
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_config_open_global
(
git_config
**
out
);
GIT_EXTERN
(
int
)
git_config_open_global
(
git_config
**
out
);
...
@@ -110,7 +110,7 @@ GIT_EXTERN(int) git_config_file__ondisk(struct git_config_file **out, const char
...
@@ -110,7 +110,7 @@ GIT_EXTERN(int) git_config_file__ondisk(struct git_config_file **out, const char
* can do anything with it.
* can do anything with it.
*
*
* @param out pointer to the new configuration
* @param out pointer to the new configuration
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_config_new
(
git_config
**
out
);
GIT_EXTERN
(
int
)
git_config_new
(
git_config
**
out
);
...
@@ -127,7 +127,7 @@ GIT_EXTERN(int) git_config_new(git_config **out);
...
@@ -127,7 +127,7 @@ GIT_EXTERN(int) git_config_new(git_config **out);
* @param cfg the configuration to add the file to
* @param cfg the configuration to add the file to
* @param file the configuration file (backend) to add
* @param file the configuration file (backend) to add
* @param priority the priority the backend should have
* @param priority the priority the backend should have
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_config_add_file
(
git_config
*
cfg
,
git_config_file
*
file
,
int
priority
);
GIT_EXTERN
(
int
)
git_config_add_file
(
git_config
*
cfg
,
git_config_file
*
file
,
int
priority
);
...
@@ -148,7 +148,7 @@ GIT_EXTERN(int) git_config_add_file(git_config *cfg, git_config_file *file, int
...
@@ -148,7 +148,7 @@ GIT_EXTERN(int) git_config_add_file(git_config *cfg, git_config_file *file, int
* @param cfg the configuration to add the file to
* @param cfg the configuration to add the file to
* @param path path to the configuration file (backend) to add
* @param path path to the configuration file (backend) to add
* @param priority the priority the backend should have
* @param priority the priority the backend should have
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_config_add_file_ondisk
(
git_config
*
cfg
,
const
char
*
path
,
int
priority
);
GIT_EXTERN
(
int
)
git_config_add_file_ondisk
(
git_config
*
cfg
,
const
char
*
path
,
int
priority
);
...
@@ -163,7 +163,7 @@ GIT_EXTERN(int) git_config_add_file_ondisk(git_config *cfg, const char *path, in
...
@@ -163,7 +163,7 @@ GIT_EXTERN(int) git_config_add_file_ondisk(git_config *cfg, const char *path, in
*
*
* @param cfg The configuration instance to create
* @param cfg The configuration instance to create
* @param path Path to the on-disk file to open
* @param path Path to the on-disk file to open
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_config_open_ondisk
(
git_config
**
cfg
,
const
char
*
path
);
GIT_EXTERN
(
int
)
git_config_open_ondisk
(
git_config
**
cfg
,
const
char
*
path
);
...
@@ -180,7 +180,7 @@ GIT_EXTERN(void) git_config_free(git_config *cfg);
...
@@ -180,7 +180,7 @@ GIT_EXTERN(void) git_config_free(git_config *cfg);
* @param out pointer to the variable where the value should be stored
* @param out pointer to the variable where the value should be stored
* @param cfg where to look for the variable
* @param cfg where to look for the variable
* @param name the variable's name
* @param name the variable's name
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_config_get_int32
(
int32_t
*
out
,
git_config
*
cfg
,
const
char
*
name
);
GIT_EXTERN
(
int
)
git_config_get_int32
(
int32_t
*
out
,
git_config
*
cfg
,
const
char
*
name
);
...
@@ -190,7 +190,7 @@ GIT_EXTERN(int) git_config_get_int32(int32_t *out, git_config *cfg, const char *
...
@@ -190,7 +190,7 @@ GIT_EXTERN(int) git_config_get_int32(int32_t *out, git_config *cfg, const char *
* @param out pointer to the variable where the value should be stored
* @param out pointer to the variable where the value should be stored
* @param cfg where to look for the variable
* @param cfg where to look for the variable
* @param name the variable's name
* @param name the variable's name
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_config_get_int64
(
int64_t
*
out
,
git_config
*
cfg
,
const
char
*
name
);
GIT_EXTERN
(
int
)
git_config_get_int64
(
int64_t
*
out
,
git_config
*
cfg
,
const
char
*
name
);
...
@@ -203,7 +203,7 @@ GIT_EXTERN(int) git_config_get_int64(int64_t *out, git_config *cfg, const char *
...
@@ -203,7 +203,7 @@ GIT_EXTERN(int) git_config_get_int64(int64_t *out, git_config *cfg, const char *
* @param out pointer to the variable where the value should be stored
* @param out pointer to the variable where the value should be stored
* @param cfg where to look for the variable
* @param cfg where to look for the variable
* @param name the variable's name
* @param name the variable's name
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_config_get_bool
(
int
*
out
,
git_config
*
cfg
,
const
char
*
name
);
GIT_EXTERN
(
int
)
git_config_get_bool
(
int
*
out
,
git_config
*
cfg
,
const
char
*
name
);
...
@@ -216,7 +216,7 @@ GIT_EXTERN(int) git_config_get_bool(int *out, git_config *cfg, const char *name)
...
@@ -216,7 +216,7 @@ GIT_EXTERN(int) git_config_get_bool(int *out, git_config *cfg, const char *name)
* @param out pointer to the variable's value
* @param out pointer to the variable's value
* @param cfg where to look for the variable
* @param cfg where to look for the variable
* @param name the variable's name
* @param name the variable's name
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_config_get_string
(
const
char
**
out
,
git_config
*
cfg
,
const
char
*
name
);
GIT_EXTERN
(
int
)
git_config_get_string
(
const
char
**
out
,
git_config
*
cfg
,
const
char
*
name
);
...
@@ -240,7 +240,7 @@ GIT_EXTERN(int) git_config_get_multivar(git_config *cfg, const char *name, const
...
@@ -240,7 +240,7 @@ GIT_EXTERN(int) git_config_get_multivar(git_config *cfg, const char *name, const
* @param cfg where to look for the variable
* @param cfg where to look for the variable
* @param name the variable's name
* @param name the variable's name
* @param value Integer value for the variable
* @param value Integer value for the variable
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_config_set_int32
(
git_config
*
cfg
,
const
char
*
name
,
int32_t
value
);
GIT_EXTERN
(
int
)
git_config_set_int32
(
git_config
*
cfg
,
const
char
*
name
,
int32_t
value
);
...
@@ -250,7 +250,7 @@ GIT_EXTERN(int) git_config_set_int32(git_config *cfg, const char *name, int32_t
...
@@ -250,7 +250,7 @@ GIT_EXTERN(int) git_config_set_int32(git_config *cfg, const char *name, int32_t
* @param cfg where to look for the variable
* @param cfg where to look for the variable
* @param name the variable's name
* @param name the variable's name
* @param value Long integer value for the variable
* @param value Long integer value for the variable
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_config_set_int64
(
git_config
*
cfg
,
const
char
*
name
,
int64_t
value
);
GIT_EXTERN
(
int
)
git_config_set_int64
(
git_config
*
cfg
,
const
char
*
name
,
int64_t
value
);
...
@@ -260,7 +260,7 @@ GIT_EXTERN(int) git_config_set_int64(git_config *cfg, const char *name, int64_t
...
@@ -260,7 +260,7 @@ GIT_EXTERN(int) git_config_set_int64(git_config *cfg, const char *name, int64_t
* @param cfg where to look for the variable
* @param cfg where to look for the variable
* @param name the variable's name
* @param name the variable's name
* @param value the value to store
* @param value the value to store
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_config_set_bool
(
git_config
*
cfg
,
const
char
*
name
,
int
value
);
GIT_EXTERN
(
int
)
git_config_set_bool
(
git_config
*
cfg
,
const
char
*
name
,
int
value
);
...
@@ -273,7 +273,7 @@ GIT_EXTERN(int) git_config_set_bool(git_config *cfg, const char *name, int value
...
@@ -273,7 +273,7 @@ GIT_EXTERN(int) git_config_set_bool(git_config *cfg, const char *name, int value
* @param cfg where to look for the variable
* @param cfg where to look for the variable
* @param name the variable's name
* @param name the variable's name
* @param value the string to store.
* @param value the string to store.
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_config_set_string
(
git_config
*
cfg
,
const
char
*
name
,
const
char
*
value
);
GIT_EXTERN
(
int
)
git_config_set_string
(
git_config
*
cfg
,
const
char
*
name
,
const
char
*
value
);
...
@@ -307,7 +307,7 @@ GIT_EXTERN(int) git_config_delete(git_config *cfg, const char *name);
...
@@ -307,7 +307,7 @@ GIT_EXTERN(int) git_config_delete(git_config *cfg, const char *name);
* @param cfg where to get the variables from
* @param cfg where to get the variables from
* @param callback the function to call on each variable
* @param callback the function to call on each variable
* @param payload the data to pass to the callback
* @param payload the data to pass to the callback
* @return
GIT_SUCCESS
or the return value of the callback which didn't return 0
* @return
0
or the return value of the callback which didn't return 0
*/
*/
GIT_EXTERN
(
int
)
git_config_foreach
(
GIT_EXTERN
(
int
)
git_config_foreach
(
git_config
*
cfg
,
git_config
*
cfg
,
...
@@ -347,7 +347,7 @@ GIT_EXTERN(int) git_config_foreach(
...
@@ -347,7 +347,7 @@ GIT_EXTERN(int) git_config_foreach(
* @param name name of the config variable to lookup
* @param name name of the config variable to lookup
* @param maps array of `git_cvar_map` objects specifying the possible mappings
* @param maps array of `git_cvar_map` objects specifying the possible mappings
* @param map_n number of mapping objects in `maps`
* @param map_n number of mapping objects in `maps`
* @return
GIT_SUCCESS
on success, error code otherwise
* @return
0
on success, error code otherwise
*/
*/
GIT_EXTERN
(
int
)
git_config_get_mapped
(
int
*
out
,
git_config
*
cfg
,
const
char
*
name
,
git_cvar_map
*
maps
,
size_t
map_n
);
GIT_EXTERN
(
int
)
git_config_get_mapped
(
int
*
out
,
git_config
*
cfg
,
const
char
*
name
,
git_cvar_map
*
maps
,
size_t
map_n
);
...
...
include/git2/errors.h
View file @
e172cf08
...
@@ -17,17 +17,54 @@
...
@@ -17,17 +17,54 @@
*/
*/
GIT_BEGIN_DECL
GIT_BEGIN_DECL
typedef
enum
{
#ifdef GIT_OLD_ERRORS
enum
{
GIT_SUCCESS
=
0
,
GIT_SUCCESS
=
0
,
GIT_E
RROR
=
-
1
,
GIT_E
NOTOID
=
-
2
,
GIT_ENOTFOUND
=
-
3
,
GIT_ENOTFOUND
=
-
3
,
GIT_ENOMEM
=
-
4
,
GIT_EOSERR
=
-
5
,
GIT_EOBJTYPE
=
-
6
,
GIT_ENOTAREPO
=
-
7
,
GIT_EINVALIDTYPE
=
-
8
,
GIT_EMISSINGOBJDATA
=
-
9
,
GIT_EPACKCORRUPTED
=
-
10
,
GIT_EFLOCKFAIL
=
-
11
,
GIT_EZLIB
=
-
12
,
GIT_EBUSY
=
-
13
,
GIT_EBAREINDEX
=
-
14
,
GIT_EINVALIDREFNAME
=
-
15
,
GIT_EREFCORRUPTED
=
-
16
,
GIT_ETOONESTEDSYMREF
=
-
17
,
GIT_EPACKEDREFSCORRUPTED
=
-
18
,
GIT_EINVALIDPATH
=
-
19
,
GIT_EREVWALKOVER
=
-
20
,
GIT_EINVALIDREFSTATE
=
-
21
,
GIT_ENOTIMPLEMENTED
=
-
22
,
GIT_EEXISTS
=
-
23
,
GIT_EEXISTS
=
-
23
,
GIT_EOVERFLOW
=
-
24
,
GIT_EOVERFLOW
=
-
24
,
GIT_ENOTNUM
=
-
25
,
GIT_ESTREAM
=
-
26
,
GIT_EINVALIDARGS
=
-
27
,
GIT_EOBJCORRUPTED
=
-
28
,
GIT_EAMBIGUOUS
=
-
29
,
GIT_EAMBIGUOUS
=
-
29
,
GIT_EPASSTHROUGH
=
-
30
,
GIT_EPASSTHROUGH
=
-
30
,
GIT_ENOMATCH
=
-
31
,
GIT_ESHORTBUFFER
=
-
32
,
GIT_ESHORTBUFFER
=
-
32
,
GIT_EREVWALKOVER
=
-
33
,
};
}
git_error_t
;
#endif
/** Generic return codes */
enum
{
GIT_OK
=
0
,
GIT_ERROR
=
-
1
,
GIT_NOTFOUND
=
-
3
,
GIT_EXISTS
=
-
23
,
GIT_AMBIGUOUS
=
-
29
,
GIT_PASSTHROUGH
=
-
30
,
GIT_SHORTBUFFER
=
-
32
,
GIT_REVWALKOVER
=
-
33
,
};
typedef
struct
{
typedef
struct
{
char
*
message
;
char
*
message
;
...
@@ -50,7 +87,7 @@ typedef enum {
...
@@ -50,7 +87,7 @@ typedef enum {
GITERR_TAG
,
GITERR_TAG
,
GITERR_TREE
,
GITERR_TREE
,
GITERR_INDEXER
,
GITERR_INDEXER
,
}
git_error_
class
;
}
git_error_
t
;
/**
/**
* Return the last `git_error` object that was generated for the
* Return the last `git_error` object that was generated for the
...
...
include/git2/index.h
View file @
e172cf08
...
@@ -106,7 +106,7 @@ typedef struct git_index_entry_unmerged {
...
@@ -106,7 +106,7 @@ typedef struct git_index_entry_unmerged {
*
*
* @param index the pointer for the new index
* @param index the pointer for the new index
* @param index_path the path to the index file in disk
* @param index_path the path to the index file in disk
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_index_open
(
git_index
**
index
,
const
char
*
index_path
);
GIT_EXTERN
(
int
)
git_index_open
(
git_index
**
index
,
const
char
*
index_path
);
...
@@ -131,7 +131,7 @@ GIT_EXTERN(void) git_index_free(git_index *index);
...
@@ -131,7 +131,7 @@ GIT_EXTERN(void) git_index_free(git_index *index);
* by reading from the hard disk.
* by reading from the hard disk.
*
*
* @param index an existing index object
* @param index an existing index object
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_index_read
(
git_index
*
index
);
GIT_EXTERN
(
int
)
git_index_read
(
git_index
*
index
);
...
@@ -140,7 +140,7 @@ GIT_EXTERN(int) git_index_read(git_index *index);
...
@@ -140,7 +140,7 @@ GIT_EXTERN(int) git_index_read(git_index *index);
* using an atomic file lock.
* using an atomic file lock.
*
*
* @param index an existing index object
* @param index an existing index object
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_index_write
(
git_index
*
index
);
GIT_EXTERN
(
int
)
git_index_write
(
git_index
*
index
);
...
@@ -176,7 +176,7 @@ GIT_EXTERN(void) git_index_uniq(git_index *index);
...
@@ -176,7 +176,7 @@ GIT_EXTERN(void) git_index_uniq(git_index *index);
* @param index an existing index object
* @param index an existing index object
* @param path filename to add
* @param path filename to add
* @param stage stage for the entry
* @param stage stage for the entry
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_index_add
(
git_index
*
index
,
const
char
*
path
,
int
stage
);
GIT_EXTERN
(
int
)
git_index_add
(
git_index
*
index
,
const
char
*
path
,
int
stage
);
...
@@ -188,7 +188,7 @@ GIT_EXTERN(int) git_index_add(git_index *index, const char *path, int stage);
...
@@ -188,7 +188,7 @@ GIT_EXTERN(int) git_index_add(git_index *index, const char *path, int stage);
*
*
* @param index an existing index object
* @param index an existing index object
* @param source_entry new entry object
* @param source_entry new entry object
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_index_add2
(
git_index
*
index
,
const
git_index_entry
*
source_entry
);
GIT_EXTERN
(
int
)
git_index_add2
(
git_index
*
index
,
const
git_index_entry
*
source_entry
);
...
@@ -207,7 +207,7 @@ GIT_EXTERN(int) git_index_add2(git_index *index, const git_index_entry *source_e
...
@@ -207,7 +207,7 @@ GIT_EXTERN(int) git_index_add2(git_index *index, const git_index_entry *source_e
* @param index an existing index object
* @param index an existing index object
* @param path filename to add
* @param path filename to add
* @param stage stage for the entry
* @param stage stage for the entry
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_index_append
(
git_index
*
index
,
const
char
*
path
,
int
stage
);
GIT_EXTERN
(
int
)
git_index_append
(
git_index
*
index
,
const
char
*
path
,
int
stage
);
...
@@ -224,7 +224,7 @@ GIT_EXTERN(int) git_index_append(git_index *index, const char *path, int stage);
...
@@ -224,7 +224,7 @@ GIT_EXTERN(int) git_index_append(git_index *index, const char *path, int stage);
*
*
* @param index an existing index object
* @param index an existing index object
* @param source_entry new entry object
* @param source_entry new entry object
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_index_append2
(
git_index
*
index
,
const
git_index_entry
*
source_entry
);
GIT_EXTERN
(
int
)
git_index_append2
(
git_index
*
index
,
const
git_index_entry
*
source_entry
);
...
@@ -233,7 +233,7 @@ GIT_EXTERN(int) git_index_append2(git_index *index, const git_index_entry *sourc
...
@@ -233,7 +233,7 @@ GIT_EXTERN(int) git_index_append2(git_index *index, const git_index_entry *sourc
*
*
* @param index an existing index object
* @param index an existing index object
* @param position position of the entry to remove
* @param position position of the entry to remove
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_index_remove
(
git_index
*
index
,
int
position
);
GIT_EXTERN
(
int
)
git_index_remove
(
git_index
*
index
,
int
position
);
...
@@ -312,7 +312,7 @@ GIT_EXTERN(int) git_index_entry_stage(const git_index_entry *entry);
...
@@ -312,7 +312,7 @@ GIT_EXTERN(int) git_index_entry_stage(const git_index_entry *entry);
*
*
* @param index an existing index object
* @param index an existing index object
* @param tree tree to read
* @param tree tree to read
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_index_read_tree
(
git_index
*
index
,
git_tree
*
tree
);
GIT_EXTERN
(
int
)
git_index_read_tree
(
git_index
*
index
,
git_tree
*
tree
);
...
...
include/git2/notes.h
View file @
e172cf08
...
@@ -28,7 +28,7 @@ GIT_BEGIN_DECL
...
@@ -28,7 +28,7 @@ GIT_BEGIN_DECL
* @param notes_ref OID reference to use (optional); defaults to "refs/notes/commits"
* @param notes_ref OID reference to use (optional); defaults to "refs/notes/commits"
* @param oid OID of the object
* @param oid OID of the object
*
*
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_note_read
(
git_note
**
note
,
git_repository
*
repo
,
GIT_EXTERN
(
int
)
git_note_read
(
git_note
**
note
,
git_repository
*
repo
,
const
char
*
notes_ref
,
const
git_oid
*
oid
);
const
char
*
notes_ref
,
const
git_oid
*
oid
);
...
@@ -62,7 +62,7 @@ GIT_EXTERN(const git_oid *) git_note_oid(git_note *note);
...
@@ -62,7 +62,7 @@ GIT_EXTERN(const git_oid *) git_note_oid(git_note *note);
* @param oid The OID of the object
* @param oid The OID of the object
* @param oid The note to add for object oid
* @param oid The note to add for object oid
*
*
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_note_create
(
git_oid
*
out
,
git_repository
*
repo
,
GIT_EXTERN
(
int
)
git_note_create
(
git_oid
*
out
,
git_repository
*
repo
,
git_signature
*
author
,
git_signature
*
committer
,
git_signature
*
author
,
git_signature
*
committer
,
...
@@ -79,7 +79,7 @@ GIT_EXTERN(int) git_note_create(git_oid *out, git_repository *repo,
...
@@ -79,7 +79,7 @@ GIT_EXTERN(int) git_note_create(git_oid *out, git_repository *repo,
* @param committer signature of the notes commit committer
* @param committer signature of the notes commit committer
* @param oid the oid which note's to be removed
* @param oid the oid which note's to be removed
*
*
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_note_remove
(
git_repository
*
repo
,
const
char
*
notes_ref
,
GIT_EXTERN
(
int
)
git_note_remove
(
git_repository
*
repo
,
const
char
*
notes_ref
,
git_signature
*
author
,
git_signature
*
committer
,
git_signature
*
author
,
git_signature
*
committer
,
...
@@ -98,7 +98,7 @@ GIT_EXTERN(void) git_note_free(git_note *note);
...
@@ -98,7 +98,7 @@ GIT_EXTERN(void) git_note_free(git_note *note);
* @param out Pointer to the default notes reference
* @param out Pointer to the default notes reference
* @param repo The Git repository
* @param repo The Git repository
*
*
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_note_default_ref
(
const
char
**
out
,
git_repository
*
repo
);
GIT_EXTERN
(
int
)
git_note_default_ref
(
const
char
**
out
,
git_repository
*
repo
);
...
@@ -125,7 +125,7 @@ typedef struct {
...
@@ -125,7 +125,7 @@ typedef struct {
*
*
* @param payload Extra parameter to callback function.
* @param payload Extra parameter to callback function.
*
*
* @return
GIT_SUCCESS
or an error code.
* @return
0
or an error code.
*/
*/
GIT_EXTERN
(
int
)
git_note_foreach
(
GIT_EXTERN
(
int
)
git_note_foreach
(
git_repository
*
repo
,
git_repository
*
repo
,
...
...
include/git2/object.h
View file @
e172cf08
...
@@ -69,7 +69,7 @@ GIT_EXTERN(int) git_object_lookup(
...
@@ -69,7 +69,7 @@ GIT_EXTERN(int) git_object_lookup(
* @param id a short identifier for the object
* @param id a short identifier for the object
* @param len the length of the short identifier
* @param len the length of the short identifier
* @param type the type of the object
* @param type the type of the object
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_object_lookup_prefix
(
GIT_EXTERN
(
int
)
git_object_lookup_prefix
(
git_object
**
object_out
,
git_object
**
object_out
,
...
...
include/git2/odb.h
View file @
e172cf08
...
@@ -29,7 +29,7 @@ GIT_BEGIN_DECL
...
@@ -29,7 +29,7 @@ GIT_BEGIN_DECL
*
*
* @param out location to store the database pointer, if opened.
* @param out location to store the database pointer, if opened.
* Set to NULL if the open failed.
* Set to NULL if the open failed.
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_odb_new
(
git_odb
**
out
);
GIT_EXTERN
(
int
)
git_odb_new
(
git_odb
**
out
);
...
@@ -47,7 +47,7 @@ GIT_EXTERN(int) git_odb_new(git_odb **out);
...
@@ -47,7 +47,7 @@ GIT_EXTERN(int) git_odb_new(git_odb **out);
* @param out location to store the database pointer, if opened.
* @param out location to store the database pointer, if opened.
* Set to NULL if the open failed.
* Set to NULL if the open failed.
* @param objects_dir path of the backends' "objects" directory.
* @param objects_dir path of the backends' "objects" directory.
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_odb_open
(
git_odb
**
out
,
const
char
*
objects_dir
);
GIT_EXTERN
(
int
)
git_odb_open
(
git_odb
**
out
,
const
char
*
objects_dir
);
...
@@ -108,8 +108,8 @@ GIT_EXTERN(void) git_odb_free(git_odb *db);
...
@@ -108,8 +108,8 @@ GIT_EXTERN(void) git_odb_free(git_odb *db);
* @param db database to search for the object in.
* @param db database to search for the object in.
* @param id identity of the object to read.
* @param id identity of the object to read.
* @return
* @return
* -
GIT_SUCCESS
if the object was read;
* -
0
if the object was read;
* - GIT_
E
NOTFOUND if the object is not in the database.
* - GIT_NOTFOUND if the object is not in the database.
*/
*/
GIT_EXTERN
(
int
)
git_odb_read
(
git_odb_object
**
out
,
git_odb
*
db
,
const
git_oid
*
id
);
GIT_EXTERN
(
int
)
git_odb_read
(
git_odb_object
**
out
,
git_odb
*
db
,
const
git_oid
*
id
);
...
@@ -135,9 +135,9 @@ GIT_EXTERN(int) git_odb_read(git_odb_object **out, git_odb *db, const git_oid *i
...
@@ -135,9 +135,9 @@ GIT_EXTERN(int) git_odb_read(git_odb_object **out, git_odb *db, const git_oid *i
* @param db database to search for the object in.
* @param db database to search for the object in.
* @param short_id a prefix of the id of the object to read.
* @param short_id a prefix of the id of the object to read.
* @param len the length of the prefix
* @param len the length of the prefix
* @return
GIT_SUCCESS
if the object was read;
* @return
0
if the object was read;
* GIT_
E
NOTFOUND if the object is not in the database.
* GIT_NOTFOUND if the object is not in the database.
* GIT_
E
AMBIGUOUS if the prefix is ambiguous (several objects match the prefix)
* GIT_AMBIGUOUS if the prefix is ambiguous (several objects match the prefix)
*/
*/
GIT_EXTERN
(
int
)
git_odb_read_prefix
(
git_odb_object
**
out
,
git_odb
*
db
,
const
git_oid
*
short_id
,
unsigned
int
len
);
GIT_EXTERN
(
int
)
git_odb_read_prefix
(
git_odb_object
**
out
,
git_odb
*
db
,
const
git_oid
*
short_id
,
unsigned
int
len
);
...
@@ -156,8 +156,8 @@ GIT_EXTERN(int) git_odb_read_prefix(git_odb_object **out, git_odb *db, const git
...
@@ -156,8 +156,8 @@ GIT_EXTERN(int) git_odb_read_prefix(git_odb_object **out, git_odb *db, const git
* @param db database to search for the object in.
* @param db database to search for the object in.
* @param id identity of the object to read.
* @param id identity of the object to read.
* @return
* @return
* -
GIT_SUCCESS
if the object was read;
* -
0
if the object was read;
* - GIT_
E
NOTFOUND if the object is not in the database.
* - GIT_NOTFOUND if the object is not in the database.
*/
*/
GIT_EXTERN
(
int
)
git_odb_read_header
(
size_t
*
len_p
,
git_otype
*
type_p
,
git_odb
*
db
,
const
git_oid
*
id
);
GIT_EXTERN
(
int
)
git_odb_read_header
(
size_t
*
len_p
,
git_otype
*
type_p
,
git_odb
*
db
,
const
git_oid
*
id
);
...
@@ -188,7 +188,7 @@ GIT_EXTERN(int) git_odb_exists(git_odb *db, const git_oid *id);
...
@@ -188,7 +188,7 @@ GIT_EXTERN(int) git_odb_exists(git_odb *db, const git_oid *id);
* @param data buffer with the data to storr
* @param data buffer with the data to storr
* @param len size of the buffer
* @param len size of the buffer
* @param type type of the data to store
* @param type type of the data to store
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_odb_write
(
git_oid
*
oid
,
git_odb
*
odb
,
const
void
*
data
,
size_t
len
,
git_otype
type
);
GIT_EXTERN
(
int
)
git_odb_write
(
git_oid
*
oid
,
git_odb
*
odb
,
const
void
*
data
,
size_t
len
,
git_otype
type
);
...
@@ -257,7 +257,7 @@ GIT_EXTERN(int) git_odb_open_rstream(git_odb_stream **stream, git_odb *db, const
...
@@ -257,7 +257,7 @@ GIT_EXTERN(int) git_odb_open_rstream(git_odb_stream **stream, git_odb *db, const
* @param data data to hash
* @param data data to hash
* @param len size of the data
* @param len size of the data
* @param type of the data to hash
* @param type of the data to hash
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_odb_hash
(
git_oid
*
id
,
const
void
*
data
,
size_t
len
,
git_otype
type
);
GIT_EXTERN
(
int
)
git_odb_hash
(
git_oid
*
id
,
const
void
*
data
,
size_t
len
,
git_otype
type
);
...
@@ -270,7 +270,7 @@ GIT_EXTERN(int) git_odb_hash(git_oid *id, const void *data, size_t len, git_otyp
...
@@ -270,7 +270,7 @@ GIT_EXTERN(int) git_odb_hash(git_oid *id, const void *data, size_t len, git_otyp
* @param out oid structure the result is written into.
* @param out oid structure the result is written into.
* @param path file to read and determine object id for
* @param path file to read and determine object id for
* @param type the type of the object that will be hashed
* @param type the type of the object that will be hashed
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_odb_hashfile
(
git_oid
*
out
,
const
char
*
path
,
git_otype
type
);
GIT_EXTERN
(
int
)
git_odb_hashfile
(
git_oid
*
out
,
const
char
*
path
,
git_otype
type
);
...
...
include/git2/oid.h
View file @
e172cf08
...
@@ -43,7 +43,7 @@ struct _git_oid {
...
@@ -43,7 +43,7 @@ struct _git_oid {
* @param str input hex string; must be pointing at the start of
* @param str input hex string; must be pointing at the start of
* the hex sequence and have at least the number of bytes
* the hex sequence and have at least the number of bytes
* needed for an oid encoded in hex (40 bytes).
* needed for an oid encoded in hex (40 bytes).
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_oid_fromstr
(
git_oid
*
out
,
const
char
*
str
);
GIT_EXTERN
(
int
)
git_oid_fromstr
(
git_oid
*
out
,
const
char
*
str
);
...
@@ -56,7 +56,7 @@ GIT_EXTERN(int) git_oid_fromstr(git_oid *out, const char *str);
...
@@ -56,7 +56,7 @@ GIT_EXTERN(int) git_oid_fromstr(git_oid *out, const char *str);
* @param out oid structure the result is written into.
* @param out oid structure the result is written into.
* @param str input hex string of at least size `length`
* @param str input hex string of at least size `length`
* @param length length of the input string
* @param length length of the input string
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_oid_fromstrn
(
git_oid
*
out
,
const
char
*
str
,
size_t
length
);
GIT_EXTERN
(
int
)
git_oid_fromstrn
(
git_oid
*
out
,
const
char
*
str
,
size_t
length
);
...
@@ -155,7 +155,7 @@ GIT_EXTERN(int) git_oid_ncmp(const git_oid *a, const git_oid *b, unsigned int le
...
@@ -155,7 +155,7 @@ GIT_EXTERN(int) git_oid_ncmp(const git_oid *a, const git_oid *b, unsigned int le
* @param a oid structure.
* @param a oid structure.
* @param str input hex string of an object id.
* @param str input hex string of an object id.
* @return GIT_ENOTOID if str is not a valid hex string,
* @return GIT_ENOTOID if str is not a valid hex string,
*
GIT_SUCCESS
in case of a match, GIT_ERROR otherwise.
*
0
in case of a match, GIT_ERROR otherwise.
*/
*/
GIT_EXTERN
(
int
)
git_oid_streq
(
const
git_oid
*
a
,
const
char
*
str
);
GIT_EXTERN
(
int
)
git_oid_streq
(
const
git_oid
*
a
,
const
char
*
str
);
...
...
include/git2/reflog.h
View file @
e172cf08
...
@@ -28,7 +28,7 @@ GIT_BEGIN_DECL
...
@@ -28,7 +28,7 @@ GIT_BEGIN_DECL
*
*
* @param reflog pointer to reflog
* @param reflog pointer to reflog
* @param ref reference to read the reflog for
* @param ref reference to read the reflog for
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_reflog_read
(
git_reflog
**
reflog
,
git_reference
*
ref
);
GIT_EXTERN
(
int
)
git_reflog_read
(
git_reflog
**
reflog
,
git_reference
*
ref
);
...
@@ -46,7 +46,7 @@ GIT_EXTERN(int) git_reflog_read(git_reflog **reflog, git_reference *ref);
...
@@ -46,7 +46,7 @@ GIT_EXTERN(int) git_reflog_read(git_reflog **reflog, git_reference *ref);
* @param oid_old the OID the reference was pointing to
* @param oid_old the OID the reference was pointing to
* @param committer the signature of the committer
* @param committer the signature of the committer
* @param msg the reflog message
* @param msg the reflog message
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_reflog_write
(
git_reference
*
ref
,
const
git_oid
*
oid_old
,
const
git_signature
*
committer
,
const
char
*
msg
);
GIT_EXTERN
(
int
)
git_reflog_write
(
git_reference
*
ref
,
const
git_oid
*
oid_old
,
const
git_signature
*
committer
,
const
char
*
msg
);
...
@@ -55,7 +55,7 @@ GIT_EXTERN(int) git_reflog_write(git_reference *ref, const git_oid *oid_old, con
...
@@ -55,7 +55,7 @@ GIT_EXTERN(int) git_reflog_write(git_reference *ref, const git_oid *oid_old, con
*
*
* @param ref the reference
* @param ref the reference
* @param new_name the new name of the reference
* @param new_name the new name of the reference
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_reflog_rename
(
git_reference
*
ref
,
const
char
*
new_name
);
GIT_EXTERN
(
int
)
git_reflog_rename
(
git_reference
*
ref
,
const
char
*
new_name
);
...
@@ -63,7 +63,7 @@ GIT_EXTERN(int) git_reflog_rename(git_reference *ref, const char *new_name);
...
@@ -63,7 +63,7 @@ GIT_EXTERN(int) git_reflog_rename(git_reference *ref, const char *new_name);
* Delete the reflog for the given reference
* Delete the reflog for the given reference
*
*
* @param ref the reference
* @param ref the reference
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_reflog_delete
(
git_reference
*
ref
);
GIT_EXTERN
(
int
)
git_reflog_delete
(
git_reference
*
ref
);
...
...
include/git2/refs.h
View file @
e172cf08
...
@@ -28,7 +28,7 @@ GIT_BEGIN_DECL
...
@@ -28,7 +28,7 @@ GIT_BEGIN_DECL
* @param reference_out pointer to the looked-up reference
* @param reference_out pointer to the looked-up reference
* @param repo the repository to look up the reference
* @param repo the repository to look up the reference
* @param name the long name for the reference (e.g. HEAD, ref/heads/master, refs/tags/v0.1.0, ...)
* @param name the long name for the reference (e.g. HEAD, ref/heads/master, refs/tags/v0.1.0, ...)
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_reference_lookup
(
git_reference
**
reference_out
,
git_repository
*
repo
,
const
char
*
name
);
GIT_EXTERN
(
int
)
git_reference_lookup
(
git_reference
**
reference_out
,
git_repository
*
repo
,
const
char
*
name
);
...
@@ -59,7 +59,7 @@ GIT_EXTERN(int) git_reference_name_to_oid(
...
@@ -59,7 +59,7 @@ GIT_EXTERN(int) git_reference_name_to_oid(
* @param name The name of the reference
* @param name The name of the reference
* @param target The target of the reference
* @param target The target of the reference
* @param force Overwrite existing references
* @param force Overwrite existing references
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_reference_create_symbolic
(
git_reference
**
ref_out
,
git_repository
*
repo
,
const
char
*
name
,
const
char
*
target
,
int
force
);
GIT_EXTERN
(
int
)
git_reference_create_symbolic
(
git_reference
**
ref_out
,
git_repository
*
repo
,
const
char
*
name
,
const
char
*
target
,
int
force
);
...
@@ -79,7 +79,7 @@ GIT_EXTERN(int) git_reference_create_symbolic(git_reference **ref_out, git_repos
...
@@ -79,7 +79,7 @@ GIT_EXTERN(int) git_reference_create_symbolic(git_reference **ref_out, git_repos
* @param name The name of the reference
* @param name The name of the reference
* @param id The object id pointed to by the reference.
* @param id The object id pointed to by the reference.
* @param force Overwrite existing references
* @param force Overwrite existing references
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_reference_create_oid
(
git_reference
**
ref_out
,
git_repository
*
repo
,
const
char
*
name
,
const
git_oid
*
id
,
int
force
);
GIT_EXTERN
(
int
)
git_reference_create_oid
(
git_reference
**
ref_out
,
git_repository
*
repo
,
const
char
*
name
,
const
git_oid
*
id
,
int
force
);
...
@@ -137,7 +137,7 @@ GIT_EXTERN(const char *) git_reference_name(git_reference *ref);
...
@@ -137,7 +137,7 @@ GIT_EXTERN(const char *) git_reference_name(git_reference *ref);
*
*
* @param resolved_ref Pointer to the peeled reference
* @param resolved_ref Pointer to the peeled reference
* @param ref The reference
* @param ref The reference
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_reference_resolve
(
git_reference
**
resolved_ref
,
git_reference
*
ref
);
GIT_EXTERN
(
int
)
git_reference_resolve
(
git_reference
**
resolved_ref
,
git_reference
*
ref
);
...
@@ -160,7 +160,7 @@ GIT_EXTERN(git_repository *) git_reference_owner(git_reference *ref);
...
@@ -160,7 +160,7 @@ GIT_EXTERN(git_repository *) git_reference_owner(git_reference *ref);
*
*
* @param ref The reference
* @param ref The reference
* @param target The new target for the reference
* @param target The new target for the reference
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_reference_set_target
(
git_reference
*
ref
,
const
char
*
target
);
GIT_EXTERN
(
int
)
git_reference_set_target
(
git_reference
*
ref
,
const
char
*
target
);
...
@@ -175,7 +175,7 @@ GIT_EXTERN(int) git_reference_set_target(git_reference *ref, const char *target)
...
@@ -175,7 +175,7 @@ GIT_EXTERN(int) git_reference_set_target(git_reference *ref, const char *target)
*
*
* @param ref The reference
* @param ref The reference
* @param id The new target OID for the reference
* @param id The new target OID for the reference
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_reference_set_oid
(
git_reference
*
ref
,
const
git_oid
*
id
);
GIT_EXTERN
(
int
)
git_reference_set_oid
(
git_reference
*
ref
,
const
git_oid
*
id
);
...
@@ -202,7 +202,7 @@ GIT_EXTERN(int) git_reference_set_oid(git_reference *ref, const git_oid *id);
...
@@ -202,7 +202,7 @@ GIT_EXTERN(int) git_reference_set_oid(git_reference *ref, const git_oid *id);
* @param ref The reference to rename
* @param ref The reference to rename
* @param new_name The new name for the reference
* @param new_name The new name for the reference
* @param force Overwrite an existing reference
* @param force Overwrite an existing reference
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*
*
*/
*/
GIT_EXTERN
(
int
)
git_reference_rename
(
git_reference
*
ref
,
const
char
*
new_name
,
int
force
);
GIT_EXTERN
(
int
)
git_reference_rename
(
git_reference
*
ref
,
const
char
*
new_name
,
int
force
);
...
@@ -216,7 +216,7 @@ GIT_EXTERN(int) git_reference_rename(git_reference *ref, const char *new_name, i
...
@@ -216,7 +216,7 @@ GIT_EXTERN(int) git_reference_rename(git_reference *ref, const char *new_name, i
* memory. The given reference pointer will no longer be valid.
* memory. The given reference pointer will no longer be valid.
*
*
* @param ref The reference to remove
* @param ref The reference to remove
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_reference_delete
(
git_reference
*
ref
);
GIT_EXTERN
(
int
)
git_reference_delete
(
git_reference
*
ref
);
...
@@ -231,7 +231,7 @@ GIT_EXTERN(int) git_reference_delete(git_reference *ref);
...
@@ -231,7 +231,7 @@ GIT_EXTERN(int) git_reference_delete(git_reference *ref);
* the loose references will be removed from disk.
* the loose references will be removed from disk.
*
*
* @param repo Repository where the loose refs will be packed
* @param repo Repository where the loose refs will be packed
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_reference_packall
(
git_repository
*
repo
);
GIT_EXTERN
(
int
)
git_reference_packall
(
git_repository
*
repo
);
...
@@ -254,7 +254,7 @@ GIT_EXTERN(int) git_reference_packall(git_repository *repo);
...
@@ -254,7 +254,7 @@ GIT_EXTERN(int) git_reference_packall(git_repository *repo);
* @param repo Repository where to find the refs
* @param repo Repository where to find the refs
* @param list_flags Filtering flags for the reference
* @param list_flags Filtering flags for the reference
* listing.
* listing.
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_reference_list
(
git_strarray
*
array
,
git_repository
*
repo
,
unsigned
int
list_flags
);
GIT_EXTERN
(
int
)
git_reference_list
(
git_strarray
*
array
,
git_repository
*
repo
,
unsigned
int
list_flags
);
...
@@ -276,7 +276,7 @@ GIT_EXTERN(int) git_reference_list(git_strarray *array, git_repository *repo, un
...
@@ -276,7 +276,7 @@ GIT_EXTERN(int) git_reference_list(git_strarray *array, git_repository *repo, un
* listing.
* listing.
* @param callback Function which will be called for every listed ref
* @param callback Function which will be called for every listed ref
* @param payload Additional data to pass to the callback
* @param payload Additional data to pass to the callback
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_reference_foreach
(
git_repository
*
repo
,
unsigned
int
list_flags
,
int
(
*
callback
)(
const
char
*
,
void
*
),
void
*
payload
);
GIT_EXTERN
(
int
)
git_reference_foreach
(
git_repository
*
repo
,
unsigned
int
list_flags
,
int
(
*
callback
)(
const
char
*
,
void
*
),
void
*
payload
);
...
@@ -304,7 +304,7 @@ GIT_EXTERN(int) git_reference_is_packed(git_reference *ref);
...
@@ -304,7 +304,7 @@ GIT_EXTERN(int) git_reference_is_packed(git_reference *ref);
* returned and the reference pointer will be invalidated.
* returned and the reference pointer will be invalidated.
*
*
* @param ref The reference to reload
* @param ref The reference to reload
* @return
GIT_SUCCESS
on success, or an error code
* @return
0
on success, or an error code
*/
*/
GIT_EXTERN
(
int
)
git_reference_reload
(
git_reference
*
ref
);
GIT_EXTERN
(
int
)
git_reference_reload
(
git_reference
*
ref
);
...
@@ -320,7 +320,7 @@ GIT_EXTERN(void) git_reference_free(git_reference *ref);
...
@@ -320,7 +320,7 @@ GIT_EXTERN(void) git_reference_free(git_reference *ref);
*
*
* @param ref1 The first git_reference
* @param ref1 The first git_reference
* @param ref2 The second git_reference
* @param ref2 The second git_reference
* @return
GIT_SUCCESS
if the same, else a stable but meaningless ordering.
* @return
0
if the same, else a stable but meaningless ordering.
*/
*/
GIT_EXTERN
(
int
)
git_reference_cmp
(
git_reference
*
ref1
,
git_reference
*
ref2
);
GIT_EXTERN
(
int
)
git_reference_cmp
(
git_reference
*
ref1
,
git_reference
*
ref2
);
...
...
include/git2/refspec.h
View file @
e172cf08
...
@@ -51,7 +51,7 @@ GIT_EXTERN(int) git_refspec_src_matches(const git_refspec *refspec, const char *
...
@@ -51,7 +51,7 @@ GIT_EXTERN(int) git_refspec_src_matches(const git_refspec *refspec, const char *
* @param outlen the size ouf the `out` buffer
* @param outlen the size ouf the `out` buffer
* @param spec the refspec
* @param spec the refspec
* @param name the name of the reference to transform
* @param name the name of the reference to transform
* @return
GIT_SUCCESS, GIT_E
SHORTBUFFER or another error
* @return
0, GIT_
SHORTBUFFER or another error
*/
*/
GIT_EXTERN
(
int
)
git_refspec_transform
(
char
*
out
,
size_t
outlen
,
const
git_refspec
*
spec
,
const
char
*
name
);
GIT_EXTERN
(
int
)
git_refspec_transform
(
char
*
out
,
size_t
outlen
,
const
git_refspec
*
spec
,
const
char
*
name
);
...
...
include/git2/remote.h
View file @
e172cf08
...
@@ -41,7 +41,7 @@ GIT_BEGIN_DECL
...
@@ -41,7 +41,7 @@ GIT_BEGIN_DECL
* @param name the remote's name
* @param name the remote's name
* @param url the remote repository's URL
* @param url the remote repository's URL
* @param fetch the fetch refspec to use for this remote
* @param fetch the fetch refspec to use for this remote
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_remote_new
(
git_remote
**
out
,
git_repository
*
repo
,
const
char
*
name
,
const
char
*
url
,
const
char
*
fetch
);
GIT_EXTERN
(
int
)
git_remote_new
(
git_remote
**
out
,
git_repository
*
repo
,
const
char
*
name
,
const
char
*
url
,
const
char
*
fetch
);
...
@@ -51,7 +51,7 @@ GIT_EXTERN(int) git_remote_new(git_remote **out, git_repository *repo, const cha
...
@@ -51,7 +51,7 @@ GIT_EXTERN(int) git_remote_new(git_remote **out, git_repository *repo, const cha
* @param out pointer to the new remote object
* @param out pointer to the new remote object
* @param cfg the repository's configuration
* @param cfg the repository's configuration
* @param name the remote's name
* @param name the remote's name
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_remote_load
(
git_remote
**
out
,
git_repository
*
repo
,
const
char
*
name
);
GIT_EXTERN
(
int
)
git_remote_load
(
git_remote
**
out
,
git_repository
*
repo
,
const
char
*
name
);
...
@@ -59,7 +59,7 @@ GIT_EXTERN(int) git_remote_load(git_remote **out, git_repository *repo, const ch
...
@@ -59,7 +59,7 @@ GIT_EXTERN(int) git_remote_load(git_remote **out, git_repository *repo, const ch
* Save a remote to its repository's configuration
* Save a remote to its repository's configuration
*
*
* @param remote the remote to save to config
* @param remote the remote to save to config
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_remote_save
(
const
git_remote
*
remote
);
GIT_EXTERN
(
int
)
git_remote_save
(
const
git_remote
*
remote
);
...
@@ -84,7 +84,7 @@ GIT_EXTERN(const char *) git_remote_url(git_remote *remote);
...
@@ -84,7 +84,7 @@ GIT_EXTERN(const char *) git_remote_url(git_remote *remote);
*
*
* @param remote the remote
* @param remote the remote
* @apram spec the new fetch refspec
* @apram spec the new fetch refspec
* @return
GIT_SUCCESS
or an error value
* @return
0
or an error value
*/
*/
GIT_EXTERN
(
int
)
git_remote_set_fetchspec
(
git_remote
*
remote
,
const
char
*
spec
);
GIT_EXTERN
(
int
)
git_remote_set_fetchspec
(
git_remote
*
remote
,
const
char
*
spec
);
...
@@ -101,7 +101,7 @@ GIT_EXTERN(const git_refspec *) git_remote_fetchspec(git_remote *remote);
...
@@ -101,7 +101,7 @@ GIT_EXTERN(const git_refspec *) git_remote_fetchspec(git_remote *remote);
*
*
* @param remote the remote
* @param remote the remote
* @apram spec the new push refspec
* @apram spec the new push refspec
* @return
GIT_SUCCESS
or an error value
* @return
0
or an error value
*/
*/
GIT_EXTERN
(
int
)
git_remote_set_pushspec
(
git_remote
*
remote
,
const
char
*
spec
);
GIT_EXTERN
(
int
)
git_remote_set_pushspec
(
git_remote
*
remote
,
const
char
*
spec
);
...
@@ -123,7 +123,7 @@ GIT_EXTERN(const git_refspec *) git_remote_pushspec(git_remote *remote);
...
@@ -123,7 +123,7 @@ GIT_EXTERN(const git_refspec *) git_remote_pushspec(git_remote *remote);
*
*
* @param remote the remote to connect to
* @param remote the remote to connect to
* @param direction whether you want to receive or send data
* @param direction whether you want to receive or send data
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_remote_connect
(
git_remote
*
remote
,
int
direction
);
GIT_EXTERN
(
int
)
git_remote_connect
(
git_remote
*
remote
,
int
direction
);
...
@@ -135,7 +135,7 @@ GIT_EXTERN(int) git_remote_connect(git_remote *remote, int direction);
...
@@ -135,7 +135,7 @@ GIT_EXTERN(int) git_remote_connect(git_remote *remote, int direction);
*
*
* @param refs where to store the refs
* @param refs where to store the refs
* @param remote the remote
* @param remote the remote
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_remote_ls
(
git_remote
*
remote
,
git_headlist_cb
list_cb
,
void
*
payload
);
GIT_EXTERN
(
int
)
git_remote_ls
(
git_remote
*
remote
,
git_headlist_cb
list_cb
,
void
*
payload
);
...
@@ -150,7 +150,7 @@ GIT_EXTERN(int) git_remote_ls(git_remote *remote, git_headlist_cb list_cb, void
...
@@ -150,7 +150,7 @@ GIT_EXTERN(int) git_remote_ls(git_remote *remote, git_headlist_cb list_cb, void
*
*
* @param remote the remote to download from
* @param remote the remote to download from
* @param filename where to store the temproray filename
* @param filename where to store the temproray filename
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_remote_download
(
git_remote
*
remote
,
git_off_t
*
bytes
,
git_indexer_stats
*
stats
);
GIT_EXTERN
(
int
)
git_remote_download
(
git_remote
*
remote
,
git_off_t
*
bytes
,
git_indexer_stats
*
stats
);
...
@@ -215,7 +215,7 @@ GIT_EXTERN(int) git_remote_supported_url(const char* url);
...
@@ -215,7 +215,7 @@ GIT_EXTERN(int) git_remote_supported_url(const char* url);
*
*
* @param remotes_list a string array with the names of the remotes
* @param remotes_list a string array with the names of the remotes
* @param repo the repository to query
* @param repo the repository to query
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_remote_list
(
git_strarray
*
remotes_list
,
git_repository
*
repo
);
GIT_EXTERN
(
int
)
git_remote_list
(
git_strarray
*
remotes_list
,
git_repository
*
repo
);
...
...
include/git2/repository.h
View file @
e172cf08
...
@@ -31,7 +31,7 @@ GIT_BEGIN_DECL
...
@@ -31,7 +31,7 @@ GIT_BEGIN_DECL
*
*
* @param repository pointer to the repo which will be opened
* @param repository pointer to the repo which will be opened
* @param path the path to the repository
* @param path the path to the repository
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_repository_open
(
git_repository
**
repository
,
const
char
*
path
);
GIT_EXTERN
(
int
)
git_repository_open
(
git_repository
**
repository
,
const
char
*
path
);
...
@@ -61,7 +61,7 @@ GIT_EXTERN(int) git_repository_open(git_repository **repository, const char *pat
...
@@ -61,7 +61,7 @@ GIT_EXTERN(int) git_repository_open(git_repository **repository, const char *pat
* start_path no matter start_path appears in ceiling_dirs ceiling_dirs
* start_path no matter start_path appears in ceiling_dirs ceiling_dirs
* might be NULL (which is equivalent to an empty string)
* might be NULL (which is equivalent to an empty string)
*
*
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_repository_discover
(
GIT_EXTERN
(
int
)
git_repository_discover
(
char
*
repository_path
,
char
*
repository_path
,
...
@@ -109,7 +109,7 @@ GIT_EXTERN(void) git_repository_free(git_repository *repo);
...
@@ -109,7 +109,7 @@ GIT_EXTERN(void) git_repository_free(git_repository *repo);
* at the pointed path. If false, provided path will be considered as the working
* at the pointed path. If false, provided path will be considered as the working
* directory into which the .git directory will be created.
* directory into which the .git directory will be created.
*
*
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_repository_init
(
git_repository
**
repo_out
,
const
char
*
path
,
unsigned
is_bare
);
GIT_EXTERN
(
int
)
git_repository_init
(
git_repository
**
repo_out
,
const
char
*
path
,
unsigned
is_bare
);
...
@@ -194,7 +194,7 @@ GIT_EXTERN(const char *) git_repository_workdir(git_repository *repo);
...
@@ -194,7 +194,7 @@ GIT_EXTERN(const char *) git_repository_workdir(git_repository *repo);
*
*
* @param repo A repository object
* @param repo A repository object
* @param workdir The path to a working directory
* @param workdir The path to a working directory
* @return
GIT_SUCCESS
, or an error code
* @return
0
, or an error code
*/
*/
GIT_EXTERN
(
int
)
git_repository_set_workdir
(
git_repository
*
repo
,
const
char
*
workdir
);
GIT_EXTERN
(
int
)
git_repository_set_workdir
(
git_repository
*
repo
,
const
char
*
workdir
);
...
@@ -218,7 +218,7 @@ GIT_EXTERN(int) git_repository_is_bare(git_repository *repo);
...
@@ -218,7 +218,7 @@ GIT_EXTERN(int) git_repository_is_bare(git_repository *repo);
*
*
* @param out Pointer to store the loaded config file
* @param out Pointer to store the loaded config file
* @param repo A repository object
* @param repo A repository object
* @return
GIT_SUCCESS
, or an error code
* @return
0
, or an error code
*/
*/
GIT_EXTERN
(
int
)
git_repository_config
(
git_config
**
out
,
git_repository
*
repo
);
GIT_EXTERN
(
int
)
git_repository_config
(
git_config
**
out
,
git_repository
*
repo
);
...
@@ -249,7 +249,7 @@ GIT_EXTERN(void) git_repository_set_config(git_repository *repo, git_config *con
...
@@ -249,7 +249,7 @@ GIT_EXTERN(void) git_repository_set_config(git_repository *repo, git_config *con
*
*
* @param out Pointer to store the loaded ODB
* @param out Pointer to store the loaded ODB
* @param repo A repository object
* @param repo A repository object
* @return
GIT_SUCCESS
, or an error code
* @return
0
, or an error code
*/
*/
GIT_EXTERN
(
int
)
git_repository_odb
(
git_odb
**
out
,
git_repository
*
repo
);
GIT_EXTERN
(
int
)
git_repository_odb
(
git_odb
**
out
,
git_repository
*
repo
);
...
@@ -280,7 +280,7 @@ GIT_EXTERN(void) git_repository_set_odb(git_repository *repo, git_odb *odb);
...
@@ -280,7 +280,7 @@ GIT_EXTERN(void) git_repository_set_odb(git_repository *repo, git_odb *odb);
*
*
* @param out Pointer to store the loaded index
* @param out Pointer to store the loaded index
* @param repo A repository object
* @param repo A repository object
* @return
GIT_SUCCESS
, or an error code
* @return
0
, or an error code
*/
*/
GIT_EXTERN
(
int
)
git_repository_index
(
git_index
**
out
,
git_repository
*
repo
);
GIT_EXTERN
(
int
)
git_repository_index
(
git_index
**
out
,
git_repository
*
repo
);
...
...
include/git2/revwalk.h
View file @
e172cf08
...
@@ -65,7 +65,7 @@ GIT_BEGIN_DECL
...
@@ -65,7 +65,7 @@ GIT_BEGIN_DECL
*
*
* @param walker pointer to the new revision walker
* @param walker pointer to the new revision walker
* @param repo the repo to walk through
* @param repo the repo to walk through
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_revwalk_new
(
git_revwalk
**
walker
,
git_repository
*
repo
);
GIT_EXTERN
(
int
)
git_revwalk_new
(
git_revwalk
**
walker
,
git_repository
*
repo
);
...
@@ -97,7 +97,7 @@ GIT_EXTERN(void) git_revwalk_reset(git_revwalk *walker);
...
@@ -97,7 +97,7 @@ GIT_EXTERN(void) git_revwalk_reset(git_revwalk *walker);
*
*
* @param walk the walker being used for the traversal.
* @param walk the walker being used for the traversal.
* @param oid the oid of the commit to start from.
* @param oid the oid of the commit to start from.
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_revwalk_push
(
git_revwalk
*
walk
,
const
git_oid
*
oid
);
GIT_EXTERN
(
int
)
git_revwalk_push
(
git_revwalk
*
walk
,
const
git_oid
*
oid
);
...
@@ -112,7 +112,7 @@ GIT_EXTERN(int) git_revwalk_push(git_revwalk *walk, const git_oid *oid);
...
@@ -112,7 +112,7 @@ GIT_EXTERN(int) git_revwalk_push(git_revwalk *walk, const git_oid *oid);
*
*
* @param walk the walker being used for the traversal
* @param walk the walker being used for the traversal
* @param glob the glob pattern references should match
* @param glob the glob pattern references should match
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_revwalk_push_glob
(
git_revwalk
*
walk
,
const
char
*
glob
);
GIT_EXTERN
(
int
)
git_revwalk_push_glob
(
git_revwalk
*
walk
,
const
char
*
glob
);
...
@@ -120,7 +120,7 @@ GIT_EXTERN(int) git_revwalk_push_glob(git_revwalk *walk, const char *glob);
...
@@ -120,7 +120,7 @@ GIT_EXTERN(int) git_revwalk_push_glob(git_revwalk *walk, const char *glob);
* Push the repository's HEAD
* Push the repository's HEAD
*
*
* @param walk the walker being used for the traversal
* @param walk the walker being used for the traversal
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_revwalk_push_head
(
git_revwalk
*
walk
);
GIT_EXTERN
(
int
)
git_revwalk_push_head
(
git_revwalk
*
walk
);
...
@@ -135,7 +135,7 @@ GIT_EXTERN(int) git_revwalk_push_head(git_revwalk *walk);
...
@@ -135,7 +135,7 @@ GIT_EXTERN(int) git_revwalk_push_head(git_revwalk *walk);
*
*
* @param walk the walker being used for the traversal.
* @param walk the walker being used for the traversal.
* @param oid the oid of commit that will be ignored during the traversal
* @param oid the oid of commit that will be ignored during the traversal
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_revwalk_hide
(
git_revwalk
*
walk
,
const
git_oid
*
oid
);
GIT_EXTERN
(
int
)
git_revwalk_hide
(
git_revwalk
*
walk
,
const
git_oid
*
oid
);
...
@@ -151,7 +151,7 @@ GIT_EXTERN(int) git_revwalk_hide(git_revwalk *walk, const git_oid *oid);
...
@@ -151,7 +151,7 @@ GIT_EXTERN(int) git_revwalk_hide(git_revwalk *walk, const git_oid *oid);
*
*
* @param walk the walker being used for the traversal
* @param walk the walker being used for the traversal
* @param glob the glob pattern references should match
* @param glob the glob pattern references should match
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_revwalk_hide_glob
(
git_revwalk
*
walk
,
const
char
*
glob
);
GIT_EXTERN
(
int
)
git_revwalk_hide_glob
(
git_revwalk
*
walk
,
const
char
*
glob
);
...
@@ -159,7 +159,7 @@ GIT_EXTERN(int) git_revwalk_hide_glob(git_revwalk *walk, const char *glob);
...
@@ -159,7 +159,7 @@ GIT_EXTERN(int) git_revwalk_hide_glob(git_revwalk *walk, const char *glob);
* Hide the repository's HEAD
* Hide the repository's HEAD
*
*
* @param walk the walker being used for the traversal
* @param walk the walker being used for the traversal
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_revwalk_hide_head
(
git_revwalk
*
walk
);
GIT_EXTERN
(
int
)
git_revwalk_hide_head
(
git_revwalk
*
walk
);
...
@@ -170,7 +170,7 @@ GIT_EXTERN(int) git_revwalk_hide_head(git_revwalk *walk);
...
@@ -170,7 +170,7 @@ GIT_EXTERN(int) git_revwalk_hide_head(git_revwalk *walk);
*
*
* @param walk the walker being used for the traversal
* @param walk the walker being used for the traversal
* @param refname the referece to push
* @param refname the referece to push
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_revwalk_push_ref
(
git_revwalk
*
walk
,
const
char
*
refname
);
GIT_EXTERN
(
int
)
git_revwalk_push_ref
(
git_revwalk
*
walk
,
const
char
*
refname
);
...
@@ -181,7 +181,7 @@ GIT_EXTERN(int) git_revwalk_push_ref(git_revwalk *walk, const char *refname);
...
@@ -181,7 +181,7 @@ GIT_EXTERN(int) git_revwalk_push_ref(git_revwalk *walk, const char *refname);
*
*
* @param walk the walker being used for the traversal
* @param walk the walker being used for the traversal
* @param refname the referece to hide
* @param refname the referece to hide
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_revwalk_hide_ref
(
git_revwalk
*
walk
,
const
char
*
refname
);
GIT_EXTERN
(
int
)
git_revwalk_hide_ref
(
git_revwalk
*
walk
,
const
char
*
refname
);
...
@@ -200,8 +200,8 @@ GIT_EXTERN(int) git_revwalk_hide_ref(git_revwalk *walk, const char *refname);
...
@@ -200,8 +200,8 @@ GIT_EXTERN(int) git_revwalk_hide_ref(git_revwalk *walk, const char *refname);
*
*
* @param oid Pointer where to store the oid of the next commit
* @param oid Pointer where to store the oid of the next commit
* @param walk the walker to pop the commit from.
* @param walk the walker to pop the commit from.
* @return
GIT_SUCCESS
if the next commit was found;
* @return
0
if the next commit was found;
* GIT_
E
REVWALKOVER if there are no commits left to iterate
* GIT_REVWALKOVER if there are no commits left to iterate
*/
*/
GIT_EXTERN
(
int
)
git_revwalk_next
(
git_oid
*
oid
,
git_revwalk
*
walk
);
GIT_EXTERN
(
int
)
git_revwalk_next
(
git_oid
*
oid
,
git_revwalk
*
walk
);
...
...
include/git2/signature.h
View file @
e172cf08
...
@@ -28,7 +28,7 @@ GIT_BEGIN_DECL
...
@@ -28,7 +28,7 @@ GIT_BEGIN_DECL
* @param email email of the person
* @param email email of the person
* @param time time when the action happened
* @param time time when the action happened
* @param offset timezone offset in minutes for the time
* @param offset timezone offset in minutes for the time
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_signature_new
(
git_signature
**
sig_out
,
const
char
*
name
,
const
char
*
email
,
git_time_t
time
,
int
offset
);
GIT_EXTERN
(
int
)
git_signature_new
(
git_signature
**
sig_out
,
const
char
*
name
,
const
char
*
email
,
git_time_t
time
,
int
offset
);
...
@@ -39,7 +39,7 @@ GIT_EXTERN(int) git_signature_new(git_signature **sig_out, const char *name, con
...
@@ -39,7 +39,7 @@ GIT_EXTERN(int) git_signature_new(git_signature **sig_out, const char *name, con
* @param sig_out new signature, in case of error NULL
* @param sig_out new signature, in case of error NULL
* @param name name of the person
* @param name name of the person
* @param email email of the person
* @param email email of the person
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_signature_now
(
git_signature
**
sig_out
,
const
char
*
name
,
const
char
*
email
);
GIT_EXTERN
(
int
)
git_signature_now
(
git_signature
**
sig_out
,
const
char
*
name
,
const
char
*
email
);
...
...
include/git2/status.h
View file @
e172cf08
...
@@ -131,9 +131,9 @@ GIT_EXTERN(int) git_status_foreach_ext(
...
@@ -131,9 +131,9 @@ GIT_EXTERN(int) git_status_foreach_ext(
* @param status_flags the status value
* @param status_flags the status value
* @param repo a repository object
* @param repo a repository object
* @param path the file to retrieve status for, rooted at the repo's workdir
* @param path the file to retrieve status for, rooted at the repo's workdir
* @return GIT_EINVALIDPATH when `path` points at a folder, GIT_
E
NOTFOUND when
* @return GIT_EINVALIDPATH when `path` points at a folder, GIT_NOTFOUND when
* the file doesn't exist in any of HEAD, the index or the worktree,
* the file doesn't exist in any of HEAD, the index or the worktree,
*
GIT_SUCCESS
otherwise
*
0
otherwise
*/
*/
GIT_EXTERN
(
int
)
git_status_file
(
GIT_EXTERN
(
int
)
git_status_file
(
unsigned
int
*
status_flags
,
unsigned
int
*
status_flags
,
...
...
include/git2/submodule.h
View file @
e172cf08
...
@@ -85,13 +85,13 @@ GIT_EXTERN(int) git_submodule_foreach(
...
@@ -85,13 +85,13 @@ GIT_EXTERN(int) git_submodule_foreach(
*
*
* Given either the submodule name or path (they are ususally the same),
* Given either the submodule name or path (they are ususally the same),
* this returns a structure describing the submodule. If the submodule
* this returns a structure describing the submodule. If the submodule
* does not exist, this will return GIT_
E
NOTFOUND and set the submodule
* does not exist, this will return GIT_NOTFOUND and set the submodule
* pointer to NULL.
* pointer to NULL.
*
*
* @param submodule Pointer to submodule description object pointer..
* @param submodule Pointer to submodule description object pointer..
* @param repo The repository.
* @param repo The repository.
* @param name The name of the submodule. Trailing slashes will be ignored.
* @param name The name of the submodule. Trailing slashes will be ignored.
* @return 0 on success, GIT_
E
NOTFOUND if submodule does not exist, -1 on error
* @return 0 on success, GIT_NOTFOUND if submodule does not exist, -1 on error
*/
*/
GIT_EXTERN
(
int
)
git_submodule_lookup
(
GIT_EXTERN
(
int
)
git_submodule_lookup
(
git_submodule
**
submodule
,
git_submodule
**
submodule
,
...
...
include/git2/tag.h
View file @
e172cf08
...
@@ -27,7 +27,7 @@ GIT_BEGIN_DECL
...
@@ -27,7 +27,7 @@ GIT_BEGIN_DECL
* @param tag pointer to the looked up tag
* @param tag pointer to the looked up tag
* @param repo the repo to use when locating the tag.
* @param repo the repo to use when locating the tag.
* @param id identity of the tag to locate.
* @param id identity of the tag to locate.
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_INLINE
(
int
)
git_tag_lookup
(
git_tag
**
tag
,
git_repository
*
repo
,
const
git_oid
*
id
)
GIT_INLINE
(
int
)
git_tag_lookup
(
git_tag
**
tag
,
git_repository
*
repo
,
const
git_oid
*
id
)
{
{
...
@@ -44,7 +44,7 @@ GIT_INLINE(int) git_tag_lookup(git_tag **tag, git_repository *repo, const git_oi
...
@@ -44,7 +44,7 @@ GIT_INLINE(int) git_tag_lookup(git_tag **tag, git_repository *repo, const git_oi
* @param repo the repo to use when locating the tag.
* @param repo the repo to use when locating the tag.
* @param id identity of the tag to locate.
* @param id identity of the tag to locate.
* @param len the length of the short identifier
* @param len the length of the short identifier
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_INLINE
(
int
)
git_tag_lookup_prefix
(
git_tag
**
tag
,
git_repository
*
repo
,
const
git_oid
*
id
,
unsigned
int
len
)
GIT_INLINE
(
int
)
git_tag_lookup_prefix
(
git_tag
**
tag
,
git_repository
*
repo
,
const
git_oid
*
id
,
unsigned
int
len
)
{
{
...
@@ -85,7 +85,7 @@ GIT_EXTERN(const git_oid *) git_tag_id(git_tag *tag);
...
@@ -85,7 +85,7 @@ GIT_EXTERN(const git_oid *) git_tag_id(git_tag *tag);
*
*
* @param target pointer where to store the target
* @param target pointer where to store the target
* @param tag a previously loaded tag.
* @param tag a previously loaded tag.
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_tag_target
(
git_object
**
target
,
git_tag
*
tag
);
GIT_EXTERN
(
int
)
git_tag_target
(
git_object
**
target
,
git_tag
*
tag
);
...
@@ -143,7 +143,7 @@ GIT_EXTERN(const char *) git_tag_message(git_tag *tag);
...
@@ -143,7 +143,7 @@ GIT_EXTERN(const char *) git_tag_message(git_tag *tag);
* @param oid Pointer where to store the OID of the
* @param oid Pointer where to store the OID of the
* newly created tag. If the tag already exists, this parameter
* newly created tag. If the tag already exists, this parameter
* will be the oid of the existing tag, and the function will
* will be the oid of the existing tag, and the function will
* return a GIT_E
E
XISTS error code.
* return a GIT_EXISTS error code.
*
*
* @param repo Repository where to store the tag
* @param repo Repository where to store the tag
*
*
...
@@ -161,7 +161,7 @@ GIT_EXTERN(const char *) git_tag_message(git_tag *tag);
...
@@ -161,7 +161,7 @@ GIT_EXTERN(const char *) git_tag_message(git_tag *tag);
*
*
* @param force Overwrite existing references
* @param force Overwrite existing references
*
*
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
* A tag object is written to the ODB, and a proper reference
* A tag object is written to the ODB, and a proper reference
* is written in the /refs/tags folder, pointing to it
* is written in the /refs/tags folder, pointing to it
*/
*/
...
@@ -199,7 +199,7 @@ GIT_EXTERN(int) git_tag_create_frombuffer(
...
@@ -199,7 +199,7 @@ GIT_EXTERN(int) git_tag_create_frombuffer(
* @param oid Pointer where to store the OID of the provided
* @param oid Pointer where to store the OID of the provided
* target object. If the tag already exists, this parameter
* target object. If the tag already exists, this parameter
* will be filled with the oid of the existing pointed object
* will be filled with the oid of the existing pointed object
* and the function will return a GIT_E
E
XISTS error code.
* and the function will return a GIT_EXISTS error code.
*
*
* @param repo Repository where to store the lightweight tag
* @param repo Repository where to store the lightweight tag
*
*
...
@@ -212,7 +212,7 @@ GIT_EXTERN(int) git_tag_create_frombuffer(
...
@@ -212,7 +212,7 @@ GIT_EXTERN(int) git_tag_create_frombuffer(
*
*
* @param force Overwrite existing references
* @param force Overwrite existing references
*
*
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
* A proper reference is written in the /refs/tags folder,
* A proper reference is written in the /refs/tags folder,
* pointing to the provided target object
* pointing to the provided target object
*/
*/
...
@@ -231,7 +231,7 @@ GIT_EXTERN(int) git_tag_create_lightweight(
...
@@ -231,7 +231,7 @@ GIT_EXTERN(int) git_tag_create_lightweight(
* @param tag_name Name of the tag to be deleted;
* @param tag_name Name of the tag to be deleted;
* this name is validated for consistency.
* this name is validated for consistency.
*
*
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_tag_delete
(
GIT_EXTERN
(
int
)
git_tag_delete
(
git_repository
*
repo
,
git_repository
*
repo
,
...
@@ -248,7 +248,7 @@ GIT_EXTERN(int) git_tag_delete(
...
@@ -248,7 +248,7 @@ GIT_EXTERN(int) git_tag_delete(
* @param tag_names Pointer to a git_strarray structure where
* @param tag_names Pointer to a git_strarray structure where
* the tag names will be stored
* the tag names will be stored
* @param repo Repository where to find the tags
* @param repo Repository where to find the tags
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_tag_list
(
GIT_EXTERN
(
int
)
git_tag_list
(
git_strarray
*
tag_names
,
git_strarray
*
tag_names
,
...
@@ -270,7 +270,7 @@ GIT_EXTERN(int) git_tag_list(
...
@@ -270,7 +270,7 @@ GIT_EXTERN(int) git_tag_list(
* the tag names will be stored
* the tag names will be stored
* @param pattern Standard fnmatch pattern
* @param pattern Standard fnmatch pattern
* @param repo Repository where to find the tags
* @param repo Repository where to find the tags
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_tag_list_match
(
GIT_EXTERN
(
int
)
git_tag_list_match
(
git_strarray
*
tag_names
,
git_strarray
*
tag_names
,
...
@@ -286,7 +286,7 @@ GIT_EXTERN(int) git_tag_list_match(
...
@@ -286,7 +286,7 @@ GIT_EXTERN(int) git_tag_list_match(
*
*
* @param tag_target Pointer to the peeled git_object
* @param tag_target Pointer to the peeled git_object
* @param tag The tag to be processed
* @param tag The tag to be processed
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_tag_peel
(
GIT_EXTERN
(
int
)
git_tag_peel
(
git_object
**
tag_target
,
git_object
**
tag_target
,
...
...
include/git2/tree.h
View file @
e172cf08
...
@@ -27,7 +27,7 @@ GIT_BEGIN_DECL
...
@@ -27,7 +27,7 @@ GIT_BEGIN_DECL
* @param tree pointer to the looked up tree
* @param tree pointer to the looked up tree
* @param repo the repo to use when locating the tree.
* @param repo the repo to use when locating the tree.
* @param id identity of the tree to locate.
* @param id identity of the tree to locate.
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_INLINE
(
int
)
git_tree_lookup
(
git_tree
**
tree
,
git_repository
*
repo
,
const
git_oid
*
id
)
GIT_INLINE
(
int
)
git_tree_lookup
(
git_tree
**
tree
,
git_repository
*
repo
,
const
git_oid
*
id
)
{
{
...
@@ -44,7 +44,7 @@ GIT_INLINE(int) git_tree_lookup(git_tree **tree, git_repository *repo, const git
...
@@ -44,7 +44,7 @@ GIT_INLINE(int) git_tree_lookup(git_tree **tree, git_repository *repo, const git
* @param repo the repo to use when locating the tree.
* @param repo the repo to use when locating the tree.
* @param id identity of the tree to locate.
* @param id identity of the tree to locate.
* @param len the length of the short identifier
* @param len the length of the short identifier
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_INLINE
(
int
)
git_tree_lookup_prefix
(
git_tree
**
tree
,
git_repository
*
repo
,
const
git_oid
*
id
,
unsigned
int
len
)
GIT_INLINE
(
int
)
git_tree_lookup_prefix
(
git_tree
**
tree
,
git_repository
*
repo
,
const
git_oid
*
id
,
unsigned
int
len
)
{
{
...
@@ -141,7 +141,7 @@ GIT_EXTERN(git_otype) git_tree_entry_type(const git_tree_entry *entry);
...
@@ -141,7 +141,7 @@ GIT_EXTERN(git_otype) git_tree_entry_type(const git_tree_entry *entry);
* @param object pointer to the converted object
* @param object pointer to the converted object
* @param repo repository where to lookup the pointed object
* @param repo repository where to lookup the pointed object
* @param entry a tree entry
* @param entry a tree entry
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_tree_entry_to_object
(
git_object
**
object_out
,
git_repository
*
repo
,
const
git_tree_entry
*
entry
);
GIT_EXTERN
(
int
)
git_tree_entry_to_object
(
git_object
**
object_out
,
git_repository
*
repo
,
const
git_tree_entry
*
entry
);
...
@@ -159,7 +159,7 @@ GIT_EXTERN(int) git_tree_entry_to_object(git_object **object_out, git_repository
...
@@ -159,7 +159,7 @@ GIT_EXTERN(int) git_tree_entry_to_object(git_object **object_out, git_repository
*
*
* @param oid Pointer where to store the written tree
* @param oid Pointer where to store the written tree
* @param index Index to write
* @param index Index to write
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_tree_create_fromindex
(
git_oid
*
oid
,
git_index
*
index
);
GIT_EXTERN
(
int
)
git_tree_create_fromindex
(
git_oid
*
oid
,
git_index
*
index
);
...
@@ -229,7 +229,7 @@ GIT_EXTERN(const git_tree_entry *) git_treebuilder_get(git_treebuilder *bld, con
...
@@ -229,7 +229,7 @@ GIT_EXTERN(const git_tree_entry *) git_treebuilder_get(git_treebuilder *bld, con
* @param filename Filename of the entry
* @param filename Filename of the entry
* @param id SHA1 oid of the entry
* @param id SHA1 oid of the entry
* @param attributes Folder attributes of the entry
* @param attributes Folder attributes of the entry
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_treebuilder_insert
(
git_tree_entry
**
entry_out
,
git_treebuilder
*
bld
,
const
char
*
filename
,
const
git_oid
*
id
,
unsigned
int
attributes
);
GIT_EXTERN
(
int
)
git_treebuilder_insert
(
git_tree_entry
**
entry_out
,
git_treebuilder
*
bld
,
const
char
*
filename
,
const
git_oid
*
id
,
unsigned
int
attributes
);
...
@@ -264,7 +264,7 @@ GIT_EXTERN(void) git_treebuilder_filter(git_treebuilder *bld, int (*filter)(cons
...
@@ -264,7 +264,7 @@ GIT_EXTERN(void) git_treebuilder_filter(git_treebuilder *bld, int (*filter)(cons
* @param oid Pointer where to store the written OID
* @param oid Pointer where to store the written OID
* @param repo Repository where to store the object
* @param repo Repository where to store the object
* @param bld Tree builder to write
* @param bld Tree builder to write
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_treebuilder_write
(
git_oid
*
oid
,
git_repository
*
repo
,
git_treebuilder
*
bld
);
GIT_EXTERN
(
int
)
git_treebuilder_write
(
git_oid
*
oid
,
git_repository
*
repo
,
git_treebuilder
*
bld
);
...
@@ -278,8 +278,7 @@ GIT_EXTERN(int) git_treebuilder_write(git_oid *oid, git_repository *repo, git_tr
...
@@ -278,8 +278,7 @@ GIT_EXTERN(int) git_treebuilder_write(git_oid *oid, git_repository *repo, git_tr
* @param subtree Pointer where to store the subtree
* @param subtree Pointer where to store the subtree
* @param root A previously loaded tree which will be the root of the relative path
* @param root A previously loaded tree which will be the root of the relative path
* @param subtree_path Path to the contained subtree
* @param subtree_path Path to the contained subtree
* @return GIT_SUCCESS on success; GIT_ENOTFOUND if the path does not lead to a
* @return 0 on success; GIT_NOTFOUND if the path does not lead to a subtree
* subtree, GIT_EINVALIDPATH or an error code
*/
*/
GIT_EXTERN
(
int
)
git_tree_get_subtree
(
git_tree
**
subtree
,
git_tree
*
root
,
const
char
*
subtree_path
);
GIT_EXTERN
(
int
)
git_tree_get_subtree
(
git_tree
**
subtree
,
git_tree
*
root
,
const
char
*
subtree_path
);
...
@@ -309,7 +308,7 @@ enum git_treewalk_mode {
...
@@ -309,7 +308,7 @@ enum git_treewalk_mode {
* @param callback Function to call on each tree entry
* @param callback Function to call on each tree entry
* @param mode Traversal mode (pre or post-order)
* @param mode Traversal mode (pre or post-order)
* @param payload Opaque pointer to be passed on each callback
* @param payload Opaque pointer to be passed on each callback
* @return
GIT_SUCCESS
or an error code
* @return
0
or an error code
*/
*/
GIT_EXTERN
(
int
)
git_tree_walk
(
git_tree
*
tree
,
git_treewalk_cb
callback
,
int
mode
,
void
*
payload
);
GIT_EXTERN
(
int
)
git_tree_walk
(
git_tree
*
tree
,
git_treewalk_cb
callback
,
int
mode
,
void
*
payload
);
...
...
src/attr.c
View file @
e172cf08
...
@@ -245,13 +245,13 @@ static int load_attr_file(
...
@@ -245,13 +245,13 @@ static int load_attr_file(
struct
stat
st
;
struct
stat
st
;
if
(
p_stat
(
filename
,
&
st
)
<
0
)
if
(
p_stat
(
filename
,
&
st
)
<
0
)
return
GIT_
E
NOTFOUND
;
return
GIT_NOTFOUND
;
if
(
sig
!=
NULL
&&
if
(
sig
!=
NULL
&&
(
git_time_t
)
st
.
st_mtime
==
sig
->
seconds
&&
(
git_time_t
)
st
.
st_mtime
==
sig
->
seconds
&&
(
git_off_t
)
st
.
st_size
==
sig
->
size
&&
(
git_off_t
)
st
.
st_size
==
sig
->
size
&&
(
unsigned
int
)
st
.
st_ino
==
sig
->
ino
)
(
unsigned
int
)
st
.
st_ino
==
sig
->
ino
)
return
GIT_
E
NOTFOUND
;
return
GIT_NOTFOUND
;
error
=
git_futils_readbuffer_updated
(
&
content
,
filename
,
NULL
,
NULL
);
error
=
git_futils_readbuffer_updated
(
&
content
,
filename
,
NULL
,
NULL
);
if
(
error
<
0
)
if
(
error
<
0
)
...
@@ -286,7 +286,7 @@ static int load_attr_blob_from_index(
...
@@ -286,7 +286,7 @@ static int load_attr_blob_from_index(
entry
=
git_index_get
(
index
,
error
);
entry
=
git_index_get
(
index
,
error
);
if
(
old_oid
&&
git_oid_cmp
(
old_oid
,
&
entry
->
oid
)
==
0
)
if
(
old_oid
&&
git_oid_cmp
(
old_oid
,
&
entry
->
oid
)
==
0
)
return
GIT_
E
NOTFOUND
;
return
GIT_NOTFOUND
;
if
((
error
=
git_blob_lookup
(
blob
,
repo
,
&
entry
->
oid
))
<
0
)
if
((
error
=
git_blob_lookup
(
blob
,
repo
,
&
entry
->
oid
))
<
0
)
return
error
;
return
error
;
...
@@ -396,7 +396,7 @@ int git_attr_cache__push_file(
...
@@ -396,7 +396,7 @@ int git_attr_cache__push_file(
if
(
error
)
{
if
(
error
)
{
/* not finding a file is not an error for this function */
/* not finding a file is not an error for this function */
if
(
error
==
GIT_
E
NOTFOUND
)
{
if
(
error
==
GIT_NOTFOUND
)
{
giterr_clear
();
giterr_clear
();
error
=
0
;
error
=
0
;
}
}
...
@@ -550,7 +550,7 @@ static int collect_attr_files(
...
@@ -550,7 +550,7 @@ static int collect_attr_files(
error
=
git_futils_find_system_file
(
&
dir
,
GIT_ATTR_FILE_SYSTEM
);
error
=
git_futils_find_system_file
(
&
dir
,
GIT_ATTR_FILE_SYSTEM
);
if
(
!
error
)
if
(
!
error
)
error
=
push_attr_file
(
repo
,
files
,
NULL
,
dir
.
ptr
);
error
=
push_attr_file
(
repo
,
files
,
NULL
,
dir
.
ptr
);
else
if
(
error
==
GIT_
E
NOTFOUND
)
else
if
(
error
==
GIT_NOTFOUND
)
error
=
0
;
error
=
0
;
}
}
...
@@ -577,11 +577,11 @@ int git_attr_cache__init(git_repository *repo)
...
@@ -577,11 +577,11 @@ int git_attr_cache__init(git_repository *repo)
return
-
1
;
return
-
1
;
ret
=
git_config_get_string
(
&
cache
->
cfg_attr_file
,
cfg
,
GIT_ATTR_CONFIG
);
ret
=
git_config_get_string
(
&
cache
->
cfg_attr_file
,
cfg
,
GIT_ATTR_CONFIG
);
if
(
ret
<
0
&&
ret
!=
GIT_
E
NOTFOUND
)
if
(
ret
<
0
&&
ret
!=
GIT_NOTFOUND
)
return
ret
;
return
ret
;
ret
=
git_config_get_string
(
&
cache
->
cfg_excl_file
,
cfg
,
GIT_IGNORE_CONFIG
);
ret
=
git_config_get_string
(
&
cache
->
cfg_excl_file
,
cfg
,
GIT_IGNORE_CONFIG
);
if
(
ret
<
0
&&
ret
!=
GIT_
E
NOTFOUND
)
if
(
ret
<
0
&&
ret
!=
GIT_NOTFOUND
)
return
ret
;
return
ret
;
giterr_clear
();
giterr_clear
();
...
...
src/attr_file.c
View file @
e172cf08
...
@@ -99,7 +99,7 @@ int git_attr_file__parse_buffer(
...
@@ -99,7 +99,7 @@ int git_attr_file__parse_buffer(
/* if the rule wasn't a pattern, on to the next */
/* if the rule wasn't a pattern, on to the next */
if
(
error
<
0
)
{
if
(
error
<
0
)
{
git_attr_rule__clear
(
rule
);
/* reset rule contents */
git_attr_rule__clear
(
rule
);
/* reset rule contents */
if
(
error
==
GIT_
E
NOTFOUND
)
if
(
error
==
GIT_NOTFOUND
)
error
=
0
;
error
=
0
;
}
else
{
}
else
{
rule
=
NULL
;
/* vector now "owns" the rule */
rule
=
NULL
;
/* vector now "owns" the rule */
...
@@ -328,7 +328,7 @@ void git_attr_path__free(git_attr_path *info)
...
@@ -328,7 +328,7 @@ void git_attr_path__free(git_attr_path *info)
/*
/*
* This will return 0 if the spec was filled out,
* This will return 0 if the spec was filled out,
* GIT_
E
NOTFOUND if the fnmatch does not require matching, or
* GIT_NOTFOUND if the fnmatch does not require matching, or
* another error code there was an actual problem.
* another error code there was an actual problem.
*/
*/
int
git_attr_fnmatch__parse
(
int
git_attr_fnmatch__parse
(
...
@@ -347,7 +347,7 @@ int git_attr_fnmatch__parse(
...
@@ -347,7 +347,7 @@ int git_attr_fnmatch__parse(
while
(
git__isspace
(
*
pattern
))
pattern
++
;
while
(
git__isspace
(
*
pattern
))
pattern
++
;
if
(
!*
pattern
||
*
pattern
==
'#'
)
{
if
(
!*
pattern
||
*
pattern
==
'#'
)
{
*
base
=
git__next_line
(
pattern
);
*
base
=
git__next_line
(
pattern
);
return
GIT_
E
NOTFOUND
;
return
GIT_NOTFOUND
;
}
}
spec
->
flags
=
0
;
spec
->
flags
=
0
;
...
@@ -464,7 +464,7 @@ static int merge_assignments(void **old_raw, void *new_raw)
...
@@ -464,7 +464,7 @@ static int merge_assignments(void **old_raw, void *new_raw)
GIT_REFCOUNT_DEC
(
*
old
,
git_attr_assignment__free
);
GIT_REFCOUNT_DEC
(
*
old
,
git_attr_assignment__free
);
*
old
=
new
;
*
old
=
new
;
return
GIT_E
E
XISTS
;
return
GIT_EXISTS
;
}
}
int
git_attr_assignment__parse
(
int
git_attr_assignment__parse
(
...
@@ -551,7 +551,7 @@ int git_attr_assignment__parse(
...
@@ -551,7 +551,7 @@ int git_attr_assignment__parse(
error
=
git_vector_insert_sorted
(
error
=
git_vector_insert_sorted
(
assigns
,
massign
,
&
merge_assignments
);
assigns
,
massign
,
&
merge_assignments
);
if
(
error
<
0
&&
error
!=
GIT_E
E
XISTS
)
if
(
error
<
0
&&
error
!=
GIT_EXISTS
)
return
error
;
return
error
;
}
}
}
}
...
@@ -559,7 +559,7 @@ int git_attr_assignment__parse(
...
@@ -559,7 +559,7 @@ int git_attr_assignment__parse(
/* insert allocated assign into vector */
/* insert allocated assign into vector */
error
=
git_vector_insert_sorted
(
assigns
,
assign
,
&
merge_assignments
);
error
=
git_vector_insert_sorted
(
assigns
,
assign
,
&
merge_assignments
);
if
(
error
<
0
&&
error
!=
GIT_E
E
XISTS
)
if
(
error
<
0
&&
error
!=
GIT_EXISTS
)
return
error
;
return
error
;
/* clear assign since it is now "owned" by the vector */
/* clear assign since it is now "owned" by the vector */
...
@@ -571,7 +571,7 @@ int git_attr_assignment__parse(
...
@@ -571,7 +571,7 @@ int git_attr_assignment__parse(
*
base
=
git__next_line
(
scan
);
*
base
=
git__next_line
(
scan
);
return
(
assigns
->
length
==
0
)
?
GIT_
E
NOTFOUND
:
0
;
return
(
assigns
->
length
==
0
)
?
GIT_NOTFOUND
:
0
;
}
}
static
void
git_attr_rule__clear
(
git_attr_rule
*
rule
)
static
void
git_attr_rule__clear
(
git_attr_rule
*
rule
)
...
...
src/branch.c
View file @
e172cf08
...
@@ -190,7 +190,7 @@ int git_branch_move(git_repository *repo, const char *old_branch_name, const cha
...
@@ -190,7 +190,7 @@ int git_branch_move(git_repository *repo, const char *old_branch_name, const cha
if
((
error
=
git_buf_joinpath
(
&
old_reference_name
,
GIT_REFS_HEADS_DIR
,
old_branch_name
))
<
0
)
if
((
error
=
git_buf_joinpath
(
&
old_reference_name
,
GIT_REFS_HEADS_DIR
,
old_branch_name
))
<
0
)
goto
cleanup
;
goto
cleanup
;
/* We need to be able to return GIT_
E
NOTFOUND */
/* We need to be able to return GIT_NOTFOUND */
if
((
error
=
git_reference_lookup
(
&
reference
,
repo
,
git_buf_cstr
(
&
old_reference_name
)))
<
0
)
if
((
error
=
git_reference_lookup
(
&
reference
,
repo
,
git_buf_cstr
(
&
old_reference_name
)))
<
0
)
goto
cleanup
;
goto
cleanup
;
...
...
src/commit.c
View file @
e172cf08
...
@@ -100,7 +100,7 @@ static int update_reference(git_repository *repo, git_oid *oid, const char *ref_
...
@@ -100,7 +100,7 @@ static int update_reference(git_repository *repo, git_oid *oid, const char *ref_
/* If we haven't found the reference at all, we assume we need to create
/* If we haven't found the reference at all, we assume we need to create
* a new reference and that's it */
* a new reference and that's it */
if
(
res
==
GIT_
E
NOTFOUND
)
{
if
(
res
==
GIT_NOTFOUND
)
{
giterr_clear
();
giterr_clear
();
return
git_reference_create_oid
(
NULL
,
repo
,
ref_name
,
oid
,
1
);
return
git_reference_create_oid
(
NULL
,
repo
,
ref_name
,
oid
,
1
);
}
}
...
@@ -125,7 +125,7 @@ static int update_reference(git_repository *repo, git_oid *oid, const char *ref_
...
@@ -125,7 +125,7 @@ static int update_reference(git_repository *repo, git_oid *oid, const char *ref_
* this is means we're creating a new branch, for example.
* this is means we're creating a new branch, for example.
* We need to create a new direct reference with that name
* We need to create a new direct reference with that name
*/
*/
if
(
res
==
GIT_
E
NOTFOUND
)
{
if
(
res
==
GIT_NOTFOUND
)
{
giterr_clear
();
giterr_clear
();
res
=
git_reference_create_oid
(
NULL
,
repo
,
sym_target
,
oid
,
1
);
res
=
git_reference_create_oid
(
NULL
,
repo
,
sym_target
,
oid
,
1
);
git_reference_free
(
ref
);
git_reference_free
(
ref
);
...
@@ -320,7 +320,7 @@ int git_commit_parent(git_commit **parent, git_commit *commit, unsigned int n)
...
@@ -320,7 +320,7 @@ int git_commit_parent(git_commit **parent, git_commit *commit, unsigned int n)
parent_oid
=
git_vector_get
(
&
commit
->
parent_oids
,
n
);
parent_oid
=
git_vector_get
(
&
commit
->
parent_oids
,
n
);
if
(
parent_oid
==
NULL
)
{
if
(
parent_oid
==
NULL
)
{
giterr_set
(
GITERR_INVALID
,
"Parent %u does not exist"
,
n
);
giterr_set
(
GITERR_INVALID
,
"Parent %u does not exist"
,
n
);
return
GIT_
E
NOTFOUND
;
return
GIT_NOTFOUND
;
}
}
return
git_commit_lookup
(
parent
,
commit
->
object
.
repo
,
parent_oid
);
return
git_commit_lookup
(
parent
,
commit
->
object
.
repo
,
parent_oid
);
...
...
src/config.c
View file @
e172cf08
...
@@ -263,7 +263,7 @@ int git_config_lookup_map_value(
...
@@ -263,7 +263,7 @@ int git_config_lookup_map_value(
size_t
i
;
size_t
i
;
if
(
!
value
)
if
(
!
value
)
return
GIT_
E
NOTFOUND
;
return
GIT_NOTFOUND
;
for
(
i
=
0
;
i
<
map_n
;
++
i
)
{
for
(
i
=
0
;
i
<
map_n
;
++
i
)
{
git_cvar_map
*
m
=
maps
+
i
;
git_cvar_map
*
m
=
maps
+
i
;
...
@@ -295,7 +295,7 @@ int git_config_lookup_map_value(
...
@@ -295,7 +295,7 @@ int git_config_lookup_map_value(
}
}
}
}
return
GIT_
E
NOTFOUND
;
return
GIT_NOTFOUND
;
}
}
int
git_config_get_mapped
(
int
git_config_get_mapped
(
...
@@ -387,12 +387,12 @@ int git_config_get_string(const char **out, git_config *cfg, const char *name)
...
@@ -387,12 +387,12 @@ int git_config_get_string(const char **out, git_config *cfg, const char *name)
git_vector_foreach
(
&
cfg
->
files
,
i
,
internal
)
{
git_vector_foreach
(
&
cfg
->
files
,
i
,
internal
)
{
git_config_file
*
file
=
internal
->
file
;
git_config_file
*
file
=
internal
->
file
;
int
ret
=
file
->
get
(
file
,
name
,
out
);
int
ret
=
file
->
get
(
file
,
name
,
out
);
if
(
ret
!=
GIT_
E
NOTFOUND
)
if
(
ret
!=
GIT_NOTFOUND
)
return
ret
;
return
ret
;
}
}
giterr_set
(
GITERR_CONFIG
,
"Config variable '%s' not found"
,
name
);
giterr_set
(
GITERR_CONFIG
,
"Config variable '%s' not found"
,
name
);
return
GIT_
E
NOTFOUND
;
return
GIT_NOTFOUND
;
}
}
int
git_config_get_multivar
(
git_config
*
cfg
,
const
char
*
name
,
const
char
*
regexp
,
int
git_config_get_multivar
(
git_config
*
cfg
,
const
char
*
name
,
const
char
*
regexp
,
...
@@ -400,7 +400,7 @@ int git_config_get_multivar(git_config *cfg, const char *name, const char *regex
...
@@ -400,7 +400,7 @@ int git_config_get_multivar(git_config *cfg, const char *name, const char *regex
{
{
file_internal
*
internal
;
file_internal
*
internal
;
git_config_file
*
file
;
git_config_file
*
file
;
int
ret
=
GIT_
E
NOTFOUND
;
int
ret
=
GIT_NOTFOUND
;
unsigned
int
i
;
unsigned
int
i
;
assert
(
cfg
->
files
.
length
);
assert
(
cfg
->
files
.
length
);
...
@@ -413,7 +413,7 @@ int git_config_get_multivar(git_config *cfg, const char *name, const char *regex
...
@@ -413,7 +413,7 @@ int git_config_get_multivar(git_config *cfg, const char *name, const char *regex
internal
=
git_vector_get
(
&
cfg
->
files
,
i
-
1
);
internal
=
git_vector_get
(
&
cfg
->
files
,
i
-
1
);
file
=
internal
->
file
;
file
=
internal
->
file
;
ret
=
file
->
get_multivar
(
file
,
name
,
regexp
,
fn
,
data
);
ret
=
file
->
get_multivar
(
file
,
name
,
regexp
,
fn
,
data
);
if
(
ret
<
0
&&
ret
!=
GIT_
E
NOTFOUND
)
if
(
ret
<
0
&&
ret
!=
GIT_NOTFOUND
)
return
ret
;
return
ret
;
}
}
...
@@ -424,14 +424,14 @@ int git_config_set_multivar(git_config *cfg, const char *name, const char *regex
...
@@ -424,14 +424,14 @@ int git_config_set_multivar(git_config *cfg, const char *name, const char *regex
{
{
file_internal
*
internal
;
file_internal
*
internal
;
git_config_file
*
file
;
git_config_file
*
file
;
int
ret
=
GIT_
E
NOTFOUND
;
int
ret
=
GIT_NOTFOUND
;
unsigned
int
i
;
unsigned
int
i
;
for
(
i
=
cfg
->
files
.
length
;
i
>
0
;
--
i
)
{
for
(
i
=
cfg
->
files
.
length
;
i
>
0
;
--
i
)
{
internal
=
git_vector_get
(
&
cfg
->
files
,
i
-
1
);
internal
=
git_vector_get
(
&
cfg
->
files
,
i
-
1
);
file
=
internal
->
file
;
file
=
internal
->
file
;
ret
=
file
->
set_multivar
(
file
,
name
,
regexp
,
value
);
ret
=
file
->
set_multivar
(
file
,
name
,
regexp
,
value
);
if
(
ret
<
0
&&
ret
!=
GIT_
E
NOTFOUND
)
if
(
ret
<
0
&&
ret
!=
GIT_NOTFOUND
)
return
ret
;
return
ret
;
}
}
...
...
src/config_cache.c
View file @
e172cf08
...
@@ -66,22 +66,22 @@ int git_repository__cvar(int *out, git_repository *repo, git_cvar_cached cvar)
...
@@ -66,22 +66,22 @@ int git_repository__cvar(int *out, git_repository *repo, git_cvar_cached cvar)
int
error
;
int
error
;
error
=
git_repository_config__weakptr
(
&
config
,
repo
);
error
=
git_repository_config__weakptr
(
&
config
,
repo
);
if
(
error
<
GIT_SUCCESS
)
if
(
error
<
0
)
return
error
;
return
error
;
error
=
git_config_get_mapped
(
out
,
error
=
git_config_get_mapped
(
out
,
config
,
data
->
cvar_name
,
data
->
maps
,
data
->
map_count
);
config
,
data
->
cvar_name
,
data
->
maps
,
data
->
map_count
);
if
(
error
==
GIT_
E
NOTFOUND
)
if
(
error
==
GIT_NOTFOUND
)
*
out
=
data
->
default_value
;
*
out
=
data
->
default_value
;
else
if
(
error
<
GIT_SUCCESS
)
else
if
(
error
<
0
)
return
error
;
return
error
;
repo
->
cvar_cache
[(
int
)
cvar
]
=
*
out
;
repo
->
cvar_cache
[(
int
)
cvar
]
=
*
out
;
}
}
return
GIT_SUCCESS
;
return
0
;
}
}
void
git_repository__cvar_cache_clear
(
git_repository
*
repo
)
void
git_repository__cvar_cache_clear
(
git_repository
*
repo
)
...
...
src/config_file.c
View file @
e172cf08
...
@@ -161,7 +161,7 @@ static int config_open(git_config_file *cfg)
...
@@ -161,7 +161,7 @@ static int config_open(git_config_file *cfg)
res
=
git_futils_readbuffer
(
&
b
->
reader
.
buffer
,
b
->
file_path
);
res
=
git_futils_readbuffer
(
&
b
->
reader
.
buffer
,
b
->
file_path
);
/* It's fine if the file doesn't exist */
/* It's fine if the file doesn't exist */
if
(
res
==
GIT_
E
NOTFOUND
)
if
(
res
==
GIT_NOTFOUND
)
return
0
;
return
0
;
if
(
res
<
0
||
config_parse
(
b
)
<
0
)
{
if
(
res
<
0
||
config_parse
(
b
)
<
0
)
{
...
@@ -289,7 +289,7 @@ static int config_get(git_config_file *cfg, const char *name, const char **out)
...
@@ -289,7 +289,7 @@ static int config_get(git_config_file *cfg, const char *name, const char **out)
/* no error message; the config system will write one */
/* no error message; the config system will write one */
if
(
!
git_strmap_valid_index
(
b
->
values
,
pos
))
if
(
!
git_strmap_valid_index
(
b
->
values
,
pos
))
return
GIT_
E
NOTFOUND
;
return
GIT_NOTFOUND
;
*
out
=
((
cvar_t
*
)
git_strmap_value_at
(
b
->
values
,
pos
))
->
value
;
*
out
=
((
cvar_t
*
)
git_strmap_value_at
(
b
->
values
,
pos
))
->
value
;
...
@@ -315,7 +315,7 @@ static int config_get_multivar(
...
@@ -315,7 +315,7 @@ static int config_get_multivar(
git__free
(
key
);
git__free
(
key
);
if
(
!
git_strmap_valid_index
(
b
->
values
,
pos
))
if
(
!
git_strmap_valid_index
(
b
->
values
,
pos
))
return
GIT_
E
NOTFOUND
;
return
GIT_NOTFOUND
;
var
=
git_strmap_value_at
(
b
->
values
,
pos
);
var
=
git_strmap_value_at
(
b
->
values
,
pos
);
...
@@ -377,7 +377,7 @@ static int config_set_multivar(
...
@@ -377,7 +377,7 @@ static int config_set_multivar(
pos
=
git_strmap_lookup_index
(
b
->
values
,
key
);
pos
=
git_strmap_lookup_index
(
b
->
values
,
key
);
if
(
!
git_strmap_valid_index
(
b
->
values
,
pos
))
{
if
(
!
git_strmap_valid_index
(
b
->
values
,
pos
))
{
git__free
(
key
);
git__free
(
key
);
return
GIT_
E
NOTFOUND
;
return
GIT_NOTFOUND
;
}
}
var
=
git_strmap_value_at
(
b
->
values
,
pos
);
var
=
git_strmap_value_at
(
b
->
values
,
pos
);
...
@@ -444,7 +444,7 @@ static int config_delete(git_config_file *cfg, const char *name)
...
@@ -444,7 +444,7 @@ static int config_delete(git_config_file *cfg, const char *name)
git__free
(
key
);
git__free
(
key
);
if
(
!
git_strmap_valid_index
(
b
->
values
,
pos
))
if
(
!
git_strmap_valid_index
(
b
->
values
,
pos
))
return
GIT_
E
NOTFOUND
;
return
GIT_NOTFOUND
;
var
=
git_strmap_value_at
(
b
->
values
,
pos
);
var
=
git_strmap_value_at
(
b
->
values
,
pos
);
...
@@ -978,7 +978,7 @@ static int config_write(diskfile_backend *cfg, const char *key, const regex_t *p
...
@@ -978,7 +978,7 @@ static int config_write(diskfile_backend *cfg, const char *key, const regex_t *p
result
=
git_futils_readbuffer
(
&
cfg
->
reader
.
buffer
,
cfg
->
file_path
);
result
=
git_futils_readbuffer
(
&
cfg
->
reader
.
buffer
,
cfg
->
file_path
);
/* Initialise the reading position */
/* Initialise the reading position */
if
(
result
==
GIT_
E
NOTFOUND
)
{
if
(
result
==
GIT_NOTFOUND
)
{
cfg
->
reader
.
read_ptr
=
NULL
;
cfg
->
reader
.
read_ptr
=
NULL
;
cfg
->
reader
.
eof
=
1
;
cfg
->
reader
.
eof
=
1
;
data_start
=
NULL
;
data_start
=
NULL
;
...
...
src/crlf.c
View file @
e172cf08
...
@@ -85,13 +85,13 @@ static int crlf_load_attributes(struct crlf_attrs *ca, git_repository *repo, con
...
@@ -85,13 +85,13 @@ static int crlf_load_attributes(struct crlf_attrs *ca, git_repository *repo, con
error
=
git_attr_get_many
(
attr_vals
,
error
=
git_attr_get_many
(
attr_vals
,
repo
,
0
,
path
,
NUM_CONV_ATTRS
,
attr_names
);
repo
,
0
,
path
,
NUM_CONV_ATTRS
,
attr_names
);
if
(
error
==
GIT_
E
NOTFOUND
)
{
if
(
error
==
GIT_NOTFOUND
)
{
ca
->
crlf_action
=
GIT_CRLF_GUESS
;
ca
->
crlf_action
=
GIT_CRLF_GUESS
;
ca
->
eol
=
GIT_EOL_UNSET
;
ca
->
eol
=
GIT_EOL_UNSET
;
return
0
;
return
0
;
}
}
if
(
error
==
GIT_SUCCESS
)
{
if
(
error
==
0
)
{
ca
->
crlf_action
=
check_crlf
(
attr_vals
[
2
]);
/* text */
ca
->
crlf_action
=
check_crlf
(
attr_vals
[
2
]);
/* text */
if
(
ca
->
crlf_action
==
GIT_CRLF_GUESS
)
if
(
ca
->
crlf_action
==
GIT_CRLF_GUESS
)
ca
->
crlf_action
=
check_crlf
(
attr_vals
[
0
]);
/* clrf */
ca
->
crlf_action
=
check_crlf
(
attr_vals
[
0
]);
/* clrf */
...
@@ -207,7 +207,7 @@ int git_filter_add__crlf_to_odb(git_vector *filters, git_repository *repo, const
...
@@ -207,7 +207,7 @@ int git_filter_add__crlf_to_odb(git_vector *filters, git_repository *repo, const
int
auto_crlf
;
int
auto_crlf
;
if
((
error
=
git_repository__cvar
(
if
((
error
=
git_repository__cvar
(
&
auto_crlf
,
repo
,
GIT_CVAR_AUTO_CRLF
))
<
GIT_SUCCESS
)
&
auto_crlf
,
repo
,
GIT_CVAR_AUTO_CRLF
))
<
0
)
return
error
;
return
error
;
if
(
auto_crlf
==
GIT_AUTO_CRLF_FALSE
)
if
(
auto_crlf
==
GIT_AUTO_CRLF_FALSE
)
...
...
src/delta-apply.c
View file @
e172cf08
...
@@ -111,7 +111,7 @@ int git__delta_apply(
...
@@ -111,7 +111,7 @@ int git__delta_apply(
if
(
delta
!=
delta_end
||
res_sz
)
if
(
delta
!=
delta_end
||
res_sz
)
goto
fail
;
goto
fail
;
return
GIT_SUCCESS
;
return
0
;
fail:
fail:
git__free
(
out
->
data
);
git__free
(
out
->
data
);
...
...
src/delta-apply.h
View file @
e172cf08
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
* @param delta the delta to execute copy/insert instructions from.
* @param delta the delta to execute copy/insert instructions from.
* @param delta_len total number of bytes in the delta.
* @param delta_len total number of bytes in the delta.
* @return
* @return
* -
GIT_SUCCESS
on a successful delta unpack.
* -
0
on a successful delta unpack.
* - GIT_ERROR if the delta is corrupt or doesn't match the base.
* - GIT_ERROR if the delta is corrupt or doesn't match the base.
*/
*/
extern
int
git__delta_apply
(
extern
int
git__delta_apply
(
...
...
src/diff.c
View file @
e172cf08
...
@@ -343,7 +343,7 @@ static git_diff_list *git_diff_list_alloc(
...
@@ -343,7 +343,7 @@ static git_diff_list *git_diff_list_alloc(
if
(
!
match
)
if
(
!
match
)
goto
fail
;
goto
fail
;
ret
=
git_attr_fnmatch__parse
(
match
,
&
diff
->
pool
,
NULL
,
&
pattern
);
ret
=
git_attr_fnmatch__parse
(
match
,
&
diff
->
pool
,
NULL
,
&
pattern
);
if
(
ret
==
GIT_
E
NOTFOUND
)
{
if
(
ret
==
GIT_NOTFOUND
)
{
git__free
(
match
);
git__free
(
match
);
continue
;
continue
;
}
else
if
(
ret
<
0
)
}
else
if
(
ret
<
0
)
...
...
src/fileops.c
View file @
e172cf08
...
@@ -95,7 +95,7 @@ int git_futils_open_ro(const char *path)
...
@@ -95,7 +95,7 @@ int git_futils_open_ro(const char *path)
int
fd
=
p_open
(
path
,
O_RDONLY
);
int
fd
=
p_open
(
path
,
O_RDONLY
);
if
(
fd
<
0
)
{
if
(
fd
<
0
)
{
if
(
errno
==
ENOENT
)
if
(
errno
==
ENOENT
)
fd
=
GIT_
E
NOTFOUND
;
fd
=
GIT_NOTFOUND
;
giterr_set
(
GITERR_OS
,
"Failed to open '%s'"
,
path
);
giterr_set
(
GITERR_OS
,
"Failed to open '%s'"
,
path
);
}
}
return
fd
;
return
fd
;
...
@@ -365,7 +365,7 @@ int git_futils_find_global_file(git_buf *path, const char *filename)
...
@@ -365,7 +365,7 @@ int git_futils_find_global_file(git_buf *path, const char *filename)
if
(
git_path_exists
(
path
->
ptr
)
==
false
)
{
if
(
git_path_exists
(
path
->
ptr
)
==
false
)
{
git_buf_clear
(
path
);
git_buf_clear
(
path
);
return
GIT_
E
NOTFOUND
;
return
GIT_NOTFOUND
;
}
}
return
0
;
return
0
;
...
@@ -414,7 +414,7 @@ static int win32_find_system_file(git_buf *path, const char *filename)
...
@@ -414,7 +414,7 @@ static int win32_find_system_file(git_buf *path, const char *filename)
char
*
file_utf8
=
NULL
;
char
*
file_utf8
=
NULL
;
if
(
!
root
||
!
filename
||
(
len
=
strlen
(
filename
))
==
0
)
if
(
!
root
||
!
filename
||
(
len
=
strlen
(
filename
))
==
0
)
return
GIT_
E
NOTFOUND
;
return
GIT_NOTFOUND
;
/* allocate space for wchar_t path to file */
/* allocate space for wchar_t path to file */
file_utf16
=
git__calloc
(
root
->
len
+
len
+
2
,
sizeof
(
wchar_t
));
file_utf16
=
git__calloc
(
root
->
len
+
len
+
2
,
sizeof
(
wchar_t
));
...
@@ -438,7 +438,7 @@ static int win32_find_system_file(git_buf *path, const char *filename)
...
@@ -438,7 +438,7 @@ static int win32_find_system_file(git_buf *path, const char *filename)
/* check access */
/* check access */
if
(
_waccess
(
file_utf16
,
F_OK
)
<
0
)
{
if
(
_waccess
(
file_utf16
,
F_OK
)
<
0
)
{
error
=
GIT_
E
NOTFOUND
;
error
=
GIT_NOTFOUND
;
goto
cleanup
;
goto
cleanup
;
}
}
...
@@ -470,6 +470,6 @@ int git_futils_find_system_file(git_buf *path, const char *filename)
...
@@ -470,6 +470,6 @@ int git_futils_find_system_file(git_buf *path, const char *filename)
#ifdef GIT_WIN32
#ifdef GIT_WIN32
return
win32_find_system_file
(
path
,
filename
);
return
win32_find_system_file
(
path
,
filename
);
#else
#else
return
GIT_
E
NOTFOUND
;
return
GIT_NOTFOUND
;
#endif
#endif
}
}
src/fileops.h
View file @
e172cf08
...
@@ -139,7 +139,7 @@ extern int git_futils_mmap_ro(
...
@@ -139,7 +139,7 @@ extern int git_futils_mmap_ro(
* @param path path to file to be opened.
* @param path path to file to be opened.
* @return
* @return
* - 0 on success;
* - 0 on success;
* - GIT_
E
NOTFOUND if not found;
* - GIT_NOTFOUND if not found;
* - -1 on an unspecified OS related error.
* - -1 on an unspecified OS related error.
*/
*/
extern
int
git_futils_mmap_ro_file
(
extern
int
git_futils_mmap_ro_file
(
...
@@ -159,7 +159,7 @@ extern void git_futils_mmap_free(git_map *map);
...
@@ -159,7 +159,7 @@ extern void git_futils_mmap_free(git_map *map);
* @param filename name of file to find in the home directory
* @param filename name of file to find in the home directory
* @return
* @return
* - 0 if found;
* - 0 if found;
* - GIT_
E
NOTFOUND if not found;
* - GIT_NOTFOUND if not found;
* - -1 on an unspecified OS related error.
* - -1 on an unspecified OS related error.
*/
*/
extern
int
git_futils_find_global_file
(
git_buf
*
path
,
const
char
*
filename
);
extern
int
git_futils_find_global_file
(
git_buf
*
path
,
const
char
*
filename
);
...
@@ -171,7 +171,7 @@ extern int git_futils_find_global_file(git_buf *path, const char *filename);
...
@@ -171,7 +171,7 @@ extern int git_futils_find_global_file(git_buf *path, const char *filename);
* @param filename name of file to find in the home directory
* @param filename name of file to find in the home directory
* @return
* @return
* - 0 if found;
* - 0 if found;
* - GIT_
E
NOTFOUND if not found;
* - GIT_NOTFOUND if not found;
* - -1 on an unspecified OS related error.
* - -1 on an unspecified OS related error.
*/
*/
extern
int
git_futils_find_system_file
(
git_buf
*
path
,
const
char
*
filename
);
extern
int
git_futils_find_system_file
(
git_buf
*
path
,
const
char
*
filename
);
...
...
src/filter.c
View file @
e172cf08
...
@@ -129,7 +129,7 @@ int git_filters_apply(git_buf *dest, git_buf *source, git_vector *filters)
...
@@ -129,7 +129,7 @@ int git_filters_apply(git_buf *dest, git_buf *source, git_vector *filters)
if
(
git_buf_len
(
source
)
==
0
)
{
if
(
git_buf_len
(
source
)
==
0
)
{
git_buf_clear
(
dest
);
git_buf_clear
(
dest
);
return
GIT_SUCCESS
;
return
0
;
}
}
/* Pre-grow the destination buffer to more or less the size
/* Pre-grow the destination buffer to more or less the size
...
@@ -160,6 +160,6 @@ int git_filters_apply(git_buf *dest, git_buf *source, git_vector *filters)
...
@@ -160,6 +160,6 @@ int git_filters_apply(git_buf *dest, git_buf *source, git_vector *filters)
if
(
src
!=
1
)
if
(
src
!=
1
)
git_buf_swap
(
dest
,
source
);
git_buf_swap
(
dest
,
source
);
return
GIT_SUCCESS
;
return
0
;
}
}
src/filter.h
View file @
e172cf08
...
@@ -75,7 +75,7 @@ extern int git_filters_load(git_vector *filters, git_repository *repo, const cha
...
@@ -75,7 +75,7 @@ extern int git_filters_load(git_vector *filters, git_repository *repo, const cha
* @param dest Buffer to store the result of the filtering
* @param dest Buffer to store the result of the filtering
* @param source Buffer containing the document to filter
* @param source Buffer containing the document to filter
* @param filters A non-empty vector of filters as supplied by `git_filters_load`
* @param filters A non-empty vector of filters as supplied by `git_filters_load`
* @return
GIT_SUCCESS
on success, an error code otherwise
* @return
0
on success, an error code otherwise
*/
*/
extern
int
git_filters_apply
(
git_buf
*
dest
,
git_buf
*
source
,
git_vector
*
filters
);
extern
int
git_filters_apply
(
git_buf
*
dest
,
git_buf
*
source
,
git_vector
*
filters
);
...
...
src/ignore.c
View file @
e172cf08
...
@@ -40,7 +40,7 @@ static int parse_ignore_file(
...
@@ -40,7 +40,7 @@ static int parse_ignore_file(
git__free
(
match
->
pattern
);
git__free
(
match
->
pattern
);
match
->
pattern
=
NULL
;
match
->
pattern
=
NULL
;
if
(
error
==
GIT_
E
NOTFOUND
)
if
(
error
==
GIT_NOTFOUND
)
error
=
0
;
error
=
0
;
}
else
{
}
else
{
match
=
NULL
;
/* vector now "owns" the match */
match
=
NULL
;
/* vector now "owns" the match */
...
...
src/index.c
View file @
e172cf08
...
@@ -411,7 +411,7 @@ static int index_insert(git_index *index, git_index_entry *entry, int replace)
...
@@ -411,7 +411,7 @@ static int index_insert(git_index *index, git_index_entry *entry, int replace)
* if no entry exists add the entry at the end;
* if no entry exists add the entry at the end;
* the index is no longer sorted
* the index is no longer sorted
*/
*/
if
(
position
==
GIT_
E
NOTFOUND
)
if
(
position
==
GIT_NOTFOUND
)
return
git_vector_insert
(
&
index
->
entries
,
entry
);
return
git_vector_insert
(
&
index
->
entries
,
entry
);
/* exists, replace it */
/* exists, replace it */
...
...
src/indexer.c
View file @
e172cf08
...
@@ -205,9 +205,9 @@ static int store_delta(git_indexer_stream *idx)
...
@@ -205,9 +205,9 @@ static int store_delta(git_indexer_stream *idx)
}
}
error
=
packfile_unpack_compressed
(
&
obj
,
idx
->
pack
,
&
w
,
&
idx
->
off
,
entry_size
,
type
);
error
=
packfile_unpack_compressed
(
&
obj
,
idx
->
pack
,
&
w
,
&
idx
->
off
,
entry_size
,
type
);
if
(
error
==
GIT_
E
SHORTBUFFER
)
{
if
(
error
==
GIT_SHORTBUFFER
)
{
idx
->
off
=
entry_start
;
idx
->
off
=
entry_start
;
return
GIT_
E
SHORTBUFFER
;
return
GIT_SHORTBUFFER
;
}
else
if
(
error
<
0
){
}
else
if
(
error
<
0
){
return
-
1
;
return
-
1
;
}
}
...
@@ -355,7 +355,7 @@ int git_indexer_stream_add(git_indexer_stream *idx, const void *data, size_t siz
...
@@ -355,7 +355,7 @@ int git_indexer_stream_add(git_indexer_stream *idx, const void *data, size_t siz
return
0
;
return
0
;
error
=
git_packfile_unpack
(
&
obj
,
idx
->
pack
,
&
idx
->
off
);
error
=
git_packfile_unpack
(
&
obj
,
idx
->
pack
,
&
idx
->
off
);
if
(
error
==
GIT_
E
SHORTBUFFER
)
{
if
(
error
==
GIT_SHORTBUFFER
)
{
idx
->
off
=
entry_start
;
idx
->
off
=
entry_start
;
return
0
;
return
0
;
}
}
...
@@ -363,7 +363,7 @@ int git_indexer_stream_add(git_indexer_stream *idx, const void *data, size_t siz
...
@@ -363,7 +363,7 @@ int git_indexer_stream_add(git_indexer_stream *idx, const void *data, size_t siz
if
(
error
<
0
)
{
if
(
error
<
0
)
{
idx
->
off
=
entry_start
;
idx
->
off
=
entry_start
;
error
=
store_delta
(
idx
);
error
=
store_delta
(
idx
);
if
(
error
==
GIT_
E
SHORTBUFFER
)
if
(
error
==
GIT_SHORTBUFFER
)
return
0
;
return
0
;
if
(
error
<
0
)
if
(
error
<
0
)
return
error
;
return
error
;
...
...
src/iterator.c
View file @
e172cf08
...
@@ -468,7 +468,7 @@ static int workdir_iterator__expand_dir(workdir_iterator *wi)
...
@@ -468,7 +468,7 @@ static int workdir_iterator__expand_dir(workdir_iterator *wi)
error
=
git_path_dirload_with_stat
(
wi
->
path
.
ptr
,
wi
->
root_len
,
&
wf
->
entries
);
error
=
git_path_dirload_with_stat
(
wi
->
path
.
ptr
,
wi
->
root_len
,
&
wf
->
entries
);
if
(
error
<
0
||
wf
->
entries
.
length
==
0
)
{
if
(
error
<
0
||
wf
->
entries
.
length
==
0
)
{
workdir_iterator__free_frame
(
wf
);
workdir_iterator__free_frame
(
wf
);
return
GIT_
E
NOTFOUND
;
return
GIT_NOTFOUND
;
}
}
git_vector_sort
(
&
wf
->
entries
);
git_vector_sort
(
&
wf
->
entries
);
...
@@ -635,7 +635,7 @@ static int workdir_iterator__update_entry(workdir_iterator *wi)
...
@@ -635,7 +635,7 @@ static int workdir_iterator__update_entry(workdir_iterator *wi)
if
(
!
is_submodule
)
{
if
(
!
is_submodule
)
{
int
res
=
git_submodule_lookup
(
NULL
,
wi
->
repo
,
wi
->
entry
.
path
);
int
res
=
git_submodule_lookup
(
NULL
,
wi
->
repo
,
wi
->
entry
.
path
);
is_submodule
=
(
res
==
0
);
is_submodule
=
(
res
==
0
);
if
(
res
==
GIT_
E
NOTFOUND
)
if
(
res
==
GIT_NOTFOUND
)
giterr_clear
();
giterr_clear
();
}
}
...
@@ -683,7 +683,7 @@ int git_iterator_for_workdir_range(
...
@@ -683,7 +683,7 @@ int git_iterator_for_workdir_range(
wi
->
root_len
=
wi
->
path
.
size
;
wi
->
root_len
=
wi
->
path
.
size
;
if
((
error
=
workdir_iterator__expand_dir
(
wi
))
<
0
)
{
if
((
error
=
workdir_iterator__expand_dir
(
wi
))
<
0
)
{
if
(
error
==
GIT_
E
NOTFOUND
)
if
(
error
==
GIT_NOTFOUND
)
error
=
0
;
error
=
0
;
else
{
else
{
git_iterator_free
((
git_iterator
*
)
wi
);
git_iterator_free
((
git_iterator
*
)
wi
);
...
...
src/notes.c
View file @
e172cf08
...
@@ -73,7 +73,7 @@ static int find_blob(git_oid *blob, git_tree *tree, const char *target)
...
@@ -73,7 +73,7 @@ static int find_blob(git_oid *blob, git_tree *tree, const char *target)
return
0
;
return
0
;
}
}
}
}
return
GIT_
E
NOTFOUND
;
return
GIT_NOTFOUND
;
}
}
static
int
note_write
(
git_oid
*
out
,
git_repository
*
repo
,
static
int
note_write
(
git_oid
*
out
,
git_repository
*
repo
,
...
@@ -96,11 +96,11 @@ static int note_write(git_oid *out, git_repository *repo,
...
@@ -96,11 +96,11 @@ static int note_write(git_oid *out, git_repository *repo,
return
error
;
return
error
;
error
=
find_blob
(
&
oid
,
tree
,
target
+
fanout
);
error
=
find_blob
(
&
oid
,
tree
,
target
+
fanout
);
if
(
error
!=
GIT_
E
NOTFOUND
)
{
if
(
error
!=
GIT_NOTFOUND
)
{
git_tree_free
(
tree
);
git_tree_free
(
tree
);
if
(
!
error
)
{
if
(
!
error
)
{
giterr_set
(
GITERR_REPOSITORY
,
"Note for '%s' exists already"
,
target
);
giterr_set
(
GITERR_REPOSITORY
,
"Note for '%s' exists already"
,
target
);
error
=
GIT_E
E
XISTS
;
error
=
GIT_EXISTS
;
}
}
return
error
;
return
error
;
}
}
...
@@ -275,7 +275,7 @@ static int note_get_default_ref(const char **out, git_repository *repo)
...
@@ -275,7 +275,7 @@ static int note_get_default_ref(const char **out, git_repository *repo)
return
-
1
;
return
-
1
;
ret
=
git_config_get_string
(
out
,
cfg
,
"core.notesRef"
);
ret
=
git_config_get_string
(
out
,
cfg
,
"core.notesRef"
);
if
(
ret
==
GIT_
E
NOTFOUND
)
{
if
(
ret
==
GIT_NOTFOUND
)
{
*
out
=
GIT_NOTES_DEFAULT_REF
;
*
out
=
GIT_NOTES_DEFAULT_REF
;
return
0
;
return
0
;
}
}
...
@@ -352,7 +352,7 @@ int git_note_create(
...
@@ -352,7 +352,7 @@ int git_note_create(
return
-
1
;
return
-
1
;
error
=
git_reference_lookup
(
&
ref
,
repo
,
notes_ref
);
error
=
git_reference_lookup
(
&
ref
,
repo
,
notes_ref
);
if
(
error
<
0
&&
error
!=
GIT_
E
NOTFOUND
)
if
(
error
<
0
&&
error
!=
GIT_NOTFOUND
)
return
error
;
return
error
;
if
(
!
error
)
{
if
(
!
error
)
{
...
...
src/object.c
View file @
e172cf08
...
@@ -74,7 +74,7 @@ static int create_object(git_object **object_out, git_otype type)
...
@@ -74,7 +74,7 @@ static int create_object(git_object **object_out, git_otype type)
object
->
type
=
type
;
object
->
type
=
type
;
*
object_out
=
object
;
*
object_out
=
object
;
return
GIT_SUCCESS
;
return
0
;
}
}
int
git_object_lookup_prefix
(
int
git_object_lookup_prefix
(
...
@@ -87,15 +87,15 @@ int git_object_lookup_prefix(
...
@@ -87,15 +87,15 @@ int git_object_lookup_prefix(
git_object
*
object
=
NULL
;
git_object
*
object
=
NULL
;
git_odb
*
odb
=
NULL
;
git_odb
*
odb
=
NULL
;
git_odb_object
*
odb_obj
;
git_odb_object
*
odb_obj
;
int
error
=
GIT_SUCCESS
;
int
error
=
0
;
assert
(
repo
&&
object_out
&&
id
);
assert
(
repo
&&
object_out
&&
id
);
if
(
len
<
GIT_OID_MINPREFIXLEN
)
if
(
len
<
GIT_OID_MINPREFIXLEN
)
return
GIT_
E
AMBIGUOUS
;
return
GIT_AMBIGUOUS
;
error
=
git_repository_odb__weakptr
(
&
odb
,
repo
);
error
=
git_repository_odb__weakptr
(
&
odb
,
repo
);
if
(
error
<
GIT_SUCCESS
)
if
(
error
<
0
)
return
error
;
return
error
;
if
(
len
>
GIT_OID_HEXSZ
)
if
(
len
>
GIT_OID_HEXSZ
)
...
@@ -110,7 +110,7 @@ int git_object_lookup_prefix(
...
@@ -110,7 +110,7 @@ int git_object_lookup_prefix(
if
(
type
!=
GIT_OBJ_ANY
&&
type
!=
object
->
type
)
{
if
(
type
!=
GIT_OBJ_ANY
&&
type
!=
object
->
type
)
{
git_object_free
(
object
);
git_object_free
(
object
);
giterr_set
(
GITERR_ODB
,
"The given type does not match the type in ODB"
);
giterr_set
(
GITERR_ODB
,
"The given type does not match the type in ODB"
);
return
GIT_
E
NOTFOUND
;
return
GIT_NOTFOUND
;
}
}
*
object_out
=
object
;
*
object_out
=
object
;
...
@@ -151,7 +151,7 @@ int git_object_lookup_prefix(
...
@@ -151,7 +151,7 @@ int git_object_lookup_prefix(
if
(
type
!=
GIT_OBJ_ANY
&&
type
!=
odb_obj
->
raw
.
type
)
{
if
(
type
!=
GIT_OBJ_ANY
&&
type
!=
odb_obj
->
raw
.
type
)
{
git_odb_object_free
(
odb_obj
);
git_odb_object_free
(
odb_obj
);
giterr_set
(
GITERR_ODB
,
"The given type does not match the type on the ODB"
);
giterr_set
(
GITERR_ODB
,
"The given type does not match the type on the ODB"
);
return
GIT_
E
NOTFOUND
;
return
GIT_NOTFOUND
;
}
}
type
=
odb_obj
->
raw
.
type
;
type
=
odb_obj
->
raw
.
type
;
...
...
src/odb.c
View file @
e172cf08
...
@@ -485,7 +485,7 @@ int git_odb_exists(git_odb *db, const git_oid *id)
...
@@ -485,7 +485,7 @@ int git_odb_exists(git_odb *db, const git_oid *id)
int
git_odb_read_header
(
size_t
*
len_p
,
git_otype
*
type_p
,
git_odb
*
db
,
const
git_oid
*
id
)
int
git_odb_read_header
(
size_t
*
len_p
,
git_otype
*
type_p
,
git_odb
*
db
,
const
git_oid
*
id
)
{
{
unsigned
int
i
;
unsigned
int
i
;
int
error
=
GIT_
E
NOTFOUND
;
int
error
=
GIT_NOTFOUND
;
git_odb_object
*
object
;
git_odb_object
*
object
;
assert
(
db
&&
id
);
assert
(
db
&&
id
);
...
@@ -505,7 +505,7 @@ int git_odb_read_header(size_t *len_p, git_otype *type_p, git_odb *db, const git
...
@@ -505,7 +505,7 @@ int git_odb_read_header(size_t *len_p, git_otype *type_p, git_odb *db, const git
error
=
b
->
read_header
(
len_p
,
type_p
,
b
,
id
);
error
=
b
->
read_header
(
len_p
,
type_p
,
b
,
id
);
}
}
if
(
!
error
||
error
==
GIT_
E
PASSTHROUGH
)
if
(
!
error
||
error
==
GIT_PASSTHROUGH
)
return
0
;
return
0
;
/*
/*
...
@@ -524,7 +524,7 @@ int git_odb_read_header(size_t *len_p, git_otype *type_p, git_odb *db, const git
...
@@ -524,7 +524,7 @@ int git_odb_read_header(size_t *len_p, git_otype *type_p, git_odb *db, const git
int
git_odb_read
(
git_odb_object
**
out
,
git_odb
*
db
,
const
git_oid
*
id
)
int
git_odb_read
(
git_odb_object
**
out
,
git_odb
*
db
,
const
git_oid
*
id
)
{
{
unsigned
int
i
;
unsigned
int
i
;
int
error
=
GIT_
E
NOTFOUND
;
int
error
=
GIT_NOTFOUND
;
git_rawobj
raw
;
git_rawobj
raw
;
assert
(
out
&&
db
&&
id
);
assert
(
out
&&
db
&&
id
);
...
@@ -541,11 +541,11 @@ int git_odb_read(git_odb_object **out, git_odb *db, const git_oid *id)
...
@@ -541,11 +541,11 @@ int git_odb_read(git_odb_object **out, git_odb *db, const git_oid *id)
error
=
b
->
read
(
&
raw
.
data
,
&
raw
.
len
,
&
raw
.
type
,
b
,
id
);
error
=
b
->
read
(
&
raw
.
data
,
&
raw
.
len
,
&
raw
.
type
,
b
,
id
);
}
}
/* TODO: If no backends are configured, this returns GIT_
E
NOTFOUND but
/* TODO: If no backends are configured, this returns GIT_NOTFOUND but
* will never have called giterr_set().
* will never have called giterr_set().
*/
*/
if
(
error
&&
error
!=
GIT_
E
PASSTHROUGH
)
if
(
error
&&
error
!=
GIT_PASSTHROUGH
)
return
error
;
return
error
;
*
out
=
git_cache_try_store
(
&
db
->
cache
,
new_odb_object
(
id
,
&
raw
));
*
out
=
git_cache_try_store
(
&
db
->
cache
,
new_odb_object
(
id
,
&
raw
));
...
@@ -556,7 +556,7 @@ int git_odb_read_prefix(
...
@@ -556,7 +556,7 @@ int git_odb_read_prefix(
git_odb_object
**
out
,
git_odb
*
db
,
const
git_oid
*
short_id
,
unsigned
int
len
)
git_odb_object
**
out
,
git_odb
*
db
,
const
git_oid
*
short_id
,
unsigned
int
len
)
{
{
unsigned
int
i
;
unsigned
int
i
;
int
error
=
GIT_
E
NOTFOUND
;
int
error
=
GIT_NOTFOUND
;
git_oid
found_full_oid
=
{{
0
}};
git_oid
found_full_oid
=
{{
0
}};
git_rawobj
raw
;
git_rawobj
raw
;
bool
found
=
false
;
bool
found
=
false
;
...
@@ -582,7 +582,7 @@ int git_odb_read_prefix(
...
@@ -582,7 +582,7 @@ int git_odb_read_prefix(
if
(
b
->
read
!=
NULL
)
{
if
(
b
->
read
!=
NULL
)
{
git_oid
full_oid
;
git_oid
full_oid
;
error
=
b
->
read_prefix
(
&
full_oid
,
&
raw
.
data
,
&
raw
.
len
,
&
raw
.
type
,
b
,
short_id
,
len
);
error
=
b
->
read_prefix
(
&
full_oid
,
&
raw
.
data
,
&
raw
.
len
,
&
raw
.
type
,
b
,
short_id
,
len
);
if
(
error
==
GIT_
ENOTFOUND
||
error
==
GIT_E
PASSTHROUGH
)
if
(
error
==
GIT_
NOTFOUND
||
error
==
GIT_
PASSTHROUGH
)
continue
;
continue
;
if
(
error
)
if
(
error
)
...
@@ -623,7 +623,7 @@ int git_odb_write(
...
@@ -623,7 +623,7 @@ int git_odb_write(
error
=
b
->
write
(
oid
,
b
,
data
,
len
,
type
);
error
=
b
->
write
(
oid
,
b
,
data
,
len
,
type
);
}
}
if
(
!
error
||
error
==
GIT_
E
PASSTHROUGH
)
if
(
!
error
||
error
==
GIT_PASSTHROUGH
)
return
0
;
return
0
;
/* if no backends were able to write the object directly, we try a streaming
/* if no backends were able to write the object directly, we try a streaming
...
@@ -662,7 +662,7 @@ int git_odb_open_wstream(
...
@@ -662,7 +662,7 @@ int git_odb_open_wstream(
error
=
init_fake_wstream
(
stream
,
b
,
size
,
type
);
error
=
init_fake_wstream
(
stream
,
b
,
size
,
type
);
}
}
if
(
error
==
GIT_
E
PASSTHROUGH
)
if
(
error
==
GIT_PASSTHROUGH
)
error
=
0
;
error
=
0
;
return
error
;
return
error
;
...
@@ -683,7 +683,7 @@ int git_odb_open_rstream(git_odb_stream **stream, git_odb *db, const git_oid *oi
...
@@ -683,7 +683,7 @@ int git_odb_open_rstream(git_odb_stream **stream, git_odb *db, const git_oid *oi
error
=
b
->
readstream
(
stream
,
b
,
oid
);
error
=
b
->
readstream
(
stream
,
b
,
oid
);
}
}
if
(
error
==
GIT_
E
PASSTHROUGH
)
if
(
error
==
GIT_PASSTHROUGH
)
error
=
0
;
error
=
0
;
return
error
;
return
error
;
...
@@ -698,12 +698,12 @@ int git_odb__error_notfound(const char *message, const git_oid *oid)
...
@@ -698,12 +698,12 @@ int git_odb__error_notfound(const char *message, const git_oid *oid)
}
else
}
else
giterr_set
(
GITERR_ODB
,
"Object not found - %s"
,
message
);
giterr_set
(
GITERR_ODB
,
"Object not found - %s"
,
message
);
return
GIT_
E
NOTFOUND
;
return
GIT_NOTFOUND
;
}
}
int
git_odb__error_ambiguous
(
const
char
*
message
)
int
git_odb__error_ambiguous
(
const
char
*
message
)
{
{
giterr_set
(
GITERR_ODB
,
"Ambiguous SHA1 prefix - %s"
,
message
);
giterr_set
(
GITERR_ODB
,
"Ambiguous SHA1 prefix - %s"
,
message
);
return
GIT_
E
AMBIGUOUS
;
return
GIT_AMBIGUOUS
;
}
}
src/odb.h
View file @
e172cf08
...
@@ -68,12 +68,12 @@ int git_odb__hashfd(git_oid *out, git_file fd, size_t size, git_otype type);
...
@@ -68,12 +68,12 @@ int git_odb__hashfd(git_oid *out, git_file fd, size_t size, git_otype type);
int
git_odb__hashlink
(
git_oid
*
out
,
const
char
*
path
);
int
git_odb__hashlink
(
git_oid
*
out
,
const
char
*
path
);
/*
/*
* Generate a GIT_
E
NOTFOUND error for the ODB.
* Generate a GIT_NOTFOUND error for the ODB.
*/
*/
int
git_odb__error_notfound
(
const
char
*
message
,
const
git_oid
*
oid
);
int
git_odb__error_notfound
(
const
char
*
message
,
const
git_oid
*
oid
);
/*
/*
* Generate a GIT_
E
AMBIGUOUS error for the ODB.
* Generate a GIT_AMBIGUOUS error for the ODB.
*/
*/
int
git_odb__error_ambiguous
(
const
char
*
message
);
int
git_odb__error_ambiguous
(
const
char
*
message
);
...
...
src/odb_loose.c
View file @
e172cf08
...
@@ -460,7 +460,7 @@ static int locate_object(
...
@@ -460,7 +460,7 @@ static int locate_object(
int
error
=
object_file_name
(
object_location
,
backend
->
objects_dir
,
oid
);
int
error
=
object_file_name
(
object_location
,
backend
->
objects_dir
,
oid
);
if
(
!
error
&&
!
git_path_exists
(
object_location
->
ptr
))
if
(
!
error
&&
!
git_path_exists
(
object_location
->
ptr
))
return
GIT_
E
NOTFOUND
;
return
GIT_NOTFOUND
;
return
error
;
return
error
;
}
}
...
...
src/odb_pack.c
View file @
e172cf08
...
@@ -141,7 +141,7 @@ static int pack_entry_find(struct git_pack_entry *e,
...
@@ -141,7 +141,7 @@ static int pack_entry_find(struct git_pack_entry *e,
/* Can find the offset of an object given
/* Can find the offset of an object given
* a prefix of an identifier.
* a prefix of an identifier.
* Sets GIT_
E
AMBIGUOUS if short oid is ambiguous.
* Sets GIT_AMBIGUOUS if short oid is ambiguous.
* This method assumes that len is between
* This method assumes that len is between
* GIT_OID_MINPREFIXLEN and GIT_OID_HEXSZ.
* GIT_OID_MINPREFIXLEN and GIT_OID_HEXSZ.
*/
*/
...
@@ -224,7 +224,7 @@ static int packfile_load__cb(void *_data, git_buf *path)
...
@@ -224,7 +224,7 @@ static int packfile_load__cb(void *_data, git_buf *path)
}
}
error
=
git_packfile_check
(
&
pack
,
path
->
ptr
);
error
=
git_packfile_check
(
&
pack
,
path
->
ptr
);
if
(
error
==
GIT_
E
NOTFOUND
)
if
(
error
==
GIT_NOTFOUND
)
/* ignore missing .pack file as git does */
/* ignore missing .pack file as git does */
return
0
;
return
0
;
else
if
(
error
<
0
)
else
if
(
error
<
0
)
...
@@ -306,7 +306,7 @@ static int pack_entry_find_prefix(
...
@@ -306,7 +306,7 @@ static int pack_entry_find_prefix(
if
(
backend
->
last_found
)
{
if
(
backend
->
last_found
)
{
error
=
git_pack_entry_find
(
e
,
backend
->
last_found
,
short_oid
,
len
);
error
=
git_pack_entry_find
(
e
,
backend
->
last_found
,
short_oid
,
len
);
if
(
error
==
GIT_
E
AMBIGUOUS
)
if
(
error
==
GIT_AMBIGUOUS
)
return
error
;
return
error
;
if
(
!
error
)
if
(
!
error
)
found
=
1
;
found
=
1
;
...
@@ -320,7 +320,7 @@ static int pack_entry_find_prefix(
...
@@ -320,7 +320,7 @@ static int pack_entry_find_prefix(
continue
;
continue
;
error
=
git_pack_entry_find
(
e
,
p
,
short_oid
,
len
);
error
=
git_pack_entry_find
(
e
,
p
,
short_oid
,
len
);
if
(
error
==
GIT_
E
AMBIGUOUS
)
if
(
error
==
GIT_AMBIGUOUS
)
return
error
;
return
error
;
if
(
!
error
)
{
if
(
!
error
)
{
if
(
++
found
>
1
)
if
(
++
found
>
1
)
...
@@ -354,7 +354,7 @@ int pack_backend__read_header(git_rawobj *obj, git_odb_backend *backend, const g
...
@@ -354,7 +354,7 @@ int pack_backend__read_header(git_rawobj *obj, git_odb_backend *backend, const g
assert(obj && backend && oid);
assert(obj && backend && oid);
if (locate_packfile(&location, (struct pack_backend *)backend, oid) < 0)
if (locate_packfile(&location, (struct pack_backend *)backend, oid) < 0)
return GIT_
E
NOTFOUND;
return GIT_NOTFOUND;
return read_header_packed(obj, &location);
return read_header_packed(obj, &location);
}
}
...
...
src/pack.c
View file @
e172cf08
...
@@ -28,7 +28,7 @@ int packfile_unpack_compressed(
...
@@ -28,7 +28,7 @@ int packfile_unpack_compressed(
/* Can find the offset of an object given
/* Can find the offset of an object given
* a prefix of an identifier.
* a prefix of an identifier.
* Throws GIT_
E
AMBIGUOUSOIDPREFIX if short oid
* Throws GIT_AMBIGUOUSOIDPREFIX if short oid
* is ambiguous within the pack.
* is ambiguous within the pack.
* This method assumes that len is between
* This method assumes that len is between
* GIT_OID_MINPREFIXLEN and GIT_OID_HEXSZ.
* GIT_OID_MINPREFIXLEN and GIT_OID_HEXSZ.
...
@@ -222,7 +222,7 @@ static int packfile_unpack_header1(
...
@@ -222,7 +222,7 @@ static int packfile_unpack_header1(
shift
=
4
;
shift
=
4
;
while
(
c
&
0x80
)
{
while
(
c
&
0x80
)
{
if
(
len
<=
used
)
if
(
len
<=
used
)
return
GIT_
E
SHORTBUFFER
;
return
GIT_SHORTBUFFER
;
if
(
bitsizeof
(
long
)
<=
shift
)
{
if
(
bitsizeof
(
long
)
<=
shift
)
{
*
usedp
=
0
;
*
usedp
=
0
;
...
@@ -260,11 +260,11 @@ int git_packfile_unpack_header(
...
@@ -260,11 +260,11 @@ int git_packfile_unpack_header(
// base = pack_window_open(p, w_curs, *curpos, &left);
// base = pack_window_open(p, w_curs, *curpos, &left);
base
=
git_mwindow_open
(
mwf
,
w_curs
,
*
curpos
,
20
,
&
left
);
base
=
git_mwindow_open
(
mwf
,
w_curs
,
*
curpos
,
20
,
&
left
);
if
(
base
==
NULL
)
if
(
base
==
NULL
)
return
GIT_
E
SHORTBUFFER
;
return
GIT_SHORTBUFFER
;
ret
=
packfile_unpack_header1
(
&
used
,
size_p
,
type_p
,
base
,
left
);
ret
=
packfile_unpack_header1
(
&
used
,
size_p
,
type_p
,
base
,
left
);
git_mwindow_close
(
w_curs
);
git_mwindow_close
(
w_curs
);
if
(
ret
==
GIT_
E
SHORTBUFFER
)
if
(
ret
==
GIT_SHORTBUFFER
)
return
ret
;
return
ret
;
else
if
(
ret
<
0
)
else
if
(
ret
<
0
)
return
packfile_error
(
"header length is zero"
);
return
packfile_error
(
"header length is zero"
);
...
@@ -428,7 +428,7 @@ int packfile_unpack_compressed(
...
@@ -428,7 +428,7 @@ int packfile_unpack_compressed(
if
(
st
==
Z_BUF_ERROR
&&
in
==
NULL
)
{
if
(
st
==
Z_BUF_ERROR
&&
in
==
NULL
)
{
inflateEnd
(
&
stream
);
inflateEnd
(
&
stream
);
git__free
(
buffer
);
git__free
(
buffer
);
return
GIT_
E
SHORTBUFFER
;
return
GIT_SHORTBUFFER
;
}
}
*
curpos
+=
stream
.
next_in
-
in
;
*
curpos
+=
stream
.
next_in
-
in
;
...
@@ -467,7 +467,7 @@ git_off_t get_delta_base(
...
@@ -467,7 +467,7 @@ git_off_t get_delta_base(
base_info
=
pack_window_open
(
p
,
w_curs
,
*
curpos
,
&
left
);
base_info
=
pack_window_open
(
p
,
w_curs
,
*
curpos
,
&
left
);
/* Assumption: the only reason this would fail is because the file is too small */
/* Assumption: the only reason this would fail is because the file is too small */
if
(
base_info
==
NULL
)
if
(
base_info
==
NULL
)
return
GIT_
E
SHORTBUFFER
;
return
GIT_SHORTBUFFER
;
/* pack_window_open() assured us we have [base_info, base_info + 20)
/* pack_window_open() assured us we have [base_info, base_info + 20)
* as a range that we can look at without walking off the
* as a range that we can look at without walking off the
* end of the mapped window. Its actually the hash size
* end of the mapped window. Its actually the hash size
...
@@ -480,7 +480,7 @@ git_off_t get_delta_base(
...
@@ -480,7 +480,7 @@ git_off_t get_delta_base(
base_offset
=
c
&
127
;
base_offset
=
c
&
127
;
while
(
c
&
128
)
{
while
(
c
&
128
)
{
if
(
left
<=
used
)
if
(
left
<=
used
)
return
GIT_
E
SHORTBUFFER
;
return
GIT_SHORTBUFFER
;
base_offset
+=
1
;
base_offset
+=
1
;
if
(
!
base_offset
||
MSB
(
base_offset
,
7
))
if
(
!
base_offset
||
MSB
(
base_offset
,
7
))
return
0
;
/* overflow */
return
0
;
/* overflow */
...
...
src/path.c
View file @
e172cf08
...
@@ -206,7 +206,7 @@ int git_path_prettify(git_buf *path_out, const char *path, const char *base)
...
@@ -206,7 +206,7 @@ int git_path_prettify(git_buf *path_out, const char *path, const char *base)
if
(
p_realpath
(
path
,
buf
)
==
NULL
)
{
if
(
p_realpath
(
path
,
buf
)
==
NULL
)
{
/* giterr_set resets the errno when dealing with a GITERR_OS kind of error */
/* giterr_set resets the errno when dealing with a GITERR_OS kind of error */
int
error
=
(
errno
==
ENOENT
||
errno
==
ENOTDIR
)
?
GIT_
E
NOTFOUND
:
-
1
;
int
error
=
(
errno
==
ENOENT
||
errno
==
ENOTDIR
)
?
GIT_NOTFOUND
:
-
1
;
giterr_set
(
GITERR_OS
,
"Failed to resolve path '%s'"
,
path
);
giterr_set
(
GITERR_OS
,
"Failed to resolve path '%s'"
,
path
);
git_buf_clear
(
path_out
);
git_buf_clear
(
path_out
);
...
@@ -390,7 +390,7 @@ int git_path_lstat(const char *path, struct stat *st)
...
@@ -390,7 +390,7 @@ int git_path_lstat(const char *path, struct stat *st)
int
err
=
0
;
int
err
=
0
;
if
(
p_lstat
(
path
,
st
)
<
0
)
{
if
(
p_lstat
(
path
,
st
)
<
0
)
{
err
=
(
errno
==
ENOENT
)
?
GIT_
E
NOTFOUND
:
-
1
;
err
=
(
errno
==
ENOENT
)
?
GIT_NOTFOUND
:
-
1
;
giterr_set
(
GITERR_OS
,
"Failed to stat file '%s'"
,
path
);
giterr_set
(
GITERR_OS
,
"Failed to stat file '%s'"
,
path
);
}
}
...
...
src/pkt.c
View file @
e172cf08
...
@@ -208,7 +208,7 @@ int git_pkt_parse_line(
...
@@ -208,7 +208,7 @@ int git_pkt_parse_line(
/* Not even enough for the length */
/* Not even enough for the length */
if
(
bufflen
>
0
&&
bufflen
<
PKT_LEN_SIZE
)
if
(
bufflen
>
0
&&
bufflen
<
PKT_LEN_SIZE
)
return
GIT_
E
SHORTBUFFER
;
return
GIT_SHORTBUFFER
;
len
=
parse_len
(
line
);
len
=
parse_len
(
line
);
if
(
len
<
0
)
{
if
(
len
<
0
)
{
...
@@ -230,7 +230,7 @@ int git_pkt_parse_line(
...
@@ -230,7 +230,7 @@ int git_pkt_parse_line(
* enough in the buffer to satisfy this line
* enough in the buffer to satisfy this line
*/
*/
if
(
bufflen
>
0
&&
bufflen
<
(
size_t
)
len
)
if
(
bufflen
>
0
&&
bufflen
<
(
size_t
)
len
)
return
GIT_
E
SHORTBUFFER
;
return
GIT_SHORTBUFFER
;
line
+=
PKT_LEN_SIZE
;
line
+=
PKT_LEN_SIZE
;
/*
/*
...
...
src/protocol.c
View file @
e172cf08
...
@@ -34,7 +34,7 @@ int git_protocol_store_refs(git_protocol *p, const char *data, size_t len)
...
@@ -34,7 +34,7 @@ int git_protocol_store_refs(git_protocol *p, const char *data, size_t len)
return
0
;
return
0
;
error
=
git_pkt_parse_line
(
&
pkt
,
ptr
,
&
line_end
,
git_buf_len
(
buf
));
error
=
git_pkt_parse_line
(
&
pkt
,
ptr
,
&
line_end
,
git_buf_len
(
buf
));
if
(
error
==
GIT_
E
SHORTBUFFER
)
if
(
error
==
GIT_SHORTBUFFER
)
return
0
;
/* Ask for more */
return
0
;
/* Ask for more */
if
(
error
<
0
)
if
(
error
<
0
)
return
p
->
error
=
-
1
;
return
p
->
error
=
-
1
;
...
...
src/refs.c
View file @
e172cf08
...
@@ -437,7 +437,7 @@ static int packed_load(git_repository *repo)
...
@@ -437,7 +437,7 @@ static int packed_load(git_repository *repo)
* for us here, so just return. Anything else means we need to
* for us here, so just return. Anything else means we need to
* refresh the packed refs.
* refresh the packed refs.
*/
*/
if
(
result
==
GIT_
E
NOTFOUND
)
{
if
(
result
==
GIT_NOTFOUND
)
{
git_strmap_clear
(
ref_cache
->
packfile
);
git_strmap_clear
(
ref_cache
->
packfile
);
return
0
;
return
0
;
}
}
...
@@ -917,7 +917,7 @@ static int reference_can_write(
...
@@ -917,7 +917,7 @@ static int reference_can_write(
if
(
exists
)
{
if
(
exists
)
{
giterr_set
(
GITERR_REFERENCE
,
giterr_set
(
GITERR_REFERENCE
,
"A reference with that name (%s) already exists"
,
refname
);
"A reference with that name (%s) already exists"
,
refname
);
return
GIT_E
E
XISTS
;
return
GIT_EXISTS
;
}
}
}
}
...
@@ -962,7 +962,7 @@ static int packed_lookup(git_reference *ref)
...
@@ -962,7 +962,7 @@ static int packed_lookup(git_reference *ref)
pos
=
git_strmap_lookup_index
(
packfile_refs
,
ref
->
name
);
pos
=
git_strmap_lookup_index
(
packfile_refs
,
ref
->
name
);
if
(
!
git_strmap_valid_index
(
packfile_refs
,
pos
))
{
if
(
!
git_strmap_valid_index
(
packfile_refs
,
pos
))
{
giterr_set
(
GITERR_REFERENCE
,
"Reference '%s' not found"
,
ref
->
name
);
giterr_set
(
GITERR_REFERENCE
,
"Reference '%s' not found"
,
ref
->
name
);
return
GIT_
E
NOTFOUND
;
return
GIT_NOTFOUND
;
}
}
pack_ref
=
git_strmap_value_at
(
packfile_refs
,
pos
);
pack_ref
=
git_strmap_value_at
(
packfile_refs
,
pos
);
...
@@ -984,7 +984,7 @@ static int reference_lookup(git_reference *ref)
...
@@ -984,7 +984,7 @@ static int reference_lookup(git_reference *ref)
/* only try to lookup this reference on the packfile if it
/* only try to lookup this reference on the packfile if it
* wasn't found on the loose refs; not if there was a critical error */
* wasn't found on the loose refs; not if there was a critical error */
if
(
result
==
GIT_
E
NOTFOUND
)
{
if
(
result
==
GIT_NOTFOUND
)
{
giterr_clear
();
giterr_clear
();
result
=
packed_lookup
(
ref
);
result
=
packed_lookup
(
ref
);
if
(
result
==
0
)
if
(
result
==
0
)
...
...
src/refspec.c
View file @
e172cf08
...
@@ -68,7 +68,7 @@ int git_refspec_transform(char *out, size_t outlen, const git_refspec *spec, con
...
@@ -68,7 +68,7 @@ int git_refspec_transform(char *out, size_t outlen, const git_refspec *spec, con
baselen
=
strlen
(
spec
->
dst
);
baselen
=
strlen
(
spec
->
dst
);
if
(
outlen
<=
baselen
)
{
if
(
outlen
<=
baselen
)
{
giterr_set
(
GITERR_INVALID
,
"Reference name too long"
);
giterr_set
(
GITERR_INVALID
,
"Reference name too long"
);
return
GIT_
E
SHORTBUFFER
;
return
GIT_SHORTBUFFER
;
}
}
/*
/*
...
@@ -90,7 +90,7 @@ int git_refspec_transform(char *out, size_t outlen, const git_refspec *spec, con
...
@@ -90,7 +90,7 @@ int git_refspec_transform(char *out, size_t outlen, const git_refspec *spec, con
if
(
outlen
<=
baselen
+
namelen
)
{
if
(
outlen
<=
baselen
+
namelen
)
{
giterr_set
(
GITERR_INVALID
,
"Reference name too long"
);
giterr_set
(
GITERR_INVALID
,
"Reference name too long"
);
return
GIT_
E
SHORTBUFFER
;
return
GIT_SHORTBUFFER
;
}
}
memcpy
(
out
,
spec
->
dst
,
baselen
);
memcpy
(
out
,
spec
->
dst
,
baselen
);
...
...
src/refspec.h
View file @
e172cf08
...
@@ -28,7 +28,7 @@ int git_refspec_parse(struct git_refspec *refspec, const char *str);
...
@@ -28,7 +28,7 @@ int git_refspec_parse(struct git_refspec *refspec, const char *str);
* @param out where to store the target name
* @param out where to store the target name
* @param spec the refspec
* @param spec the refspec
* @param name the name of the reference to transform
* @param name the name of the reference to transform
* @return
GIT_SUCCESS
or error if buffer allocation fails
* @return
0
or error if buffer allocation fails
*/
*/
int
git_refspec_transform_r
(
git_buf
*
out
,
const
git_refspec
*
spec
,
const
char
*
name
);
int
git_refspec_transform_r
(
git_buf
*
out
,
const
git_refspec
*
spec
,
const
char
*
name
);
...
...
src/remote.c
View file @
e172cf08
...
@@ -135,7 +135,7 @@ int git_remote_load(git_remote **out, git_repository *repo, const char *name)
...
@@ -135,7 +135,7 @@ int git_remote_load(git_remote **out, git_repository *repo, const char *name)
}
}
error
=
parse_remote_refspec
(
config
,
&
remote
->
fetch
,
git_buf_cstr
(
&
buf
));
error
=
parse_remote_refspec
(
config
,
&
remote
->
fetch
,
git_buf_cstr
(
&
buf
));
if
(
error
==
GIT_
E
NOTFOUND
)
if
(
error
==
GIT_NOTFOUND
)
error
=
0
;
error
=
0
;
if
(
error
<
0
)
{
if
(
error
<
0
)
{
...
@@ -150,7 +150,7 @@ int git_remote_load(git_remote **out, git_repository *repo, const char *name)
...
@@ -150,7 +150,7 @@ int git_remote_load(git_remote **out, git_repository *repo, const char *name)
}
}
error
=
parse_remote_refspec
(
config
,
&
remote
->
push
,
git_buf_cstr
(
&
buf
));
error
=
parse_remote_refspec
(
config
,
&
remote
->
push
,
git_buf_cstr
(
&
buf
));
if
(
error
==
GIT_
E
NOTFOUND
)
if
(
error
==
GIT_NOTFOUND
)
error
=
0
;
error
=
0
;
if
(
error
<
0
)
{
if
(
error
<
0
)
{
...
@@ -338,7 +338,7 @@ int git_remote_update_tips(git_remote *remote, int (*cb)(const char *refname, co
...
@@ -338,7 +338,7 @@ int git_remote_update_tips(git_remote *remote, int (*cb)(const char *refname, co
assert
(
remote
);
assert
(
remote
);
if
(
refs
->
length
==
0
)
if
(
refs
->
length
==
0
)
return
GIT_SUCCESS
;
return
0
;
/* HEAD is only allowed to be the first in the list */
/* HEAD is only allowed to be the first in the list */
head
=
refs
->
contents
[
0
];
head
=
refs
->
contents
[
0
];
...
@@ -357,10 +357,10 @@ int git_remote_update_tips(git_remote *remote, int (*cb)(const char *refname, co
...
@@ -357,10 +357,10 @@ int git_remote_update_tips(git_remote *remote, int (*cb)(const char *refname, co
goto
on_error
;
goto
on_error
;
error
=
git_reference_name_to_oid
(
&
old
,
remote
->
repo
,
refname
.
ptr
);
error
=
git_reference_name_to_oid
(
&
old
,
remote
->
repo
,
refname
.
ptr
);
if
(
error
<
0
&&
error
!=
GIT_
E
NOTFOUND
)
if
(
error
<
0
&&
error
!=
GIT_NOTFOUND
)
goto
on_error
;
goto
on_error
;
if
(
error
==
GIT_
E
NOTFOUND
)
if
(
error
==
GIT_NOTFOUND
)
memset
(
&
old
,
0
,
GIT_OID_RAWSZ
);
memset
(
&
old
,
0
,
GIT_OID_RAWSZ
);
if
(
!
git_oid_cmp
(
&
old
,
&
head
->
oid
))
if
(
!
git_oid_cmp
(
&
old
,
&
head
->
oid
))
...
...
src/repository.c
View file @
e172cf08
...
@@ -148,7 +148,7 @@ static int load_workdir(git_repository *repo, git_buf *parent_path)
...
@@ -148,7 +148,7 @@ static int load_workdir(git_repository *repo, git_buf *parent_path)
error
=
git_config_get_string
(
&
worktree
,
config
,
"core.worktree"
);
error
=
git_config_get_string
(
&
worktree
,
config
,
"core.worktree"
);
if
(
!
error
&&
worktree
!=
NULL
)
if
(
!
error
&&
worktree
!=
NULL
)
repo
->
workdir
=
git__strdup
(
worktree
);
repo
->
workdir
=
git__strdup
(
worktree
);
else
if
(
error
!=
GIT_
E
NOTFOUND
)
else
if
(
error
!=
GIT_NOTFOUND
)
return
error
;
return
error
;
else
{
else
{
giterr_clear
();
giterr_clear
();
...
@@ -342,7 +342,7 @@ static int find_repo(
...
@@ -342,7 +342,7 @@ static int find_repo(
if
(
!
git_buf_len
(
repo_path
)
&&
!
error
)
{
if
(
!
git_buf_len
(
repo_path
)
&&
!
error
)
{
giterr_set
(
GITERR_REPOSITORY
,
giterr_set
(
GITERR_REPOSITORY
,
"Could not find repository from '%s'"
,
start_path
);
"Could not find repository from '%s'"
,
start_path
);
error
=
GIT_
E
NOTFOUND
;
error
=
GIT_NOTFOUND
;
}
}
return
error
;
return
error
;
...
@@ -403,7 +403,7 @@ int git_repository_discover(
...
@@ -403,7 +403,7 @@ int git_repository_discover(
*
repository_path
=
'\0'
;
*
repository_path
=
'\0'
;
if
((
error
=
find_repo
(
&
path
,
NULL
,
start_path
,
flags
,
ceiling_dirs
))
<
0
)
if
((
error
=
find_repo
(
&
path
,
NULL
,
start_path
,
flags
,
ceiling_dirs
))
<
0
)
return
error
!=
GIT_
E
NOTFOUND
?
-
1
:
error
;
return
error
!=
GIT_NOTFOUND
?
-
1
:
error
;
if
(
size
<
(
size_t
)(
path
.
size
+
1
))
{
if
(
size
<
(
size_t
)(
path
.
size
+
1
))
{
giterr_set
(
GITERR_REPOSITORY
,
giterr_set
(
GITERR_REPOSITORY
,
...
@@ -851,7 +851,7 @@ int git_repository_head_orphan(git_repository *repo)
...
@@ -851,7 +851,7 @@ int git_repository_head_orphan(git_repository *repo)
error
=
git_repository_head
(
&
ref
,
repo
);
error
=
git_repository_head
(
&
ref
,
repo
);
git_reference_free
(
ref
);
git_reference_free
(
ref
);
if
(
error
==
GIT_
E
NOTFOUND
)
if
(
error
==
GIT_NOTFOUND
)
return
1
;
return
1
;
if
(
error
<
0
)
if
(
error
<
0
)
...
@@ -883,7 +883,7 @@ int git_repository_is_empty(git_repository *repo)
...
@@ -883,7 +883,7 @@ int git_repository_is_empty(git_repository *repo)
git_reference_free
(
head
);
git_reference_free
(
head
);
git_reference_free
(
branch
);
git_reference_free
(
branch
);
if
(
error
==
GIT_
E
NOTFOUND
)
if
(
error
==
GIT_NOTFOUND
)
return
1
;
return
1
;
if
(
error
<
0
)
if
(
error
<
0
)
...
...
src/revwalk.c
View file @
e172cf08
...
@@ -316,7 +316,7 @@ static int merge_bases_many(commit_list **out, git_revwalk *walk, commit_object
...
@@ -316,7 +316,7 @@ static int merge_bases_many(commit_list **out, git_revwalk *walk, commit_object
if
((
p
->
flags
&
flags
)
==
flags
)
if
((
p
->
flags
&
flags
)
==
flags
)
continue
;
continue
;
if
((
error
=
commit_parse
(
walk
,
p
))
<
GIT_SUCCESS
)
if
((
error
=
commit_parse
(
walk
,
p
))
<
0
)
return
error
;
return
error
;
p
->
flags
|=
flags
;
p
->
flags
|=
flags
;
...
@@ -375,7 +375,7 @@ int git_merge_base(git_oid *out, git_repository *repo, git_oid *one, git_oid *tw
...
@@ -375,7 +375,7 @@ int git_merge_base(git_oid *out, git_repository *repo, git_oid *one, git_oid *tw
if
(
!
result
)
{
if
(
!
result
)
{
git_revwalk_free
(
walk
);
git_revwalk_free
(
walk
);
return
GIT_
E
NOTFOUND
;
return
GIT_NOTFOUND
;
}
}
git_oid_cpy
(
out
,
&
result
->
item
->
oid
);
git_oid_cpy
(
out
,
&
result
->
item
->
oid
);
...
@@ -600,7 +600,7 @@ static int revwalk_next_timesort(commit_object **object_out, git_revwalk *walk)
...
@@ -600,7 +600,7 @@ static int revwalk_next_timesort(commit_object **object_out, git_revwalk *walk)
}
}
}
}
return
GIT_
E
REVWALKOVER
;
return
GIT_REVWALKOVER
;
}
}
static
int
revwalk_next_unsorted
(
commit_object
**
object_out
,
git_revwalk
*
walk
)
static
int
revwalk_next_unsorted
(
commit_object
**
object_out
,
git_revwalk
*
walk
)
...
@@ -618,7 +618,7 @@ static int revwalk_next_unsorted(commit_object **object_out, git_revwalk *walk)
...
@@ -618,7 +618,7 @@ static int revwalk_next_unsorted(commit_object **object_out, git_revwalk *walk)
}
}
}
}
return
GIT_
E
REVWALKOVER
;
return
GIT_REVWALKOVER
;
}
}
static
int
revwalk_next_toposort
(
commit_object
**
object_out
,
git_revwalk
*
walk
)
static
int
revwalk_next_toposort
(
commit_object
**
object_out
,
git_revwalk
*
walk
)
...
@@ -629,7 +629,7 @@ static int revwalk_next_toposort(commit_object **object_out, git_revwalk *walk)
...
@@ -629,7 +629,7 @@ static int revwalk_next_toposort(commit_object **object_out, git_revwalk *walk)
for
(;;)
{
for
(;;)
{
next
=
commit_list_pop
(
&
walk
->
iterator_topo
);
next
=
commit_list_pop
(
&
walk
->
iterator_topo
);
if
(
next
==
NULL
)
if
(
next
==
NULL
)
return
GIT_
E
REVWALKOVER
;
return
GIT_REVWALKOVER
;
if
(
next
->
in_degree
>
0
)
{
if
(
next
->
in_degree
>
0
)
{
next
->
topo_delay
=
1
;
next
->
topo_delay
=
1
;
...
@@ -654,7 +654,7 @@ static int revwalk_next_toposort(commit_object **object_out, git_revwalk *walk)
...
@@ -654,7 +654,7 @@ static int revwalk_next_toposort(commit_object **object_out, git_revwalk *walk)
static
int
revwalk_next_reverse
(
commit_object
**
object_out
,
git_revwalk
*
walk
)
static
int
revwalk_next_reverse
(
commit_object
**
object_out
,
git_revwalk
*
walk
)
{
{
*
object_out
=
commit_list_pop
(
&
walk
->
iterator_reverse
);
*
object_out
=
commit_list_pop
(
&
walk
->
iterator_reverse
);
return
*
object_out
?
0
:
GIT_
E
REVWALKOVER
;
return
*
object_out
?
0
:
GIT_REVWALKOVER
;
}
}
...
@@ -670,7 +670,7 @@ static int prepare_walk(git_revwalk *walk)
...
@@ -670,7 +670,7 @@ static int prepare_walk(git_revwalk *walk)
* so we know that the walk is already over.
* so we know that the walk is already over.
*/
*/
if
(
walk
->
one
==
NULL
)
if
(
walk
->
one
==
NULL
)
return
GIT_
E
REVWALKOVER
;
return
GIT_REVWALKOVER
;
/* first figure out what the merge bases are */
/* first figure out what the merge bases are */
if
(
merge_bases_many
(
&
bases
,
walk
,
walk
->
one
,
&
walk
->
twos
)
<
0
)
if
(
merge_bases_many
(
&
bases
,
walk
,
walk
->
one
,
&
walk
->
twos
)
<
0
)
...
@@ -698,7 +698,7 @@ static int prepare_walk(git_revwalk *walk)
...
@@ -698,7 +698,7 @@ static int prepare_walk(git_revwalk *walk)
return
-
1
;
return
-
1
;
}
}
if
(
error
!=
GIT_
E
REVWALKOVER
)
if
(
error
!=
GIT_REVWALKOVER
)
return
error
;
return
error
;
walk
->
get_next
=
&
revwalk_next_toposort
;
walk
->
get_next
=
&
revwalk_next_toposort
;
...
@@ -710,7 +710,7 @@ static int prepare_walk(git_revwalk *walk)
...
@@ -710,7 +710,7 @@ static int prepare_walk(git_revwalk *walk)
if
(
commit_list_insert
(
next
,
&
walk
->
iterator_reverse
)
==
NULL
)
if
(
commit_list_insert
(
next
,
&
walk
->
iterator_reverse
)
==
NULL
)
return
-
1
;
return
-
1
;
if
(
error
!=
GIT_
E
REVWALKOVER
)
if
(
error
!=
GIT_REVWALKOVER
)
return
error
;
return
error
;
walk
->
get_next
=
&
revwalk_next_reverse
;
walk
->
get_next
=
&
revwalk_next_reverse
;
...
@@ -809,9 +809,9 @@ int git_revwalk_next(git_oid *oid, git_revwalk *walk)
...
@@ -809,9 +809,9 @@ int git_revwalk_next(git_oid *oid, git_revwalk *walk)
error
=
walk
->
get_next
(
&
next
,
walk
);
error
=
walk
->
get_next
(
&
next
,
walk
);
if
(
error
==
GIT_
E
REVWALKOVER
)
{
if
(
error
==
GIT_REVWALKOVER
)
{
git_revwalk_reset
(
walk
);
git_revwalk_reset
(
walk
);
return
GIT_
E
REVWALKOVER
;
return
GIT_REVWALKOVER
;
}
}
if
(
!
error
)
if
(
!
error
)
...
...
src/signature.c
View file @
e172cf08
...
@@ -167,7 +167,7 @@ static int parse_timezone_offset(const char *buffer, int *offset_out)
...
@@ -167,7 +167,7 @@ static int parse_timezone_offset(const char *buffer, int *offset_out)
if
(
*
offset_start
==
'\n'
)
{
if
(
*
offset_start
==
'\n'
)
{
*
offset_out
=
0
;
*
offset_out
=
0
;
return
GIT_SUCCESS
;
return
0
;
}
}
if
(
offset_start
[
0
]
!=
'-'
&&
offset_start
[
0
]
!=
'+'
)
if
(
offset_start
[
0
]
!=
'-'
&&
offset_start
[
0
]
!=
'+'
)
...
@@ -176,7 +176,7 @@ static int parse_timezone_offset(const char *buffer, int *offset_out)
...
@@ -176,7 +176,7 @@ static int parse_timezone_offset(const char *buffer, int *offset_out)
if
(
offset_start
[
1
]
<
'0'
||
offset_start
[
1
]
>
'9'
)
if
(
offset_start
[
1
]
<
'0'
||
offset_start
[
1
]
>
'9'
)
return
timezone_error
(
"expected initial digit"
);
return
timezone_error
(
"expected initial digit"
);
if
(
git__strtol32
(
&
dec_offset
,
offset_start
+
1
,
&
offset_end
,
10
)
<
GIT_SUCCESS
)
if
(
git__strtol32
(
&
dec_offset
,
offset_start
+
1
,
&
offset_end
,
10
)
<
0
)
return
timezone_error
(
"not a valid number"
);
return
timezone_error
(
"not a valid number"
);
if
(
offset_end
-
offset_start
!=
5
)
if
(
offset_end
-
offset_start
!=
5
)
...
...
src/status.c
View file @
e172cf08
...
@@ -214,7 +214,7 @@ int git_status_file(
...
@@ -214,7 +214,7 @@ int git_status_file(
if
(
!
error
&&
!
sfi
.
count
)
{
if
(
!
error
&&
!
sfi
.
count
)
{
giterr_set
(
GITERR_INVALID
,
giterr_set
(
GITERR_INVALID
,
"Attempt to get status of nonexistent file '%s'"
,
path
);
"Attempt to get status of nonexistent file '%s'"
,
path
);
error
=
GIT_
E
NOTFOUND
;
error
=
GIT_NOTFOUND
;
}
}
*
status_flags
=
sfi
.
status
;
*
status_flags
=
sfi
.
status
;
...
...
src/submodule.c
View file @
e172cf08
...
@@ -351,7 +351,7 @@ int git_submodule_foreach(
...
@@ -351,7 +351,7 @@ int git_submodule_foreach(
git_strmap_foreach_value
(
repo
->
submodules
,
sm
,
{
git_strmap_foreach_value
(
repo
->
submodules
,
sm
,
{
/* usually the following will not come into play */
/* usually the following will not come into play */
if
(
sm
->
refcount
>
1
)
{
if
(
sm
->
refcount
>
1
)
{
if
(
git_vector_bsearch
(
&
seen
,
sm
)
!=
GIT_
E
NOTFOUND
)
if
(
git_vector_bsearch
(
&
seen
,
sm
)
!=
GIT_NOTFOUND
)
continue
;
continue
;
if
((
error
=
git_vector_insert
(
&
seen
,
sm
))
<
0
)
if
((
error
=
git_vector_insert
(
&
seen
,
sm
))
<
0
)
break
;
break
;
...
@@ -378,7 +378,7 @@ int git_submodule_lookup(
...
@@ -378,7 +378,7 @@ int git_submodule_lookup(
pos
=
git_strmap_lookup_index
(
repo
->
submodules
,
name
);
pos
=
git_strmap_lookup_index
(
repo
->
submodules
,
name
);
if
(
!
git_strmap_valid_index
(
repo
->
submodules
,
pos
))
if
(
!
git_strmap_valid_index
(
repo
->
submodules
,
pos
))
return
GIT_
E
NOTFOUND
;
return
GIT_NOTFOUND
;
if
(
sm_ptr
)
if
(
sm_ptr
)
*
sm_ptr
=
git_strmap_value_at
(
repo
->
submodules
,
pos
);
*
sm_ptr
=
git_strmap_value_at
(
repo
->
submodules
,
pos
);
...
...
src/tag.c
View file @
e172cf08
...
@@ -168,7 +168,7 @@ static int retrieve_tag_reference(
...
@@ -168,7 +168,7 @@ static int retrieve_tag_reference(
return
-
1
;
return
-
1
;
error
=
git_reference_lookup
(
&
tag_ref
,
repo
,
ref_name_out
->
ptr
);
error
=
git_reference_lookup
(
&
tag_ref
,
repo
,
ref_name_out
->
ptr
);
if
(
error
<
GIT_SUCCESS
)
if
(
error
<
0
)
return
error
;
/* Be it not foundo or corrupted */
return
error
;
/* Be it not foundo or corrupted */
*
tag_reference_out
=
tag_ref
;
*
tag_reference_out
=
tag_ref
;
...
@@ -254,7 +254,7 @@ static int git_tag_create__internal(
...
@@ -254,7 +254,7 @@ static int git_tag_create__internal(
}
}
error
=
retrieve_tag_reference_oid
(
oid
,
&
ref_name
,
repo
,
tag_name
);
error
=
retrieve_tag_reference_oid
(
oid
,
&
ref_name
,
repo
,
tag_name
);
if
(
error
<
GIT_SUCCESS
&&
error
!=
GIT_E
NOTFOUND
)
if
(
error
<
0
&&
error
!=
GIT_
NOTFOUND
)
return
-
1
;
return
-
1
;
/** Ensure the tag name doesn't conflict with an already existing
/** Ensure the tag name doesn't conflict with an already existing
...
@@ -262,7 +262,7 @@ static int git_tag_create__internal(
...
@@ -262,7 +262,7 @@ static int git_tag_create__internal(
if
(
error
==
0
&&
!
allow_ref_overwrite
)
{
if
(
error
==
0
&&
!
allow_ref_overwrite
)
{
git_buf_free
(
&
ref_name
);
git_buf_free
(
&
ref_name
);
giterr_set
(
GITERR_TAG
,
"Tag already exists"
);
giterr_set
(
GITERR_TAG
,
"Tag already exists"
);
return
GIT_E
E
XISTS
;
return
GIT_EXISTS
;
}
}
if
(
create_tag_annotation
)
{
if
(
create_tag_annotation
)
{
...
@@ -332,7 +332,7 @@ int git_tag_create_frombuffer(git_oid *oid, git_repository *repo, const char *bu
...
@@ -332,7 +332,7 @@ int git_tag_create_frombuffer(git_oid *oid, git_repository *repo, const char *bu
}
}
error
=
retrieve_tag_reference_oid
(
oid
,
&
ref_name
,
repo
,
tag
.
tag_name
);
error
=
retrieve_tag_reference_oid
(
oid
,
&
ref_name
,
repo
,
tag
.
tag_name
);
if
(
error
<
GIT_SUCCESS
&&
error
!=
GIT_E
NOTFOUND
)
if
(
error
<
0
&&
error
!=
GIT_
NOTFOUND
)
goto
on_error
;
goto
on_error
;
/* We don't need these objects after this */
/* We don't need these objects after this */
...
@@ -345,7 +345,7 @@ int git_tag_create_frombuffer(git_oid *oid, git_repository *repo, const char *bu
...
@@ -345,7 +345,7 @@ int git_tag_create_frombuffer(git_oid *oid, git_repository *repo, const char *bu
* reference unless overwriting has explictly been requested **/
* reference unless overwriting has explictly been requested **/
if
(
error
==
0
&&
!
allow_ref_overwrite
)
{
if
(
error
==
0
&&
!
allow_ref_overwrite
)
{
giterr_set
(
GITERR_TAG
,
"Tag already exists"
);
giterr_set
(
GITERR_TAG
,
"Tag already exists"
);
return
GIT_E
E
XISTS
;
return
GIT_EXISTS
;
}
}
/* write the buffer */
/* write the buffer */
...
@@ -414,7 +414,7 @@ static int tag_list_cb(const char *tag_name, void *payload)
...
@@ -414,7 +414,7 @@ static int tag_list_cb(const char *tag_name, void *payload)
return
0
;
return
0
;
filter
=
(
tag_filter_data
*
)
payload
;
filter
=
(
tag_filter_data
*
)
payload
;
if
(
!*
filter
->
pattern
||
p_fnmatch
(
filter
->
pattern
,
tag_name
+
GIT_REFS_TAGS_DIR_LEN
,
0
)
==
GIT_SUCCESS
)
if
(
!*
filter
->
pattern
||
p_fnmatch
(
filter
->
pattern
,
tag_name
+
GIT_REFS_TAGS_DIR_LEN
,
0
)
==
0
)
return
git_vector_insert
(
filter
->
taglist
,
git__strdup
(
tag_name
));
return
git_vector_insert
(
filter
->
taglist
,
git__strdup
(
tag_name
));
return
0
;
return
0
;
...
@@ -428,7 +428,7 @@ int git_tag_list_match(git_strarray *tag_names, const char *pattern, git_reposit
...
@@ -428,7 +428,7 @@ int git_tag_list_match(git_strarray *tag_names, const char *pattern, git_reposit
assert
(
tag_names
&&
repo
&&
pattern
);
assert
(
tag_names
&&
repo
&&
pattern
);
if
(
git_vector_init
(
&
taglist
,
8
,
NULL
)
<
GIT_SUCCESS
)
if
(
git_vector_init
(
&
taglist
,
8
,
NULL
)
<
0
)
return
-
1
;
return
-
1
;
filter
.
taglist
=
&
taglist
;
filter
.
taglist
=
&
taglist
;
...
...
src/transport.c
View file @
e172cf08
...
@@ -37,7 +37,7 @@ static git_transport_cb transport_find_fn(const char *url)
...
@@ -37,7 +37,7 @@ static git_transport_cb transport_find_fn(const char *url)
}
}
/* still here? Check to see if the path points to a file on the local file system */
/* still here? Check to see if the path points to a file on the local file system */
if
((
git_path_exists
(
url
)
==
GIT_SUCCESS
)
&&
git_path_isdir
(
url
))
if
((
git_path_exists
(
url
)
==
0
)
&&
git_path_isdir
(
url
))
return
&
git_transport_local
;
return
&
git_transport_local
;
/* It could be a SSH remote path. Check to see if there's a : */
/* It could be a SSH remote path. Check to see if there's a : */
...
@@ -72,7 +72,7 @@ int git_transport_new(git_transport **out, const char *url)
...
@@ -72,7 +72,7 @@ int git_transport_new(git_transport **out, const char *url)
}
}
error
=
fn
(
&
transport
);
error
=
fn
(
&
transport
);
if
(
error
<
GIT_SUCCESS
)
if
(
error
<
0
)
return
error
;
return
error
;
transport
->
url
=
git__strdup
(
url
);
transport
->
url
=
git__strdup
(
url
);
...
@@ -80,7 +80,7 @@ int git_transport_new(git_transport **out, const char *url)
...
@@ -80,7 +80,7 @@ int git_transport_new(git_transport **out, const char *url)
*
out
=
transport
;
*
out
=
transport
;
return
GIT_SUCCESS
;
return
0
;
}
}
/* from remote.h */
/* from remote.h */
...
...
src/transports/git.c
View file @
e172cf08
...
@@ -147,7 +147,7 @@ static int store_refs(transport_git *t)
...
@@ -147,7 +147,7 @@ static int store_refs(transport_git *t)
return
0
;
return
0
;
ret
=
git_protocol_store_refs
(
&
t
->
proto
,
buf
->
data
,
buf
->
offset
);
ret
=
git_protocol_store_refs
(
&
t
->
proto
,
buf
->
data
,
buf
->
offset
);
if
(
ret
==
GIT_
E
SHORTBUFFER
)
{
if
(
ret
==
GIT_SHORTBUFFER
)
{
gitno_consume_n
(
buf
,
buf
->
len
);
gitno_consume_n
(
buf
,
buf
->
len
);
continue
;
continue
;
}
}
...
@@ -279,7 +279,7 @@ static int recv_pkt(gitno_buffer *buf)
...
@@ -279,7 +279,7 @@ static int recv_pkt(gitno_buffer *buf)
return
-
1
;
return
-
1
;
error
=
git_pkt_parse_line
(
&
pkt
,
ptr
,
&
line_end
,
buf
->
offset
);
error
=
git_pkt_parse_line
(
&
pkt
,
ptr
,
&
line_end
,
buf
->
offset
);
if
(
error
==
GIT_
E
SHORTBUFFER
)
if
(
error
==
GIT_SHORTBUFFER
)
continue
;
continue
;
if
(
error
<
0
)
if
(
error
<
0
)
return
-
1
;
return
-
1
;
...
@@ -344,7 +344,7 @@ static int git_negotiate_fetch(git_transport *transport, git_repository *repo, c
...
@@ -344,7 +344,7 @@ static int git_negotiate_fetch(git_transport *transport, git_repository *repo, c
}
}
}
}
if
(
error
<
0
&&
error
!=
GIT_
E
REVWALKOVER
)
if
(
error
<
0
&&
error
!=
GIT_REVWALKOVER
)
goto
on_error
;
goto
on_error
;
/* Tell the other end that we're done negotiating */
/* Tell the other end that we're done negotiating */
...
@@ -384,10 +384,10 @@ static int git_download_pack(git_transport *transport, git_repository *repo, git
...
@@ -384,10 +384,10 @@ static int git_download_pack(git_transport *transport, git_repository *repo, git
}
}
error
=
git_pkt_parse_line
(
&
pkt
,
ptr
,
&
line_end
,
buf
->
offset
);
error
=
git_pkt_parse_line
(
&
pkt
,
ptr
,
&
line_end
,
buf
->
offset
);
if
(
error
==
GIT_
E
SHORTBUFFER
)
if
(
error
==
GIT_SHORTBUFFER
)
break
;
break
;
if
(
error
<
GIT_SUCCESS
)
if
(
error
<
0
)
return
error
;
return
error
;
if
(
pkt
->
type
==
GIT_PKT_PACK
)
{
if
(
pkt
->
type
==
GIT_PKT_PACK
)
{
...
...
src/transports/http.c
View file @
e172cf08
...
@@ -354,10 +354,10 @@ static int on_body_parse_response(http_parser *parser, const char *str, size_t l
...
@@ -354,10 +354,10 @@ static int on_body_parse_response(http_parser *parser, const char *str, size_t l
return
0
;
return
0
;
error
=
git_pkt_parse_line
(
&
pkt
,
ptr
,
&
line_end
,
git_buf_len
(
buf
));
error
=
git_pkt_parse_line
(
&
pkt
,
ptr
,
&
line_end
,
git_buf_len
(
buf
));
if
(
error
==
GIT_
E
SHORTBUFFER
)
{
if
(
error
==
GIT_SHORTBUFFER
)
{
return
0
;
/* Ask for more */
return
0
;
/* Ask for more */
}
}
if
(
error
<
GIT_SUCCESS
)
if
(
error
<
0
)
return
t
->
error
=
-
1
;
return
t
->
error
=
-
1
;
git_buf_consume
(
buf
,
line_end
);
git_buf_consume
(
buf
,
line_end
);
...
@@ -486,7 +486,7 @@ static int http_negotiate_fetch(git_transport *transport, git_repository *repo,
...
@@ -486,7 +486,7 @@ static int http_negotiate_fetch(git_transport *transport, git_repository *repo,
git_buf_clear
(
&
request
);
git_buf_clear
(
&
request
);
git_buf_clear
(
&
data
);
git_buf_clear
(
&
data
);
if
(
ret
<
GIT_SUCCESS
||
i
>=
256
)
if
(
ret
<
0
||
i
>=
256
)
break
;
break
;
if
((
ret
=
parse_response
(
t
))
<
0
)
if
((
ret
=
parse_response
(
t
))
<
0
)
...
...
src/tree.c
View file @
e172cf08
...
@@ -117,7 +117,7 @@ static int tree_key_search(git_vector *entries, const char *filename)
...
@@ -117,7 +117,7 @@ static int tree_key_search(git_vector *entries, const char *filename)
}
}
/* The filename doesn't exist at all */
/* The filename doesn't exist at all */
return
GIT_
E
NOTFOUND
;
return
GIT_NOTFOUND
;
}
}
void
git_tree__free
(
git_tree
*
tree
)
void
git_tree__free
(
git_tree
*
tree
)
...
@@ -186,7 +186,7 @@ const git_tree_entry *git_tree_entry_byname(git_tree *tree, const char *filename
...
@@ -186,7 +186,7 @@ const git_tree_entry *git_tree_entry_byname(git_tree *tree, const char *filename
assert
(
tree
&&
filename
);
assert
(
tree
&&
filename
);
idx
=
tree_key_search
(
&
tree
->
entries
,
filename
);
idx
=
tree_key_search
(
&
tree
->
entries
,
filename
);
if
(
idx
==
GIT_
E
NOTFOUND
)
if
(
idx
==
GIT_NOTFOUND
)
return
NULL
;
return
NULL
;
return
git_vector_get
(
&
tree
->
entries
,
idx
);
return
git_vector_get
(
&
tree
->
entries
,
idx
);
...
@@ -518,7 +518,7 @@ int git_treebuilder_insert(git_tree_entry **entry_out, git_treebuilder *bld, con
...
@@ -518,7 +518,7 @@ int git_treebuilder_insert(git_tree_entry **entry_out, git_treebuilder *bld, con
git_oid_cpy
(
&
entry
->
oid
,
id
);
git_oid_cpy
(
&
entry
->
oid
,
id
);
entry
->
attr
=
attributes
;
entry
->
attr
=
attributes
;
if
(
pos
==
GIT_
E
NOTFOUND
)
{
if
(
pos
==
GIT_NOTFOUND
)
{
if
(
git_vector_insert
(
&
bld
->
entries
,
entry
)
<
0
)
if
(
git_vector_insert
(
&
bld
->
entries
,
entry
)
<
0
)
return
-
1
;
return
-
1
;
}
}
...
@@ -647,7 +647,7 @@ static int tree_frompath(
...
@@ -647,7 +647,7 @@ static int tree_frompath(
{
{
char
*
slash_pos
=
NULL
;
char
*
slash_pos
=
NULL
;
const
git_tree_entry
*
entry
;
const
git_tree_entry
*
entry
;
int
error
=
GIT_SUCCESS
;
int
error
=
0
;
git_tree
*
subtree
;
git_tree
*
subtree
;
if
(
!*
(
treeentry_path
->
ptr
+
offset
))
{
if
(
!*
(
treeentry_path
->
ptr
+
offset
))
{
...
@@ -682,7 +682,7 @@ static int tree_frompath(
...
@@ -682,7 +682,7 @@ static int tree_frompath(
giterr_set
(
GITERR_TREE
,
giterr_set
(
GITERR_TREE
,
"No tree entry can be found from "
"No tree entry can be found from "
"the given tree and relative path '%s'."
,
treeentry_path
->
ptr
);
"the given tree and relative path '%s'."
,
treeentry_path
->
ptr
);
return
GIT_
E
NOTFOUND
;
return
GIT_NOTFOUND
;
}
}
...
@@ -724,7 +724,7 @@ static int tree_walk_post(
...
@@ -724,7 +724,7 @@ static int tree_walk_post(
git_buf
*
path
,
git_buf
*
path
,
void
*
payload
)
void
*
payload
)
{
{
int
error
=
GIT_SUCCESS
;
int
error
=
0
;
unsigned
int
i
;
unsigned
int
i
;
for
(
i
=
0
;
i
<
tree
->
entries
.
length
;
++
i
)
{
for
(
i
=
0
;
i
<
tree
->
entries
.
length
;
++
i
)
{
...
@@ -761,7 +761,7 @@ static int tree_walk_post(
...
@@ -761,7 +761,7 @@ static int tree_walk_post(
int
git_tree_walk
(
git_tree
*
tree
,
git_treewalk_cb
callback
,
int
mode
,
void
*
payload
)
int
git_tree_walk
(
git_tree
*
tree
,
git_treewalk_cb
callback
,
int
mode
,
void
*
payload
)
{
{
int
error
=
GIT_SUCCESS
;
int
error
=
0
;
git_buf
root_path
=
GIT_BUF_INIT
;
git_buf
root_path
=
GIT_BUF_INIT
;
switch
(
mode
)
{
switch
(
mode
)
{
...
...
src/vector.c
View file @
e172cf08
...
@@ -137,7 +137,7 @@ int git_vector_bsearch3(
...
@@ -137,7 +137,7 @@ int git_vector_bsearch3(
if
(
at_pos
!=
NULL
)
if
(
at_pos
!=
NULL
)
*
at_pos
=
(
unsigned
int
)
pos
;
*
at_pos
=
(
unsigned
int
)
pos
;
return
(
rval
>=
0
)
?
(
int
)
pos
:
GIT_
E
NOTFOUND
;
return
(
rval
>=
0
)
?
(
int
)
pos
:
GIT_NOTFOUND
;
}
}
int
git_vector_search2
(
int
git_vector_search2
(
...
@@ -152,7 +152,7 @@ int git_vector_search2(
...
@@ -152,7 +152,7 @@ int git_vector_search2(
return
i
;
return
i
;
}
}
return
GIT_
E
NOTFOUND
;
return
GIT_NOTFOUND
;
}
}
static
int
strict_comparison
(
const
void
*
a
,
const
void
*
b
)
static
int
strict_comparison
(
const
void
*
a
,
const
void
*
b
)
...
@@ -172,7 +172,7 @@ int git_vector_remove(git_vector *v, unsigned int idx)
...
@@ -172,7 +172,7 @@ int git_vector_remove(git_vector *v, unsigned int idx)
assert
(
v
);
assert
(
v
);
if
(
idx
>=
v
->
length
||
v
->
length
==
0
)
if
(
idx
>=
v
->
length
||
v
->
length
==
0
)
return
GIT_
E
NOTFOUND
;
return
GIT_NOTFOUND
;
for
(
i
=
idx
;
i
<
v
->
length
-
1
;
++
i
)
for
(
i
=
idx
;
i
<
v
->
length
-
1
;
++
i
)
v
->
contents
[
i
]
=
v
->
contents
[
i
+
1
];
v
->
contents
[
i
]
=
v
->
contents
[
i
+
1
];
...
...
tests-clar/commit/signature.c
View file @
e172cf08
...
@@ -3,9 +3,9 @@
...
@@ -3,9 +3,9 @@
static
int
try_build_signature
(
const
char
*
name
,
const
char
*
email
,
git_time_t
time
,
int
offset
)
static
int
try_build_signature
(
const
char
*
name
,
const
char
*
email
,
git_time_t
time
,
int
offset
)
{
{
git_signature
*
sign
;
git_signature
*
sign
;
int
error
=
GIT_SUCCESS
;
int
error
=
0
;
if
((
error
=
git_signature_new
(
&
sign
,
name
,
email
,
time
,
offset
))
<
GIT_SUCCESS
)
if
((
error
=
git_signature_new
(
&
sign
,
name
,
email
,
time
,
offset
))
<
0
)
return
error
;
return
error
;
git_signature_free
((
git_signature
*
)
sign
);
git_signature_free
((
git_signature
*
)
sign
);
...
...
tests-clar/config/multivar.c
View file @
e172cf08
...
@@ -21,7 +21,7 @@ static int mv_read_cb(const char *name, const char *value, void *data)
...
@@ -21,7 +21,7 @@ static int mv_read_cb(const char *name, const char *value, void *data)
if
(
!
strcmp
(
name
,
_name
))
if
(
!
strcmp
(
name
,
_name
))
(
*
n
)
++
;
(
*
n
)
++
;
return
GIT_SUCCESS
;
return
0
;
}
}
void
test_config_multivar__foreach
(
void
)
void
test_config_multivar__foreach
(
void
)
...
@@ -45,7 +45,7 @@ static int cb(const char *val, void *data)
...
@@ -45,7 +45,7 @@ static int cb(const char *val, void *data)
(
*
n
)
++
;
(
*
n
)
++
;
return
GIT_SUCCESS
;
return
0
;
}
}
void
test_config_multivar__get
(
void
)
void
test_config_multivar__get
(
void
)
...
...
tests-clar/config/write.c
View file @
e172cf08
...
@@ -62,7 +62,7 @@ void test_config_write__delete_value(void)
...
@@ -62,7 +62,7 @@ void test_config_write__delete_value(void)
git_config_free
(
cfg
);
git_config_free
(
cfg
);
cl_git_pass
(
git_config_open_ondisk
(
&
cfg
,
"config9"
));
cl_git_pass
(
git_config_open_ondisk
(
&
cfg
,
"config9"
));
cl_assert
(
git_config_get_int32
(
&
i
,
cfg
,
"core.dummy"
)
==
GIT_
E
NOTFOUND
);
cl_assert
(
git_config_get_int32
(
&
i
,
cfg
,
"core.dummy"
)
==
GIT_NOTFOUND
);
cl_git_pass
(
git_config_set_int32
(
cfg
,
"core.dummy"
,
1
));
cl_git_pass
(
git_config_set_int32
(
cfg
,
"core.dummy"
,
1
));
git_config_free
(
cfg
);
git_config_free
(
cfg
);
}
}
...
@@ -87,6 +87,6 @@ void test_config_write__delete_inexistent(void)
...
@@ -87,6 +87,6 @@ void test_config_write__delete_inexistent(void)
git_config
*
cfg
;
git_config
*
cfg
;
cl_git_pass
(
git_config_open_ondisk
(
&
cfg
,
"config9"
));
cl_git_pass
(
git_config_open_ondisk
(
&
cfg
,
"config9"
));
cl_assert
(
git_config_delete
(
cfg
,
"core.imaginary"
)
==
GIT_
E
NOTFOUND
);
cl_assert
(
git_config_delete
(
cfg
,
"core.imaginary"
)
==
GIT_NOTFOUND
);
git_config_free
(
cfg
);
git_config_free
(
cfg
);
}
}
tests-clar/core/path.c
View file @
e172cf08
...
@@ -413,8 +413,8 @@ void test_core_path__13_cannot_prettify_a_non_existing_file(void)
...
@@ -413,8 +413,8 @@ void test_core_path__13_cannot_prettify_a_non_existing_file(void)
git_buf
p
=
GIT_BUF_INIT
;
git_buf
p
=
GIT_BUF_INIT
;
cl_must_pass
(
git_path_exists
(
NON_EXISTING_FILEPATH
)
==
false
);
cl_must_pass
(
git_path_exists
(
NON_EXISTING_FILEPATH
)
==
false
);
cl_assert_equal_i
(
GIT_
E
NOTFOUND
,
git_path_prettify
(
&
p
,
NON_EXISTING_FILEPATH
,
NULL
));
cl_assert_equal_i
(
GIT_NOTFOUND
,
git_path_prettify
(
&
p
,
NON_EXISTING_FILEPATH
,
NULL
));
cl_assert_equal_i
(
GIT_
E
NOTFOUND
,
git_path_prettify
(
&
p
,
NON_EXISTING_FILEPATH
"/so-do-i"
,
NULL
));
cl_assert_equal_i
(
GIT_NOTFOUND
,
git_path_prettify
(
&
p
,
NON_EXISTING_FILEPATH
"/so-do-i"
,
NULL
));
git_buf_free
(
&
p
);
git_buf_free
(
&
p
);
}
}
tests-clar/core/vector.c
View file @
e172cf08
...
@@ -143,7 +143,7 @@ static int merge_structs(void **old_raw, void *new)
...
@@ -143,7 +143,7 @@ static int merge_structs(void **old_raw, void *new)
((
my_struct
*
)
old
)
->
count
+=
1
;
((
my_struct
*
)
old
)
->
count
+=
1
;
git__free
(
new
);
git__free
(
new
);
_struct_count
--
;
_struct_count
--
;
return
GIT_E
E
XISTS
;
return
GIT_EXISTS
;
}
}
static
my_struct
*
alloc_struct
(
int
value
)
static
my_struct
*
alloc_struct
(
int
value
)
...
...
tests-clar/index/tests.c
View file @
e172cf08
...
@@ -50,10 +50,10 @@ static void files_are_equal(const char *a, const char *b)
...
@@ -50,10 +50,10 @@ static void files_are_equal(const char *a, const char *b)
git_buf
buf_b
=
GIT_BUF_INIT
;
git_buf
buf_b
=
GIT_BUF_INIT
;
int
pass
;
int
pass
;
if
(
git_futils_readbuffer
(
&
buf_a
,
a
)
<
GIT_SUCCESS
)
if
(
git_futils_readbuffer
(
&
buf_a
,
a
)
<
0
)
cl_assert
(
0
);
cl_assert
(
0
);
if
(
git_futils_readbuffer
(
&
buf_b
,
b
)
<
GIT_SUCCESS
)
{
if
(
git_futils_readbuffer
(
&
buf_b
,
b
)
<
0
)
{
git_buf_free
(
&
buf_a
);
git_buf_free
(
&
buf_a
);
cl_assert
(
0
);
cl_assert
(
0
);
}
}
...
@@ -153,7 +153,7 @@ void test_index_tests__find_in_empty(void)
...
@@ -153,7 +153,7 @@ void test_index_tests__find_in_empty(void)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
test_entries
);
++
i
)
{
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
test_entries
);
++
i
)
{
int
idx
=
git_index_find
(
index
,
test_entries
[
i
].
path
);
int
idx
=
git_index_find
(
index
,
test_entries
[
i
].
path
);
cl_assert
(
idx
==
GIT_
E
NOTFOUND
);
cl_assert
(
idx
==
GIT_NOTFOUND
);
}
}
git_index_free
(
index
);
git_index_free
(
index
);
...
...
tests-clar/network/remotelocal.c
View file @
e172cf08
...
@@ -68,7 +68,7 @@ static int count_ref__cb(git_remote_head *head, void *payload)
...
@@ -68,7 +68,7 @@ static int count_ref__cb(git_remote_head *head, void *payload)
(
void
)
head
;
(
void
)
head
;
(
*
count
)
++
;
(
*
count
)
++
;
return
GIT_SUCCESS
;
return
0
;
}
}
static
int
ensure_peeled__cb
(
git_remote_head
*
head
,
void
*
payload
)
static
int
ensure_peeled__cb
(
git_remote_head
*
head
,
void
*
payload
)
...
...
tests-clar/network/remotes.c
View file @
e172cf08
...
@@ -156,7 +156,7 @@ void test_network_remotes__list(void)
...
@@ -156,7 +156,7 @@ void test_network_remotes__list(void)
void
test_network_remotes__loading_a_missing_remote_returns_ENOTFOUND
(
void
)
void
test_network_remotes__loading_a_missing_remote_returns_ENOTFOUND
(
void
)
{
{
cl_assert_equal_i
(
GIT_
E
NOTFOUND
,
git_remote_load
(
&
_remote
,
_repo
,
"just-left-few-minutes-ago"
));
cl_assert_equal_i
(
GIT_NOTFOUND
,
git_remote_load
(
&
_remote
,
_repo
,
"just-left-few-minutes-ago"
));
}
}
void
test_network_remotes__add
(
void
)
void
test_network_remotes__add
(
void
)
...
...
tests-clar/notes/notes.c
View file @
e172cf08
...
@@ -127,7 +127,7 @@ void test_notes_notes__retrieving_a_list_of_notes_for_an_unknown_namespace_retur
...
@@ -127,7 +127,7 @@ void test_notes_notes__retrieving_a_list_of_notes_for_an_unknown_namespace_retur
error
=
git_note_foreach
(
_repo
,
"refs/notes/i-am-not"
,
note_list_cb
,
&
retrieved_notes
);
error
=
git_note_foreach
(
_repo
,
"refs/notes/i-am-not"
,
note_list_cb
,
&
retrieved_notes
);
cl_git_fail
(
error
);
cl_git_fail
(
error
);
cl_assert_equal_i
(
GIT_
E
NOTFOUND
,
error
);
cl_assert_equal_i
(
GIT_NOTFOUND
,
error
);
cl_assert_equal_i
(
0
,
retrieved_notes
);
cl_assert_equal_i
(
0
,
retrieved_notes
);
}
}
tests-clar/object/lookup.c
View file @
e172cf08
...
@@ -22,7 +22,7 @@ void test_object_lookup__lookup_wrong_type_returns_enotfound(void)
...
@@ -22,7 +22,7 @@ void test_object_lookup__lookup_wrong_type_returns_enotfound(void)
cl_git_pass
(
git_oid_fromstr
(
&
oid
,
commit
));
cl_git_pass
(
git_oid_fromstr
(
&
oid
,
commit
));
cl_assert_equal_i
(
cl_assert_equal_i
(
GIT_
E
NOTFOUND
,
git_object_lookup
(
&
object
,
g_repo
,
&
oid
,
GIT_OBJ_TAG
));
GIT_NOTFOUND
,
git_object_lookup
(
&
object
,
g_repo
,
&
oid
,
GIT_OBJ_TAG
));
}
}
void
test_object_lookup__lookup_nonexisting_returns_enotfound
(
void
)
void
test_object_lookup__lookup_nonexisting_returns_enotfound
(
void
)
...
@@ -33,7 +33,7 @@ void test_object_lookup__lookup_nonexisting_returns_enotfound(void)
...
@@ -33,7 +33,7 @@ void test_object_lookup__lookup_nonexisting_returns_enotfound(void)
cl_git_pass
(
git_oid_fromstr
(
&
oid
,
unknown
));
cl_git_pass
(
git_oid_fromstr
(
&
oid
,
unknown
));
cl_assert_equal_i
(
cl_assert_equal_i
(
GIT_
E
NOTFOUND
,
git_object_lookup
(
&
object
,
g_repo
,
&
oid
,
GIT_OBJ_ANY
));
GIT_NOTFOUND
,
git_object_lookup
(
&
object
,
g_repo
,
&
oid
,
GIT_OBJ_ANY
));
}
}
void
test_object_lookup__lookup_wrong_type_by_abbreviated_id_returns_enotfound
(
void
)
void
test_object_lookup__lookup_wrong_type_by_abbreviated_id_returns_enotfound
(
void
)
...
@@ -44,7 +44,7 @@ void test_object_lookup__lookup_wrong_type_by_abbreviated_id_returns_enotfound(v
...
@@ -44,7 +44,7 @@ void test_object_lookup__lookup_wrong_type_by_abbreviated_id_returns_enotfound(v
cl_git_pass
(
git_oid_fromstrn
(
&
oid
,
commit
,
strlen
(
commit
)));
cl_git_pass
(
git_oid_fromstrn
(
&
oid
,
commit
,
strlen
(
commit
)));
cl_assert_equal_i
(
cl_assert_equal_i
(
GIT_
E
NOTFOUND
,
git_object_lookup_prefix
(
&
object
,
g_repo
,
&
oid
,
strlen
(
commit
),
GIT_OBJ_TAG
));
GIT_NOTFOUND
,
git_object_lookup_prefix
(
&
object
,
g_repo
,
&
oid
,
strlen
(
commit
),
GIT_OBJ_TAG
));
}
}
void
test_object_lookup__lookup_wrong_type_eventually_returns_enotfound
(
void
)
void
test_object_lookup__lookup_wrong_type_eventually_returns_enotfound
(
void
)
...
@@ -59,5 +59,5 @@ void test_object_lookup__lookup_wrong_type_eventually_returns_enotfound(void)
...
@@ -59,5 +59,5 @@ void test_object_lookup__lookup_wrong_type_eventually_returns_enotfound(void)
git_object_free
(
object
);
git_object_free
(
object
);
cl_assert_equal_i
(
cl_assert_equal_i
(
GIT_
E
NOTFOUND
,
git_object_lookup
(
&
object
,
g_repo
,
&
oid
,
GIT_OBJ_TAG
));
GIT_NOTFOUND
,
git_object_lookup
(
&
object
,
g_repo
,
&
oid
,
GIT_OBJ_TAG
));
}
}
tests-clar/object/tag/read.c
View file @
e172cf08
...
@@ -17,9 +17,9 @@ static void ensure_tag_pattern_match(git_repository *repo,
...
@@ -17,9 +17,9 @@ static void ensure_tag_pattern_match(git_repository *repo,
const
size_t
expected_matches
)
const
size_t
expected_matches
)
{
{
git_strarray
tag_list
;
git_strarray
tag_list
;
int
error
=
GIT_SUCCESS
;
int
error
=
0
;
if
((
error
=
git_tag_list_match
(
&
tag_list
,
pattern
,
repo
))
<
GIT_SUCCESS
)
if
((
error
=
git_tag_list_match
(
&
tag_list
,
pattern
,
repo
))
<
0
)
goto
exit
;
goto
exit
;
if
(
tag_list
.
count
!=
expected_matches
)
if
(
tag_list
.
count
!=
expected_matches
)
...
...
tests-clar/object/tree/frompath.c
View file @
e172cf08
...
@@ -30,10 +30,10 @@ static void assert_tree_from_path(git_tree *root, const char *path, int expected
...
@@ -30,10 +30,10 @@ static void assert_tree_from_path(git_tree *root, const char *path, int expected
cl_assert
(
git_tree_get_subtree
(
&
containing_tree
,
root
,
path
)
==
expected_result
);
cl_assert
(
git_tree_get_subtree
(
&
containing_tree
,
root
,
path
)
==
expected_result
);
if
(
containing_tree
==
NULL
&&
expected_result
!=
GIT_SUCCESS
)
if
(
containing_tree
==
NULL
&&
expected_result
!=
0
)
return
;
return
;
cl_assert
(
containing_tree
!=
NULL
&&
expected_result
==
GIT_SUCCESS
);
cl_assert
(
containing_tree
!=
NULL
&&
expected_result
==
0
);
cl_git_pass
(
git_oid_streq
(
git_object_id
((
const
git_object
*
)
containing_tree
),
expected_raw_oid
));
cl_git_pass
(
git_oid_streq
(
git_object_id
((
const
git_object
*
)
containing_tree
),
expected_raw_oid
));
...
@@ -49,25 +49,25 @@ static void assert_tree_from_path_klass(git_tree *root, const char *path, int ex
...
@@ -49,25 +49,25 @@ static void assert_tree_from_path_klass(git_tree *root, const char *path, int ex
void
test_object_tree_frompath__retrieve_tree_from_path_to_treeentry
(
void
)
void
test_object_tree_frompath__retrieve_tree_from_path_to_treeentry
(
void
)
{
{
/* Will return self if given a one path segment... */
/* Will return self if given a one path segment... */
assert_tree_from_path
(
tree
,
"README"
,
GIT_SUCCESS
,
tree_with_subtrees_oid
);
assert_tree_from_path
(
tree
,
"README"
,
0
,
tree_with_subtrees_oid
);
/* ...even one that lead to a non existent tree entry. */
/* ...even one that lead to a non existent tree entry. */
assert_tree_from_path
(
tree
,
"i-do-not-exist.txt"
,
GIT_SUCCESS
,
tree_with_subtrees_oid
);
assert_tree_from_path
(
tree
,
"i-do-not-exist.txt"
,
0
,
tree_with_subtrees_oid
);
/* Will return fgh tree oid given this following path... */
/* Will return fgh tree oid given this following path... */
assert_tree_from_path
(
tree
,
"ab/de/fgh/1.txt"
,
GIT_SUCCESS
,
"3259a6bd5b57fb9c1281bb7ed3167b50f224cb54"
);
assert_tree_from_path
(
tree
,
"ab/de/fgh/1.txt"
,
0
,
"3259a6bd5b57fb9c1281bb7ed3167b50f224cb54"
);
/* ... and ab tree oid given this one. */
/* ... and ab tree oid given this one. */
assert_tree_from_path
(
tree
,
"ab/de"
,
GIT_SUCCESS
,
"f1425cef211cc08caa31e7b545ffb232acb098c3"
);
assert_tree_from_path
(
tree
,
"ab/de"
,
0
,
"f1425cef211cc08caa31e7b545ffb232acb098c3"
);
/* Will succeed if given a valid path which leads to a tree entry which doesn't exist */
/* Will succeed if given a valid path which leads to a tree entry which doesn't exist */
assert_tree_from_path
(
tree
,
"ab/de/fgh/i-do-not-exist.txt"
,
GIT_SUCCESS
,
"3259a6bd5b57fb9c1281bb7ed3167b50f224cb54"
);
assert_tree_from_path
(
tree
,
"ab/de/fgh/i-do-not-exist.txt"
,
0
,
"3259a6bd5b57fb9c1281bb7ed3167b50f224cb54"
);
}
}
void
test_object_tree_frompath__fail_when_processing_an_unknown_tree_segment
(
void
)
void
test_object_tree_frompath__fail_when_processing_an_unknown_tree_segment
(
void
)
{
{
assert_tree_from_path
(
tree
,
"nope/de/fgh/1.txt"
,
GIT_
E
NOTFOUND
,
NULL
);
assert_tree_from_path
(
tree
,
"nope/de/fgh/1.txt"
,
GIT_NOTFOUND
,
NULL
);
assert_tree_from_path
(
tree
,
"ab/me-neither/fgh/2.txt"
,
GIT_
E
NOTFOUND
,
NULL
);
assert_tree_from_path
(
tree
,
"ab/me-neither/fgh/2.txt"
,
GIT_NOTFOUND
,
NULL
);
}
}
void
test_object_tree_frompath__fail_when_processing_an_invalid_path
(
void
)
void
test_object_tree_frompath__fail_when_processing_an_invalid_path
(
void
)
...
...
tests-clar/refs/branches/delete.c
View file @
e172cf08
...
@@ -81,7 +81,7 @@ static void assert_non_exisitng_branch_removal(const char *branch_name, git_bran
...
@@ -81,7 +81,7 @@ static void assert_non_exisitng_branch_removal(const char *branch_name, git_bran
error
=
git_branch_delete
(
repo
,
branch_name
,
branch_type
);
error
=
git_branch_delete
(
repo
,
branch_name
,
branch_type
);
cl_git_fail
(
error
);
cl_git_fail
(
error
);
cl_assert_equal_i
(
GIT_
E
NOTFOUND
,
error
);
cl_assert_equal_i
(
GIT_NOTFOUND
,
error
);
}
}
void
test_refs_branches_delete__deleting_a_non_existing_branch_returns_ENOTFOUND
(
void
)
void
test_refs_branches_delete__deleting_a_non_existing_branch_returns_ENOTFOUND
(
void
)
...
...
tests-clar/refs/branches/move.c
View file @
e172cf08
...
@@ -68,5 +68,5 @@ void test_refs_branches_move__moving_a_non_exisiting_branch_returns_ENOTFOUND(vo
...
@@ -68,5 +68,5 @@ void test_refs_branches_move__moving_a_non_exisiting_branch_returns_ENOTFOUND(vo
error
=
git_branch_move
(
repo
,
"where/am/I"
,
NEW_BRANCH_NAME
,
0
);
error
=
git_branch_move
(
repo
,
"where/am/I"
,
NEW_BRANCH_NAME
,
0
);
cl_git_fail
(
error
);
cl_git_fail
(
error
);
cl_assert_equal_i
(
GIT_
E
NOTFOUND
,
error
);
cl_assert_equal_i
(
GIT_NOTFOUND
,
error
);
}
}
tests-clar/repo/discover.c
View file @
e172cf08
...
@@ -82,7 +82,7 @@ void test_repo_discover__0(void)
...
@@ -82,7 +82,7 @@ void test_repo_discover__0(void)
append_ceiling_dir
(
&
ceiling_dirs_buf
,
TEMP_REPO_FOLDER
);
append_ceiling_dir
(
&
ceiling_dirs_buf
,
TEMP_REPO_FOLDER
);
ceiling_dirs
=
git_buf_cstr
(
&
ceiling_dirs_buf
);
ceiling_dirs
=
git_buf_cstr
(
&
ceiling_dirs_buf
);
cl_assert_equal_i
(
GIT_
E
NOTFOUND
,
git_repository_discover
(
repository_path
,
sizeof
(
repository_path
),
DISCOVER_FOLDER
,
0
,
ceiling_dirs
));
cl_assert_equal_i
(
GIT_NOTFOUND
,
git_repository_discover
(
repository_path
,
sizeof
(
repository_path
),
DISCOVER_FOLDER
,
0
,
ceiling_dirs
));
cl_git_pass
(
git_repository_init
(
&
repo
,
DISCOVER_FOLDER
,
1
));
cl_git_pass
(
git_repository_init
(
&
repo
,
DISCOVER_FOLDER
,
1
));
cl_git_pass
(
git_repository_discover
(
repository_path
,
sizeof
(
repository_path
),
DISCOVER_FOLDER
,
0
,
ceiling_dirs
));
cl_git_pass
(
git_repository_discover
(
repository_path
,
sizeof
(
repository_path
),
DISCOVER_FOLDER
,
0
,
ceiling_dirs
));
...
@@ -117,7 +117,7 @@ void test_repo_discover__0(void)
...
@@ -117,7 +117,7 @@ void test_repo_discover__0(void)
cl_git_fail
(
git_repository_discover
(
found_path
,
sizeof
(
found_path
),
ALTERNATE_MALFORMED_FOLDER1
,
0
,
ceiling_dirs
));
cl_git_fail
(
git_repository_discover
(
found_path
,
sizeof
(
found_path
),
ALTERNATE_MALFORMED_FOLDER1
,
0
,
ceiling_dirs
));
cl_git_fail
(
git_repository_discover
(
found_path
,
sizeof
(
found_path
),
ALTERNATE_MALFORMED_FOLDER2
,
0
,
ceiling_dirs
));
cl_git_fail
(
git_repository_discover
(
found_path
,
sizeof
(
found_path
),
ALTERNATE_MALFORMED_FOLDER2
,
0
,
ceiling_dirs
));
cl_git_fail
(
git_repository_discover
(
found_path
,
sizeof
(
found_path
),
ALTERNATE_MALFORMED_FOLDER3
,
0
,
ceiling_dirs
));
cl_git_fail
(
git_repository_discover
(
found_path
,
sizeof
(
found_path
),
ALTERNATE_MALFORMED_FOLDER3
,
0
,
ceiling_dirs
));
cl_assert_equal_i
(
GIT_
E
NOTFOUND
,
git_repository_discover
(
found_path
,
sizeof
(
found_path
),
ALTERNATE_NOT_FOUND_FOLDER
,
0
,
ceiling_dirs
));
cl_assert_equal_i
(
GIT_NOTFOUND
,
git_repository_discover
(
found_path
,
sizeof
(
found_path
),
ALTERNATE_NOT_FOUND_FOLDER
,
0
,
ceiling_dirs
));
append_ceiling_dir
(
&
ceiling_dirs_buf
,
SUB_REPOSITORY_FOLDER
);
append_ceiling_dir
(
&
ceiling_dirs_buf
,
SUB_REPOSITORY_FOLDER
);
ceiling_dirs
=
git_buf_cstr
(
&
ceiling_dirs_buf
);
ceiling_dirs
=
git_buf_cstr
(
&
ceiling_dirs_buf
);
...
@@ -125,9 +125,9 @@ void test_repo_discover__0(void)
...
@@ -125,9 +125,9 @@ void test_repo_discover__0(void)
//this must pass as ceiling_directories cannot predent the current
//this must pass as ceiling_directories cannot predent the current
//working directory to be checked
//working directory to be checked
cl_git_pass
(
git_repository_discover
(
found_path
,
sizeof
(
found_path
),
SUB_REPOSITORY_FOLDER
,
0
,
ceiling_dirs
));
cl_git_pass
(
git_repository_discover
(
found_path
,
sizeof
(
found_path
),
SUB_REPOSITORY_FOLDER
,
0
,
ceiling_dirs
));
cl_assert_equal_i
(
GIT_
E
NOTFOUND
,
git_repository_discover
(
found_path
,
sizeof
(
found_path
),
SUB_REPOSITORY_FOLDER_SUB
,
0
,
ceiling_dirs
));
cl_assert_equal_i
(
GIT_NOTFOUND
,
git_repository_discover
(
found_path
,
sizeof
(
found_path
),
SUB_REPOSITORY_FOLDER_SUB
,
0
,
ceiling_dirs
));
cl_assert_equal_i
(
GIT_
E
NOTFOUND
,
git_repository_discover
(
found_path
,
sizeof
(
found_path
),
SUB_REPOSITORY_FOLDER_SUB_SUB
,
0
,
ceiling_dirs
));
cl_assert_equal_i
(
GIT_NOTFOUND
,
git_repository_discover
(
found_path
,
sizeof
(
found_path
),
SUB_REPOSITORY_FOLDER_SUB_SUB
,
0
,
ceiling_dirs
));
cl_assert_equal_i
(
GIT_
E
NOTFOUND
,
git_repository_discover
(
found_path
,
sizeof
(
found_path
),
SUB_REPOSITORY_FOLDER_SUB_SUB_SUB
,
0
,
ceiling_dirs
));
cl_assert_equal_i
(
GIT_NOTFOUND
,
git_repository_discover
(
found_path
,
sizeof
(
found_path
),
SUB_REPOSITORY_FOLDER_SUB_SUB_SUB
,
0
,
ceiling_dirs
));
//.gitfile redirection should not be affected by ceiling directories
//.gitfile redirection should not be affected by ceiling directories
ensure_repository_discover
(
REPOSITORY_ALTERNATE_FOLDER
,
ceiling_dirs
,
sub_repository_path
);
ensure_repository_discover
(
REPOSITORY_ALTERNATE_FOLDER
,
ceiling_dirs
,
sub_repository_path
);
...
...
tests-clar/repo/open.c
View file @
e172cf08
...
@@ -278,5 +278,5 @@ void test_repo_open__win32_path(void)
...
@@ -278,5 +278,5 @@ void test_repo_open__win32_path(void)
void
test_repo_open__opening_a_non_existing_repository_returns_ENOTFOUND
(
void
)
void
test_repo_open__opening_a_non_existing_repository_returns_ENOTFOUND
(
void
)
{
{
git_repository
*
repo
;
git_repository
*
repo
;
cl_assert_equal_i
(
GIT_ENOTFOUND
,
git_repository_open
(
&
repo
,
"i-do-not/exist"
));
cl_assert_equal_i
(
GIT_NOTFOUND
,
git_repository_open
(
&
repo
,
"i-do-not/exist"
));
}
}
\ No newline at end of file
tests-clar/revwalk/basic.c
View file @
e172cf08
...
@@ -73,7 +73,7 @@ static int test_walk(git_revwalk *walk, const git_oid *root,
...
@@ -73,7 +73,7 @@ static int test_walk(git_revwalk *walk, const git_oid *root,
i
=
0
;
i
=
0
;
while
(
git_revwalk_next
(
&
oid
,
walk
)
==
GIT_SUCCESS
)
{
while
(
git_revwalk_next
(
&
oid
,
walk
)
==
0
)
{
result_array
[
i
++
]
=
get_commit_index
(
&
oid
);
result_array
[
i
++
]
=
get_commit_index
(
&
oid
);
/*{
/*{
char str[41];
char str[41];
...
@@ -86,7 +86,7 @@ static int test_walk(git_revwalk *walk, const git_oid *root,
...
@@ -86,7 +86,7 @@ static int test_walk(git_revwalk *walk, const git_oid *root,
for
(
i
=
0
;
i
<
results_count
;
++
i
)
for
(
i
=
0
;
i
<
results_count
;
++
i
)
if
(
memcmp
(
possible_results
[
i
],
if
(
memcmp
(
possible_results
[
i
],
result_array
,
result_bytes
)
==
0
)
result_array
,
result_bytes
)
==
0
)
return
GIT_SUCCESS
;
return
0
;
return
GIT_ERROR
;
return
GIT_ERROR
;
}
}
...
@@ -125,7 +125,7 @@ void test_revwalk_basic__glob_heads(void)
...
@@ -125,7 +125,7 @@ void test_revwalk_basic__glob_heads(void)
cl_git_pass
(
git_revwalk_push_glob
(
_walk
,
"heads"
));
cl_git_pass
(
git_revwalk_push_glob
(
_walk
,
"heads"
));
while
(
git_revwalk_next
(
&
oid
,
_walk
)
==
GIT_SUCCESS
)
{
while
(
git_revwalk_next
(
&
oid
,
_walk
)
==
0
)
{
i
++
;
i
++
;
}
}
...
@@ -140,7 +140,7 @@ void test_revwalk_basic__push_head(void)
...
@@ -140,7 +140,7 @@ void test_revwalk_basic__push_head(void)
cl_git_pass
(
git_revwalk_push_head
(
_walk
));
cl_git_pass
(
git_revwalk_push_head
(
_walk
));
while
(
git_revwalk_next
(
&
oid
,
_walk
)
==
GIT_SUCCESS
)
{
while
(
git_revwalk_next
(
&
oid
,
_walk
)
==
0
)
{
i
++
;
i
++
;
}
}
...
@@ -156,7 +156,7 @@ void test_revwalk_basic__push_head_hide_ref(void)
...
@@ -156,7 +156,7 @@ void test_revwalk_basic__push_head_hide_ref(void)
cl_git_pass
(
git_revwalk_push_head
(
_walk
));
cl_git_pass
(
git_revwalk_push_head
(
_walk
));
cl_git_pass
(
git_revwalk_hide_ref
(
_walk
,
"refs/heads/packed-test"
));
cl_git_pass
(
git_revwalk_hide_ref
(
_walk
,
"refs/heads/packed-test"
));
while
(
git_revwalk_next
(
&
oid
,
_walk
)
==
GIT_SUCCESS
)
{
while
(
git_revwalk_next
(
&
oid
,
_walk
)
==
0
)
{
i
++
;
i
++
;
}
}
...
@@ -172,7 +172,7 @@ void test_revwalk_basic__push_head_hide_ref_nobase(void)
...
@@ -172,7 +172,7 @@ void test_revwalk_basic__push_head_hide_ref_nobase(void)
cl_git_pass
(
git_revwalk_push_head
(
_walk
));
cl_git_pass
(
git_revwalk_push_head
(
_walk
));
cl_git_pass
(
git_revwalk_hide_ref
(
_walk
,
"refs/heads/packed"
));
cl_git_pass
(
git_revwalk_hide_ref
(
_walk
,
"refs/heads/packed"
));
while
(
git_revwalk_next
(
&
oid
,
_walk
)
==
GIT_SUCCESS
)
{
while
(
git_revwalk_next
(
&
oid
,
_walk
)
==
0
)
{
i
++
;
i
++
;
}
}
...
...
tests-clar/revwalk/mergebase.c
View file @
e172cf08
...
@@ -63,7 +63,7 @@ void test_revwalk_mergebase__no_common_ancestor_returns_ENOTFOUND(void)
...
@@ -63,7 +63,7 @@ void test_revwalk_mergebase__no_common_ancestor_returns_ENOTFOUND(void)
error
=
git_merge_base
(
&
result
,
_repo
,
&
one
,
&
two
);
error
=
git_merge_base
(
&
result
,
_repo
,
&
one
,
&
two
);
cl_git_fail
(
error
);
cl_git_fail
(
error
);
cl_assert_equal_i
(
GIT_
E
NOTFOUND
,
error
);
cl_assert_equal_i
(
GIT_NOTFOUND
,
error
);
}
}
/*
/*
...
...
tests-clar/status/submodules.c
View file @
e172cf08
...
@@ -34,9 +34,9 @@ void test_status_submodules__api(void)
...
@@ -34,9 +34,9 @@ void test_status_submodules__api(void)
{
{
git_submodule
*
sm
;
git_submodule
*
sm
;
cl_assert
(
git_submodule_lookup
(
NULL
,
g_repo
,
"nonexistent"
)
==
GIT_
E
NOTFOUND
);
cl_assert
(
git_submodule_lookup
(
NULL
,
g_repo
,
"nonexistent"
)
==
GIT_NOTFOUND
);
cl_assert
(
git_submodule_lookup
(
NULL
,
g_repo
,
"modified"
)
==
GIT_
E
NOTFOUND
);
cl_assert
(
git_submodule_lookup
(
NULL
,
g_repo
,
"modified"
)
==
GIT_NOTFOUND
);
cl_git_pass
(
git_submodule_lookup
(
&
sm
,
g_repo
,
"testrepo"
));
cl_git_pass
(
git_submodule_lookup
(
&
sm
,
g_repo
,
"testrepo"
));
cl_assert
(
sm
!=
NULL
);
cl_assert
(
sm
!=
NULL
);
...
...
tests-clar/status/worktree.c
View file @
e172cf08
...
@@ -199,7 +199,7 @@ void test_status_worktree__single_nonexistent_file(void)
...
@@ -199,7 +199,7 @@ void test_status_worktree__single_nonexistent_file(void)
error
=
git_status_file
(
&
status_flags
,
repo
,
"nonexistent"
);
error
=
git_status_file
(
&
status_flags
,
repo
,
"nonexistent"
);
cl_git_fail
(
error
);
cl_git_fail
(
error
);
cl_assert
(
error
==
GIT_
E
NOTFOUND
);
cl_assert
(
error
==
GIT_NOTFOUND
);
}
}
/* this test is equivalent to t18-status.c:singlestatus2 */
/* this test is equivalent to t18-status.c:singlestatus2 */
...
@@ -211,7 +211,7 @@ void test_status_worktree__single_nonexistent_file_empty_repo(void)
...
@@ -211,7 +211,7 @@ void test_status_worktree__single_nonexistent_file_empty_repo(void)
error
=
git_status_file
(
&
status_flags
,
repo
,
"nonexistent"
);
error
=
git_status_file
(
&
status_flags
,
repo
,
"nonexistent"
);
cl_git_fail
(
error
);
cl_git_fail
(
error
);
cl_assert
(
error
==
GIT_
E
NOTFOUND
);
cl_assert
(
error
==
GIT_NOTFOUND
);
}
}
/* this test is equivalent to t18-status.c:singlestatus3 */
/* this test is equivalent to t18-status.c:singlestatus3 */
...
@@ -235,7 +235,7 @@ void test_status_worktree__single_folder(void)
...
@@ -235,7 +235,7 @@ void test_status_worktree__single_folder(void)
error
=
git_status_file
(
&
status_flags
,
repo
,
"subdir"
);
error
=
git_status_file
(
&
status_flags
,
repo
,
"subdir"
);
cl_git_fail
(
error
);
cl_git_fail
(
error
);
cl_assert
(
error
!=
GIT_
E
NOTFOUND
);
cl_assert
(
error
!=
GIT_NOTFOUND
);
}
}
...
@@ -416,7 +416,7 @@ void test_status_worktree__cannot_retrieve_the_status_of_a_bare_repository(void)
...
@@ -416,7 +416,7 @@ void test_status_worktree__cannot_retrieve_the_status_of_a_bare_repository(void)
error
=
git_status_file
(
&
status
,
repo
,
"dummy"
);
error
=
git_status_file
(
&
status
,
repo
,
"dummy"
);
cl_git_fail
(
error
);
cl_git_fail
(
error
);
cl_assert
(
error
!=
GIT_
E
NOTFOUND
);
cl_assert
(
error
!=
GIT_NOTFOUND
);
git_repository_free
(
repo
);
git_repository_free
(
repo
);
}
}
...
...
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