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
90500d81
Commit
90500d81
authored
Jun 08, 2017
by
Edward Thomson
Committed by
GitHub
Jun 08, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4253 from pks-t/pks/cov-fixes
Coverity fixes
parents
3a8801ae
90388aa8
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
15 deletions
+31
-15
src/fileops.c
+6
-2
src/path.c
+5
-4
src/refdb_fs.c
+3
-2
src/refs.c
+16
-6
src/worktree.c
+1
-1
No files found.
src/fileops.c
View file @
90500d81
...
@@ -1155,9 +1155,13 @@ int git_futils_fsync_dir(const char *path)
...
@@ -1155,9 +1155,13 @@ int git_futils_fsync_dir(const char *path)
int
git_futils_fsync_parent
(
const
char
*
path
)
int
git_futils_fsync_parent
(
const
char
*
path
)
{
{
char
*
parent
=
git_path_dirname
(
path
);
char
*
parent
;
int
error
=
git_futils_fsync_dir
(
parent
);
int
error
;
if
((
parent
=
git_path_dirname
(
path
))
==
NULL
)
return
-
1
;
error
=
git_futils_fsync_dir
(
parent
);
git__free
(
parent
);
git__free
(
parent
);
return
error
;
return
error
;
}
}
src/path.c
View file @
90500d81
...
@@ -1708,6 +1708,7 @@ GIT_INLINE(unsigned int) dotgit_flags(
...
@@ -1708,6 +1708,7 @@ GIT_INLINE(unsigned int) dotgit_flags(
unsigned
int
flags
)
unsigned
int
flags
)
{
{
int
protectHFS
=
0
,
protectNTFS
=
0
;
int
protectHFS
=
0
,
protectNTFS
=
0
;
int
error
=
0
;
flags
|=
GIT_PATH_REJECT_DOT_GIT_LITERAL
;
flags
|=
GIT_PATH_REJECT_DOT_GIT_LITERAL
;
...
@@ -1720,13 +1721,13 @@ GIT_INLINE(unsigned int) dotgit_flags(
...
@@ -1720,13 +1721,13 @@ GIT_INLINE(unsigned int) dotgit_flags(
#endif
#endif
if
(
repo
&&
!
protectHFS
)
if
(
repo
&&
!
protectHFS
)
git_repository__cvar
(
&
protectHFS
,
repo
,
GIT_CVAR_PROTECTHFS
);
error
=
git_repository__cvar
(
&
protectHFS
,
repo
,
GIT_CVAR_PROTECTHFS
);
if
(
protectHFS
)
if
(
!
error
&&
protectHFS
)
flags
|=
GIT_PATH_REJECT_DOT_GIT_HFS
;
flags
|=
GIT_PATH_REJECT_DOT_GIT_HFS
;
if
(
repo
&&
!
protectNTFS
)
if
(
repo
&&
!
protectNTFS
)
git_repository__cvar
(
&
protectNTFS
,
repo
,
GIT_CVAR_PROTECTNTFS
);
error
=
git_repository__cvar
(
&
protectNTFS
,
repo
,
GIT_CVAR_PROTECTNTFS
);
if
(
protectNTFS
)
if
(
!
error
&&
protectNTFS
)
flags
|=
GIT_PATH_REJECT_DOT_GIT_NTFS
;
flags
|=
GIT_PATH_REJECT_DOT_GIT_NTFS
;
return
flags
;
return
flags
;
...
...
src/refdb_fs.c
View file @
90500d81
...
@@ -1140,7 +1140,7 @@ out:
...
@@ -1140,7 +1140,7 @@ out:
static
int
maybe_append_head
(
refdb_fs_backend
*
backend
,
const
git_reference
*
ref
,
const
git_signature
*
who
,
const
char
*
message
)
static
int
maybe_append_head
(
refdb_fs_backend
*
backend
,
const
git_reference
*
ref
,
const
git_signature
*
who
,
const
char
*
message
)
{
{
int
error
;
int
error
;
git_oid
old_id
=
{{
0
}}
;
git_oid
old_id
;
git_reference
*
tmp
=
NULL
,
*
head
=
NULL
,
*
peeled
=
NULL
;
git_reference
*
tmp
=
NULL
,
*
head
=
NULL
,
*
peeled
=
NULL
;
const
char
*
name
;
const
char
*
name
;
...
@@ -1148,7 +1148,8 @@ static int maybe_append_head(refdb_fs_backend *backend, const git_reference *ref
...
@@ -1148,7 +1148,8 @@ static int maybe_append_head(refdb_fs_backend *backend, const git_reference *ref
return
0
;
return
0
;
/* if we can't resolve, we use {0}*40 as old id */
/* if we can't resolve, we use {0}*40 as old id */
git_reference_name_to_id
(
&
old_id
,
backend
->
repo
,
ref
->
name
);
if
(
git_reference_name_to_id
(
&
old_id
,
backend
->
repo
,
ref
->
name
)
<
0
)
memset
(
&
old_id
,
0
,
sizeof
(
old_id
));
if
((
error
=
git_reference_lookup
(
&
head
,
backend
->
repo
,
GIT_HEAD_FILE
))
<
0
)
if
((
error
=
git_reference_lookup
(
&
head
,
backend
->
repo
,
GIT_HEAD_FILE
))
<
0
)
return
error
;
return
error
;
...
...
src/refs.c
View file @
90500d81
...
@@ -622,15 +622,25 @@ typedef struct {
...
@@ -622,15 +622,25 @@ typedef struct {
static
int
update_wt_heads
(
git_repository
*
repo
,
const
char
*
path
,
void
*
payload
)
static
int
update_wt_heads
(
git_repository
*
repo
,
const
char
*
path
,
void
*
payload
)
{
{
rename_cb_data
*
data
=
(
rename_cb_data
*
)
payload
;
rename_cb_data
*
data
=
(
rename_cb_data
*
)
payload
;
git_reference
*
head
;
git_reference
*
head
=
NULL
;
char
*
gitdir
=
NULL
;
char
*
gitdir
=
NULL
;
int
error
=
0
;
int
error
;
if
((
error
=
git_reference__read_head
(
&
head
,
repo
,
path
))
<
0
)
{
giterr_set
(
GITERR_REFERENCE
,
"could not read HEAD when renaming references"
);
goto
out
;
}
if
(
git_reference__read_head
(
&
head
,
repo
,
path
)
<
0
||
if
((
gitdir
=
git_path_dirname
(
path
))
==
NULL
)
{
git_reference_type
(
head
)
!=
GIT_REF_SYMBOLIC
||
error
=
-
1
;
git__strcmp
(
head
->
target
.
symbolic
,
data
->
old_name
)
!=
0
||
(
gitdir
=
git_path_dirname
(
path
))
==
NULL
)
goto
out
;
goto
out
;
}
if
(
git_reference_type
(
head
)
!=
GIT_REF_SYMBOLIC
||
git__strcmp
(
head
->
target
.
symbolic
,
data
->
old_name
)
!=
0
)
{
error
=
0
;
goto
out
;
}
/* Update HEAD it was pointing to the reference being renamed */
/* Update HEAD it was pointing to the reference being renamed */
if
((
error
=
git_repository_create_head
(
gitdir
,
data
->
new_name
))
<
0
)
{
if
((
error
=
git_repository_create_head
(
gitdir
,
data
->
new_name
))
<
0
)
{
...
...
src/worktree.c
View file @
90500d81
...
@@ -212,7 +212,7 @@ int git_worktree_open_from_repository(git_worktree **out, git_repository *repo)
...
@@ -212,7 +212,7 @@ int git_worktree_open_from_repository(git_worktree **out, git_repository *repo)
goto
out
;
goto
out
;
out:
out:
free
(
name
);
git__
free
(
name
);
git_buf_free
(
&
parent
);
git_buf_free
(
&
parent
);
return
error
;
return
error
;
...
...
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