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
5588f073
Commit
5588f073
authored
Dec 09, 2013
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up warnings
parent
07c5dc84
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
32 additions
and
42 deletions
+32
-42
deps/regex/regex.c
+10
-3
src/buffer.h
+2
-1
src/common.h
+2
-0
src/merge.c
+2
-2
src/revert.c
+2
-8
src/win32/precompiled.h
+4
-3
tests/blame/harder.c
+8
-0
tests/merge/merge_helpers.c
+0
-1
tests/merge/trees/commits.c
+0
-22
tests/refs/branches/create.c
+2
-2
No files found.
deps/regex/regex.c
View file @
5588f073
...
@@ -67,10 +67,17 @@
...
@@ -67,10 +67,17 @@
#include "regex_internal.h"
#include "regex_internal.h"
#include "regex_internal.c"
#include "regex_internal.c"
#ifdef GAWK
#ifdef GAWK
#define bool int
# define bool int
#define true (1)
#define false (0)
# ifndef true
# define true (1)
# endif
# ifndef false
# define false (0)
# endif
#endif
#endif
#include "regcomp.c"
#include "regcomp.c"
#include "regexec.c"
#include "regexec.c"
...
...
src/buffer.h
View file @
5588f073
...
@@ -7,10 +7,11 @@
...
@@ -7,10 +7,11 @@
#ifndef INCLUDE_buffer_h__
#ifndef INCLUDE_buffer_h__
#define INCLUDE_buffer_h__
#define INCLUDE_buffer_h__
#include <stdarg.h>
#include "common.h"
#include "common.h"
#include "git2/strarray.h"
#include "git2/strarray.h"
#include "git2/buffer.h"
#include "git2/buffer.h"
#include <stdarg.h>
/* typedef struct {
/* typedef struct {
* char *ptr;
* char *ptr;
...
...
src/common.h
View file @
5588f073
...
@@ -42,6 +42,8 @@
...
@@ -42,6 +42,8 @@
# endif
# endif
#define GIT_STDLIB_CALL
#define GIT_STDLIB_CALL
# include <arpa/inet.h>
#endif
#endif
#include "git2/types.h"
#include "git2/types.h"
...
...
src/merge.c
View file @
5588f073
...
@@ -2306,8 +2306,8 @@ done:
...
@@ -2306,8 +2306,8 @@ done:
int
git_merge__indexes
(
git_repository
*
repo
,
git_index
*
index_new
)
int
git_merge__indexes
(
git_repository
*
repo
,
git_index
*
index_new
)
{
{
git_index
*
index_repo
;
git_index
*
index_repo
=
NULL
;
unsigned
int
index_repo_caps
;
unsigned
int
index_repo_caps
=
0
;
git_vector
paths
=
GIT_VECTOR_INIT
;
git_vector
paths
=
GIT_VECTOR_INIT
;
size_t
index_conflicts
=
0
,
wd_conflicts
=
0
,
conflicts
,
i
;
size_t
index_conflicts
=
0
,
wd_conflicts
=
0
,
conflicts
,
i
;
char
*
path
;
char
*
path
;
...
...
src/revert.c
View file @
5588f073
...
@@ -20,15 +20,12 @@
...
@@ -20,15 +20,12 @@
static
int
write_revert_head
(
static
int
write_revert_head
(
git_repository
*
repo
,
git_repository
*
repo
,
const
git_commit
*
commit
,
const
char
*
commit_oidstr
)
const
char
*
commit_oidstr
)
{
{
git_filebuf
file
=
GIT_FILEBUF_INIT
;
git_filebuf
file
=
GIT_FILEBUF_INIT
;
git_buf
file_path
=
GIT_BUF_INIT
;
git_buf
file_path
=
GIT_BUF_INIT
;
int
error
=
0
;
int
error
=
0
;
assert
(
repo
&&
commit
);
if
((
error
=
git_buf_joinpath
(
&
file_path
,
repo
->
path_repository
,
GIT_REVERT_HEAD_FILE
))
>=
0
&&
if
((
error
=
git_buf_joinpath
(
&
file_path
,
repo
->
path_repository
,
GIT_REVERT_HEAD_FILE
))
>=
0
&&
(
error
=
git_filebuf_open
(
&
file
,
file_path
.
ptr
,
GIT_FILEBUF_FORCE
,
GIT_REVERT_FILE_MODE
))
>=
0
&&
(
error
=
git_filebuf_open
(
&
file
,
file_path
.
ptr
,
GIT_FILEBUF_FORCE
,
GIT_REVERT_FILE_MODE
))
>=
0
&&
(
error
=
git_filebuf_printf
(
&
file
,
"%s
\n
"
,
commit_oidstr
))
>=
0
)
(
error
=
git_filebuf_printf
(
&
file
,
"%s
\n
"
,
commit_oidstr
))
>=
0
)
...
@@ -44,7 +41,6 @@ static int write_revert_head(
...
@@ -44,7 +41,6 @@ static int write_revert_head(
static
int
write_merge_msg
(
static
int
write_merge_msg
(
git_repository
*
repo
,
git_repository
*
repo
,
const
git_commit
*
commit
,
const
char
*
commit_oidstr
,
const
char
*
commit_oidstr
,
const
char
*
commit_msgline
)
const
char
*
commit_msgline
)
{
{
...
@@ -52,8 +48,6 @@ static int write_merge_msg(
...
@@ -52,8 +48,6 @@ static int write_merge_msg(
git_buf
file_path
=
GIT_BUF_INIT
;
git_buf
file_path
=
GIT_BUF_INIT
;
int
error
=
0
;
int
error
=
0
;
assert
(
repo
&&
commit
);
if
((
error
=
git_buf_joinpath
(
&
file_path
,
repo
->
path_repository
,
GIT_MERGE_MSG_FILE
))
<
0
||
if
((
error
=
git_buf_joinpath
(
&
file_path
,
repo
->
path_repository
,
GIT_MERGE_MSG_FILE
))
<
0
||
(
error
=
git_filebuf_open
(
&
file
,
file_path
.
ptr
,
GIT_FILEBUF_FORCE
,
GIT_REVERT_FILE_MODE
))
<
0
||
(
error
=
git_filebuf_open
(
&
file
,
file_path
.
ptr
,
GIT_FILEBUF_FORCE
,
GIT_REVERT_FILE_MODE
))
<
0
||
(
error
=
git_filebuf_printf
(
&
file
,
"Revert
\"
%s
\"\n\n
This reverts commit %s.
\n
"
,
(
error
=
git_filebuf_printf
(
&
file
,
"Revert
\"
%s
\"\n\n
This reverts commit %s.
\n
"
,
...
@@ -198,8 +192,8 @@ int git_revert(
...
@@ -198,8 +192,8 @@ int git_revert(
if
((
error
=
git_buf_printf
(
&
their_label
,
"parent of %.7s... %s"
,
commit_oidstr
,
commit_msg
))
<
0
||
if
((
error
=
git_buf_printf
(
&
their_label
,
"parent of %.7s... %s"
,
commit_oidstr
,
commit_msg
))
<
0
||
(
error
=
revert_normalize_opts
(
repo
,
&
opts
,
given_opts
,
git_buf_cstr
(
&
their_label
)))
<
0
||
(
error
=
revert_normalize_opts
(
repo
,
&
opts
,
given_opts
,
git_buf_cstr
(
&
their_label
)))
<
0
||
(
error
=
write_revert_head
(
repo
,
commit
,
commit
_oidstr
))
<
0
||
(
error
=
write_revert_head
(
repo
,
commit_oidstr
))
<
0
||
(
error
=
write_merge_msg
(
repo
,
commit
,
commit
_oidstr
,
commit_msg
))
<
0
||
(
error
=
write_merge_msg
(
repo
,
commit_oidstr
,
commit_msg
))
<
0
||
(
error
=
git_repository_head
(
&
our_ref
,
repo
))
<
0
||
(
error
=
git_repository_head
(
&
our_ref
,
repo
))
<
0
||
(
error
=
git_reference_peel
((
git_object
**
)
&
our_commit
,
our_ref
,
GIT_OBJ_COMMIT
))
<
0
||
(
error
=
git_reference_peel
((
git_object
**
)
&
our_commit
,
our_ref
,
GIT_OBJ_COMMIT
))
<
0
||
(
error
=
git_revert_commit
(
&
index_new
,
repo
,
commit
,
our_commit
,
opts
.
mainline
,
&
opts
.
merge_tree_opts
))
<
0
||
(
error
=
git_revert_commit
(
&
index_new
,
repo
,
commit
,
our_commit
,
opts
.
mainline
,
&
opts
.
merge_tree_opts
))
<
0
||
...
...
src/win32/precompiled.h
View file @
5588f073
#include "git2.h"
#include "common.h"
#include <assert.h>
#include <assert.h>
#include <errno.h>
#include <errno.h>
#include <limits.h>
#include <limits.h>
...
@@ -9,6 +6,7 @@
...
@@ -9,6 +6,7 @@
#include <string.h>
#include <string.h>
#include <fcntl.h>
#include <fcntl.h>
#include <time.h>
#include <time.h>
#include <stdarg.h>
#include <sys/types.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/stat.h>
...
@@ -20,3 +18,6 @@
...
@@ -20,3 +18,6 @@
#ifdef GIT_THREADS
#ifdef GIT_THREADS
#include "win32/pthread.h"
#include "win32/pthread.h"
#endif
#endif
#include "git2.h"
#include "common.h"
tests/blame/harder.c
View file @
5588f073
...
@@ -36,6 +36,8 @@ void test_blame_harder__m(void)
...
@@ -36,6 +36,8 @@ void test_blame_harder__m(void)
/* TODO */
/* TODO */
git_blame_options
opts
=
GIT_BLAME_OPTIONS_INIT
;
git_blame_options
opts
=
GIT_BLAME_OPTIONS_INIT
;
GIT_UNUSED
(
opts
);
opts
.
flags
=
GIT_BLAME_TRACK_COPIES_SAME_FILE
;
opts
.
flags
=
GIT_BLAME_TRACK_COPIES_SAME_FILE
;
}
}
...
@@ -44,6 +46,8 @@ void test_blame_harder__c(void)
...
@@ -44,6 +46,8 @@ void test_blame_harder__c(void)
{
{
git_blame_options
opts
=
GIT_BLAME_OPTIONS_INIT
;
git_blame_options
opts
=
GIT_BLAME_OPTIONS_INIT
;
GIT_UNUSED
(
opts
);
/* Attribute the first hunk in b.txt to (E), since it was cut/pasted from
/* Attribute the first hunk in b.txt to (E), since it was cut/pasted from
* a.txt in (D).
* a.txt in (D).
*/
*/
...
@@ -54,6 +58,8 @@ void test_blame_harder__cc(void)
...
@@ -54,6 +58,8 @@ void test_blame_harder__cc(void)
{
{
git_blame_options
opts
=
GIT_BLAME_OPTIONS_INIT
;
git_blame_options
opts
=
GIT_BLAME_OPTIONS_INIT
;
GIT_UNUSED
(
opts
);
/* Attribute the second hunk in b.txt to (E), since it was copy/pasted from
/* Attribute the second hunk in b.txt to (E), since it was copy/pasted from
* a.txt in (C).
* a.txt in (C).
*/
*/
...
@@ -63,6 +69,8 @@ void test_blame_harder__cc(void)
...
@@ -63,6 +69,8 @@ void test_blame_harder__cc(void)
void
test_blame_harder__ccc
(
void
)
void
test_blame_harder__ccc
(
void
)
{
{
git_blame_options
opts
=
GIT_BLAME_OPTIONS_INIT
;
git_blame_options
opts
=
GIT_BLAME_OPTIONS_INIT
;
GIT_UNUSED
(
opts
);
/* Attribute the third hunk in b.txt to (E). This hunk was deleted from
/* Attribute the third hunk in b.txt to (E). This hunk was deleted from
* a.txt in (D), but reintroduced in (B).
* a.txt in (D), but reintroduced in (B).
...
...
tests/merge/merge_helpers.c
View file @
5588f073
...
@@ -60,7 +60,6 @@ int merge_commits_from_branches(
...
@@ -60,7 +60,6 @@ int merge_commits_from_branches(
git_commit
*
our_commit
,
*
their_commit
;
git_commit
*
our_commit
,
*
their_commit
;
git_oid
our_oid
,
their_oid
;
git_oid
our_oid
,
their_oid
;
git_buf
branch_buf
=
GIT_BUF_INIT
;
git_buf
branch_buf
=
GIT_BUF_INIT
;
int
error
;
git_buf_printf
(
&
branch_buf
,
"%s%s"
,
GIT_REFS_HEADS_DIR
,
ours_name
);
git_buf_printf
(
&
branch_buf
,
"%s%s"
,
GIT_REFS_HEADS_DIR
,
ours_name
);
cl_git_pass
(
git_reference_name_to_id
(
&
our_oid
,
repo
,
branch_buf
.
ptr
));
cl_git_pass
(
git_reference_name_to_id
(
&
our_oid
,
repo
,
branch_buf
.
ptr
));
...
...
tests/merge/trees/commits.c
View file @
5588f073
...
@@ -29,28 +29,6 @@ void test_merge_trees_commits__cleanup(void)
...
@@ -29,28 +29,6 @@ void test_merge_trees_commits__cleanup(void)
cl_git_sandbox_cleanup
();
cl_git_sandbox_cleanup
();
}
}
static
void
merge_commits
(
git_index
**
out
,
git_repository
*
repo
,
const
char
*
our_oidstr
,
const
char
*
their_oidstr
,
const
git_merge_tree_opts
*
opts
)
{
git_oid
our_oid
,
their_oid
;
git_commit
*
our_commit
,
*
their_commit
;
cl_git_pass
(
git_oid_fromstr
(
&
our_oid
,
our_oidstr
));
cl_git_pass
(
git_oid_fromstr
(
&
their_oid
,
their_oidstr
));
cl_git_pass
(
git_commit_lookup
(
&
our_commit
,
repo
,
&
our_oid
));
cl_git_pass
(
git_commit_lookup
(
&
their_commit
,
repo
,
&
their_oid
));
cl_git_pass
(
git_merge_commits
(
out
,
repo
,
our_commit
,
their_commit
,
opts
));
git_commit_free
(
our_commit
);
git_commit_free
(
their_commit
);
}
void
test_merge_trees_commits__automerge
(
void
)
void
test_merge_trees_commits__automerge
(
void
)
{
{
git_index
*
index
;
git_index
*
index
;
...
...
tests/refs/branches/create.c
View file @
5588f073
...
@@ -73,4 +73,5 @@ void test_refs_branches_create__creating_a_branch_with_an_invalid_name_returns_E
...
@@ -73,4 +73,5 @@ void test_refs_branches_create__creating_a_branch_with_an_invalid_name_returns_E
cl_assert_equal_i
(
GIT_EINVALIDSPEC
,
cl_assert_equal_i
(
GIT_EINVALIDSPEC
,
git_branch_create
(
&
branch
,
repo
,
"inv@{id"
,
target
,
0
));
git_branch_create
(
&
branch
,
repo
,
"inv@{id"
,
target
,
0
));
}
}
\ No newline at end of file
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