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
4c219cf6
Commit
4c219cf6
authored
Apr 03, 2014
by
Vicent Marti
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2244 from jacquesg/const-correctness
Const correctness!
parents
fd61f05e
3b4ba278
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
31 additions
and
24 deletions
+31
-24
include/git2/blob.h
+1
-1
include/git2/branch.h
+4
-3
include/git2/index.h
+1
-1
include/git2/merge.h
+1
-1
include/git2/push.h
+1
-1
include/git2/refs.h
+7
-5
src/blob.c
+1
-1
src/branch.c
+5
-3
src/index.c
+1
-1
src/merge.c
+1
-1
src/push.c
+1
-1
src/refs.c
+7
-5
No files found.
include/git2/blob.h
View file @
4c219cf6
...
@@ -216,7 +216,7 @@ GIT_EXTERN(int) git_blob_create_frombuffer(
...
@@ -216,7 +216,7 @@ GIT_EXTERN(int) git_blob_create_frombuffer(
* @return 1 if the content of the blob is detected
* @return 1 if the content of the blob is detected
* as binary; 0 otherwise.
* as binary; 0 otherwise.
*/
*/
GIT_EXTERN
(
int
)
git_blob_is_binary
(
git_blob
*
blob
);
GIT_EXTERN
(
int
)
git_blob_is_binary
(
const
git_blob
*
blob
);
/** @} */
/** @} */
GIT_END_DECL
GIT_END_DECL
...
...
include/git2/branch.h
View file @
4c219cf6
...
@@ -179,8 +179,9 @@ GIT_EXTERN(int) git_branch_lookup(
...
@@ -179,8 +179,9 @@ GIT_EXTERN(int) git_branch_lookup(
* @return 0 on success; otherwise an error code (e.g., if the
* @return 0 on success; otherwise an error code (e.g., if the
* ref is no local or remote branch).
* ref is no local or remote branch).
*/
*/
GIT_EXTERN
(
int
)
git_branch_name
(
const
char
**
out
,
GIT_EXTERN
(
int
)
git_branch_name
(
git_reference
*
ref
);
const
char
**
out
,
const
git_reference
*
ref
);
/**
/**
* Return the reference supporting the remote tracking branch,
* Return the reference supporting the remote tracking branch,
...
@@ -196,7 +197,7 @@ GIT_EXTERN(int) git_branch_name(const char **out,
...
@@ -196,7 +197,7 @@ GIT_EXTERN(int) git_branch_name(const char **out,
*/
*/
GIT_EXTERN
(
int
)
git_branch_upstream
(
GIT_EXTERN
(
int
)
git_branch_upstream
(
git_reference
**
out
,
git_reference
**
out
,
git_reference
*
branch
);
const
git_reference
*
branch
);
/**
/**
* Set the upstream configuration for a given local branch
* Set the upstream configuration for a given local branch
...
...
include/git2/index.h
View file @
4c219cf6
...
@@ -255,7 +255,7 @@ GIT_EXTERN(int) git_index_write(git_index *index);
...
@@ -255,7 +255,7 @@ GIT_EXTERN(int) git_index_write(git_index *index);
* @param index an existing index object
* @param index an existing index object
* @return path to index file or NULL for in-memory index
* @return path to index file or NULL for in-memory index
*/
*/
GIT_EXTERN
(
const
char
*
)
git_index_path
(
git_index
*
index
);
GIT_EXTERN
(
const
char
*
)
git_index_path
(
const
git_index
*
index
);
/**
/**
* Read a tree into the index file with stats
* Read a tree into the index file with stats
...
...
include/git2/merge.h
View file @
4c219cf6
...
@@ -341,7 +341,7 @@ GIT_EXTERN(int) git_merge_base_octopus(
...
@@ -341,7 +341,7 @@ GIT_EXTERN(int) git_merge_base_octopus(
GIT_EXTERN
(
int
)
git_merge_head_from_ref
(
GIT_EXTERN
(
int
)
git_merge_head_from_ref
(
git_merge_head
**
out
,
git_merge_head
**
out
,
git_repository
*
repo
,
git_repository
*
repo
,
git_reference
*
ref
);
const
git_reference
*
ref
);
/**
/**
* Creates a `git_merge_head` from the given fetch head data. The resulting
* Creates a `git_merge_head` from the given fetch head data. The resulting
...
...
include/git2/push.h
View file @
4c219cf6
...
@@ -148,7 +148,7 @@ GIT_EXTERN(int) git_push_finish(git_push *push);
...
@@ -148,7 +148,7 @@ GIT_EXTERN(int) git_push_finish(git_push *push);
*
*
* @return true if remote side successfully unpacked, false otherwise
* @return true if remote side successfully unpacked, false otherwise
*/
*/
GIT_EXTERN
(
int
)
git_push_unpack_ok
(
git_push
*
push
);
GIT_EXTERN
(
int
)
git_push_unpack_ok
(
const
git_push
*
push
);
/**
/**
* Invoke callback `cb' on each status entry
* Invoke callback `cb' on each status entry
...
...
include/git2/refs.h
View file @
4c219cf6
...
@@ -487,7 +487,9 @@ GIT_EXTERN(void) git_reference_free(git_reference *ref);
...
@@ -487,7 +487,9 @@ GIT_EXTERN(void) git_reference_free(git_reference *ref);
* @param ref2 The second git_reference
* @param ref2 The second git_reference
* @return 0 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
(
const
git_reference
*
ref1
,
const
git_reference
*
ref2
);
/**
/**
* Create an iterator for the repo's references
* Create an iterator for the repo's references
...
@@ -596,7 +598,7 @@ GIT_EXTERN(int) git_reference_is_branch(const git_reference *ref);
...
@@ -596,7 +598,7 @@ GIT_EXTERN(int) git_reference_is_branch(const git_reference *ref);
* @return 1 when the reference lives in the refs/remotes
* @return 1 when the reference lives in the refs/remotes
* namespace; 0 otherwise.
* namespace; 0 otherwise.
*/
*/
GIT_EXTERN
(
int
)
git_reference_is_remote
(
git_reference
*
ref
);
GIT_EXTERN
(
int
)
git_reference_is_remote
(
const
git_reference
*
ref
);
/**
/**
* Check if a reference is a tag
* Check if a reference is a tag
...
@@ -606,7 +608,7 @@ GIT_EXTERN(int) git_reference_is_remote(git_reference *ref);
...
@@ -606,7 +608,7 @@ GIT_EXTERN(int) git_reference_is_remote(git_reference *ref);
* @return 1 when the reference lives in the refs/tags
* @return 1 when the reference lives in the refs/tags
* namespace; 0 otherwise.
* namespace; 0 otherwise.
*/
*/
GIT_EXTERN
(
int
)
git_reference_is_tag
(
git_reference
*
ref
);
GIT_EXTERN
(
int
)
git_reference_is_tag
(
const
git_reference
*
ref
);
/**
/**
* Check if a reference is a note
* Check if a reference is a note
...
@@ -616,7 +618,7 @@ GIT_EXTERN(int) git_reference_is_tag(git_reference *ref);
...
@@ -616,7 +618,7 @@ GIT_EXTERN(int) git_reference_is_tag(git_reference *ref);
* @return 1 when the reference lives in the refs/notes
* @return 1 when the reference lives in the refs/notes
* namespace; 0 otherwise.
* namespace; 0 otherwise.
*/
*/
GIT_EXTERN
(
int
)
git_reference_is_note
(
git_reference
*
ref
);
GIT_EXTERN
(
int
)
git_reference_is_note
(
const
git_reference
*
ref
);
typedef
enum
{
typedef
enum
{
GIT_REF_FORMAT_NORMAL
=
0u
,
GIT_REF_FORMAT_NORMAL
=
0u
,
...
@@ -720,7 +722,7 @@ GIT_EXTERN(int) git_reference_is_valid_name(const char *refname);
...
@@ -720,7 +722,7 @@ GIT_EXTERN(int) git_reference_is_valid_name(const char *refname);
* @param ref a reference
* @param ref a reference
* @return the human-readable version of the name
* @return the human-readable version of the name
*/
*/
GIT_EXTERN
(
const
char
*
)
git_reference_shorthand
(
git_reference
*
ref
);
GIT_EXTERN
(
const
char
*
)
git_reference_shorthand
(
const
git_reference
*
ref
);
/** @} */
/** @} */
...
...
src/blob.c
View file @
4c219cf6
...
@@ -326,7 +326,7 @@ cleanup:
...
@@ -326,7 +326,7 @@ cleanup:
return
error
;
return
error
;
}
}
int
git_blob_is_binary
(
git_blob
*
blob
)
int
git_blob_is_binary
(
const
git_blob
*
blob
)
{
{
git_buf
content
;
git_buf
content
;
...
...
src/branch.c
View file @
4c219cf6
...
@@ -281,7 +281,9 @@ int git_branch_lookup(
...
@@ -281,7 +281,9 @@ int git_branch_lookup(
return
retrieve_branch_reference
(
ref_out
,
repo
,
branch_name
,
branch_type
==
GIT_BRANCH_REMOTE
);
return
retrieve_branch_reference
(
ref_out
,
repo
,
branch_name
,
branch_type
==
GIT_BRANCH_REMOTE
);
}
}
int
git_branch_name
(
const
char
**
out
,
git_reference
*
ref
)
int
git_branch_name
(
const
char
**
out
,
const
git_reference
*
ref
)
{
{
const
char
*
branch_name
;
const
char
*
branch_name
;
...
@@ -450,8 +452,8 @@ cleanup:
...
@@ -450,8 +452,8 @@ cleanup:
}
}
int
git_branch_upstream
(
int
git_branch_upstream
(
git_reference
**
tracking_out
,
git_reference
**
tracking_out
,
git_reference
*
branch
)
const
git_reference
*
branch
)
{
{
int
error
;
int
error
;
git_buf
tracking_name
=
GIT_BUF_INIT
;
git_buf
tracking_name
=
GIT_BUF_INIT
;
...
...
src/index.c
View file @
4c219cf6
...
@@ -553,7 +553,7 @@ int git_index_write(git_index *index)
...
@@ -553,7 +553,7 @@ int git_index_write(git_index *index)
return
0
;
return
0
;
}
}
const
char
*
git_index_path
(
git_index
*
index
)
const
char
*
git_index_path
(
const
git_index
*
index
)
{
{
assert
(
index
);
assert
(
index
);
return
index
->
index_file_path
;
return
index
->
index_file_path
;
...
...
src/merge.c
View file @
4c219cf6
...
@@ -2695,7 +2695,7 @@ static int merge_head_init(
...
@@ -2695,7 +2695,7 @@ static int merge_head_init(
int
git_merge_head_from_ref
(
int
git_merge_head_from_ref
(
git_merge_head
**
out
,
git_merge_head
**
out
,
git_repository
*
repo
,
git_repository
*
repo
,
git_reference
*
ref
)
const
git_reference
*
ref
)
{
{
git_reference
*
resolved
;
git_reference
*
resolved
;
int
error
=
0
;
int
error
=
0
;
...
...
src/push.c
View file @
4c219cf6
...
@@ -651,7 +651,7 @@ int git_push_finish(git_push *push)
...
@@ -651,7 +651,7 @@ int git_push_finish(git_push *push)
return
0
;
return
0
;
}
}
int
git_push_unpack_ok
(
git_push
*
push
)
int
git_push_unpack_ok
(
const
git_push
*
push
)
{
{
return
push
->
unpack_ok
;
return
push
->
unpack_ok
;
}
}
...
...
src/refs.c
View file @
4c219cf6
...
@@ -1031,7 +1031,9 @@ int git_reference__normalize_name_lax(
...
@@ -1031,7 +1031,9 @@ int git_reference__normalize_name_lax(
}
}
#define GIT_REF_TYPEMASK (GIT_REF_OID | GIT_REF_SYMBOLIC)
#define GIT_REF_TYPEMASK (GIT_REF_OID | GIT_REF_SYMBOLIC)
int
git_reference_cmp
(
git_reference
*
ref1
,
git_reference
*
ref2
)
int
git_reference_cmp
(
const
git_reference
*
ref1
,
const
git_reference
*
ref2
)
{
{
git_ref_t
type1
,
type2
;
git_ref_t
type1
,
type2
;
assert
(
ref1
&&
ref2
);
assert
(
ref1
&&
ref2
);
...
@@ -1148,7 +1150,7 @@ int git_reference__is_remote(const char *ref_name)
...
@@ -1148,7 +1150,7 @@ int git_reference__is_remote(const char *ref_name)
return
git__prefixcmp
(
ref_name
,
GIT_REFS_REMOTES_DIR
)
==
0
;
return
git__prefixcmp
(
ref_name
,
GIT_REFS_REMOTES_DIR
)
==
0
;
}
}
int
git_reference_is_remote
(
git_reference
*
ref
)
int
git_reference_is_remote
(
const
git_reference
*
ref
)
{
{
assert
(
ref
);
assert
(
ref
);
return
git_reference__is_remote
(
ref
->
name
);
return
git_reference__is_remote
(
ref
->
name
);
...
@@ -1159,7 +1161,7 @@ int git_reference__is_tag(const char *ref_name)
...
@@ -1159,7 +1161,7 @@ int git_reference__is_tag(const char *ref_name)
return
git__prefixcmp
(
ref_name
,
GIT_REFS_TAGS_DIR
)
==
0
;
return
git__prefixcmp
(
ref_name
,
GIT_REFS_TAGS_DIR
)
==
0
;
}
}
int
git_reference_is_tag
(
git_reference
*
ref
)
int
git_reference_is_tag
(
const
git_reference
*
ref
)
{
{
assert
(
ref
);
assert
(
ref
);
return
git_reference__is_tag
(
ref
->
name
);
return
git_reference__is_tag
(
ref
->
name
);
...
@@ -1170,7 +1172,7 @@ int git_reference__is_note(const char *ref_name)
...
@@ -1170,7 +1172,7 @@ int git_reference__is_note(const char *ref_name)
return
git__prefixcmp
(
ref_name
,
GIT_REFS_NOTES_DIR
)
==
0
;
return
git__prefixcmp
(
ref_name
,
GIT_REFS_NOTES_DIR
)
==
0
;
}
}
int
git_reference_is_note
(
git_reference
*
ref
)
int
git_reference_is_note
(
const
git_reference
*
ref
)
{
{
assert
(
ref
);
assert
(
ref
);
return
git_reference__is_note
(
ref
->
name
);
return
git_reference__is_note
(
ref
->
name
);
...
@@ -1244,7 +1246,7 @@ int git_reference_is_valid_name(const char *refname)
...
@@ -1244,7 +1246,7 @@ int git_reference_is_valid_name(const char *refname)
return
git_reference__is_valid_name
(
refname
,
GIT_REF_FORMAT_ALLOW_ONELEVEL
);
return
git_reference__is_valid_name
(
refname
,
GIT_REF_FORMAT_ALLOW_ONELEVEL
);
}
}
const
char
*
git_reference_shorthand
(
git_reference
*
ref
)
const
char
*
git_reference_shorthand
(
const
git_reference
*
ref
)
{
{
const
char
*
name
=
ref
->
name
;
const
char
*
name
=
ref
->
name
;
...
...
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