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
f5385150
Commit
f5385150
authored
Jul 15, 2013
by
Vicent Martí
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1728 from ivoire/small_fixes
Small fixes
parents
3f8086e0
c6451624
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
23 additions
and
10 deletions
+23
-10
src/index.c
+9
-3
src/indexer.c
+1
-1
src/merge.c
+3
-1
src/odb.c
+1
-0
src/pack-objects.c
+3
-1
src/pack.c
+3
-1
src/repository.c
+3
-3
No files found.
src/index.c
View file @
f5385150
...
...
@@ -1409,14 +1409,18 @@ static int read_reuc(git_index *index, const char *buffer, size_t size)
if
(
git__strtol32
(
&
tmp
,
buffer
,
&
endptr
,
8
)
<
0
||
!
endptr
||
endptr
==
buffer
||
*
endptr
||
(
unsigned
)
tmp
>
UINT_MAX
)
(
unsigned
)
tmp
>
UINT_MAX
)
{
index_entry_reuc_free
(
lost
);
return
index_error_invalid
(
"reading reuc entry stage"
);
}
lost
->
mode
[
i
]
=
tmp
;
len
=
(
endptr
+
1
)
-
buffer
;
if
(
size
<=
len
)
if
(
size
<=
len
)
{
index_entry_reuc_free
(
lost
);
return
index_error_invalid
(
"reading reuc entry stage"
);
}
size
-=
len
;
buffer
+=
len
;
...
...
@@ -1426,8 +1430,10 @@ static int read_reuc(git_index *index, const char *buffer, size_t size)
for
(
i
=
0
;
i
<
3
;
i
++
)
{
if
(
!
lost
->
mode
[
i
])
continue
;
if
(
size
<
20
)
if
(
size
<
20
)
{
index_entry_reuc_free
(
lost
);
return
index_error_invalid
(
"reading reuc entry oid"
);
}
git_oid_fromraw
(
&
lost
->
oid
[
i
],
(
const
unsigned
char
*
)
buffer
);
size
-=
20
;
...
...
src/indexer.c
View file @
f5385150
...
...
@@ -325,7 +325,7 @@ static int hash_and_save(git_indexer_stream *idx, git_rawobj *obj, git_off_t ent
/* FIXME: Parse the object instead of hashing it */
if
(
git_odb__hashobj
(
&
oid
,
obj
)
<
0
)
{
giterr_set
(
GITERR_INDEXER
,
"Failed to hash object"
);
return
-
1
;
goto
on_error
;
}
pentry
=
git__calloc
(
1
,
sizeof
(
struct
git_pack_entry
));
...
...
src/merge.c
View file @
f5385150
...
...
@@ -1902,8 +1902,10 @@ static int write_merge_msg(
entries
=
git__calloc
(
heads_len
,
sizeof
(
struct
merge_msg_entry
));
GITERR_CHECK_ALLOC
(
entries
);
if
(
git_vector_init
(
&
matching
,
heads_len
,
NULL
)
<
0
)
if
(
git_vector_init
(
&
matching
,
heads_len
,
NULL
)
<
0
)
{
git__free
(
entries
);
return
-
1
;
}
for
(
i
=
0
;
i
<
heads_len
;
i
++
)
entries
[
i
].
merge_head
=
heads
[
i
];
...
...
src/odb.c
View file @
f5385150
...
...
@@ -232,6 +232,7 @@ int git_odb__hashlink(git_oid *out, const char *path)
link_data
[
size
]
=
'\0'
;
if
(
read_len
!=
(
ssize_t
)
size
)
{
giterr_set
(
GITERR_OS
,
"Failed to read symlink data for '%s'"
,
path
);
git__free
(
link_data
);
return
-
1
;
}
...
...
src/pack-objects.c
View file @
f5385150
...
...
@@ -505,8 +505,10 @@ static git_pobject **compute_write_order(git_packbuilder *pb)
/*
* Mark objects that are at the tip of tags.
*/
if
(
git_tag_foreach
(
pb
->
repo
,
&
cb_tag_foreach
,
pb
)
<
0
)
if
(
git_tag_foreach
(
pb
->
repo
,
&
cb_tag_foreach
,
pb
)
<
0
)
{
git__free
(
wo
);
return
NULL
;
}
/*
* Give the objects in the original recency order until
...
...
src/pack.c
View file @
f5385150
...
...
@@ -329,8 +329,10 @@ static int pack_index_open(struct git_pack_file *p)
memcpy
(
idx_name
,
p
->
pack_name
,
base_len
);
memcpy
(
idx_name
+
base_len
,
".idx"
,
sizeof
(
".idx"
));
if
((
error
=
git_mutex_lock
(
&
p
->
lock
))
<
0
)
if
((
error
=
git_mutex_lock
(
&
p
->
lock
))
<
0
)
{
git__free
(
idx_name
);
return
error
;
}
if
(
p
->
index_version
==
-
1
)
error
=
pack_index_check
(
idx_name
,
p
);
...
...
src/repository.c
View file @
f5385150
...
...
@@ -1500,12 +1500,12 @@ int git_repository_is_empty(git_repository *repo)
if
(
git_reference_lookup
(
&
head
,
repo
,
GIT_HEAD_FILE
)
<
0
)
return
-
1
;
if
(
!
(
error
=
git_reference_type
(
head
)
==
GIT_REF_SYMBOLIC
))
if
(
!
(
(
error
=
git_reference_type
(
head
)
)
==
GIT_REF_SYMBOLIC
))
goto
cleanup
;
if
(
!
(
error
=
strcmp
(
if
(
!
(
error
=
(
strcmp
(
git_reference_symbolic_target
(
head
),
GIT_REFS_HEADS_DIR
"master"
)
==
0
))
GIT_REFS_HEADS_DIR
"master"
)
==
0
))
)
goto
cleanup
;
error
=
repo_contains_no_reference
(
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