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
f6328611
Commit
f6328611
authored
May 23, 2011
by
Vicent Marti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
filebuf: Reword errors
parent
374db5f9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
10 deletions
+8
-10
src/filebuf.c
+8
-10
No files found.
src/filebuf.c
View file @
f6328611
...
@@ -179,7 +179,7 @@ int git_filebuf_open(git_filebuf *file, const char *path, int flags)
...
@@ -179,7 +179,7 @@ int git_filebuf_open(git_filebuf *file, const char *path, int flags)
/* Initialize the ZLib stream */
/* Initialize the ZLib stream */
if
(
deflateInit
(
&
file
->
zs
,
Z_BEST_SPEED
)
!=
Z_OK
)
{
if
(
deflateInit
(
&
file
->
zs
,
Z_BEST_SPEED
)
!=
Z_OK
)
{
error
=
GIT_EZLIB
;
error
=
git__throw
(
GIT_EZLIB
,
"Failed to initialize zlib"
)
;
goto
cleanup
;
goto
cleanup
;
}
}
...
@@ -245,15 +245,14 @@ int git_filebuf_open(git_filebuf *file, const char *path, int flags)
...
@@ -245,15 +245,14 @@ int git_filebuf_open(git_filebuf *file, const char *path, int flags)
cleanup
:
cleanup
:
git_filebuf_cleanup
(
file
);
git_filebuf_cleanup
(
file
);
return
git__rethrow
(
error
,
"Failed to open file
"
);
return
git__rethrow
(
error
,
"Failed to open file
buffer for '%s'"
,
path
);
}
}
int
git_filebuf_hash
(
git_oid
*
oid
,
git_filebuf
*
file
)
int
git_filebuf_hash
(
git_oid
*
oid
,
git_filebuf
*
file
)
{
{
int
error
;
int
error
;
if
(
file
->
digest
==
NULL
)
assert
(
oid
&&
file
&&
file
->
digest
);
return
git__throw
(
GIT_ERROR
,
"Failed to get hash for file. File has no digest"
);
if
((
error
=
flush_buffer
(
file
))
<
GIT_SUCCESS
)
if
((
error
=
flush_buffer
(
file
))
<
GIT_SUCCESS
)
return
git__rethrow
(
error
,
"Failed to get hash for file"
);
return
git__rethrow
(
error
,
"Failed to get hash for file"
);
...
@@ -279,9 +278,8 @@ int git_filebuf_commit(git_filebuf *file)
...
@@ -279,9 +278,8 @@ int git_filebuf_commit(git_filebuf *file)
{
{
int
error
;
int
error
;
/* tmp file cannot be commited */
/* temporary files cannot be committed */
if
(
file
->
path_original
==
NULL
)
assert
(
file
&&
file
->
path_original
);
return
git__throw
(
GIT_EOSERR
,
"Failed to commit from buffer. File path does not exist"
);
file
->
flush_mode
=
Z_FINISH
;
file
->
flush_mode
=
Z_FINISH
;
if
((
error
=
flush_buffer
(
file
))
<
GIT_SUCCESS
)
if
((
error
=
flush_buffer
(
file
))
<
GIT_SUCCESS
)
...
@@ -295,8 +293,8 @@ int git_filebuf_commit(git_filebuf *file)
...
@@ -295,8 +293,8 @@ int git_filebuf_commit(git_filebuf *file)
cleanup
:
cleanup
:
git_filebuf_cleanup
(
file
);
git_filebuf_cleanup
(
file
);
if
(
error
<
GIT_SUCCESS
)
if
(
error
<
GIT_SUCCESS
)
return
git__rethrow
(
error
,
"Failed to commit from buffer"
);
return
git__rethrow
(
error
,
"Failed to commit
locked file
from buffer"
);
return
error
;
return
GIT_SUCCESS
;
}
}
GIT_INLINE
(
void
)
add_to_cache
(
git_filebuf
*
file
,
const
void
*
buf
,
size_t
len
)
GIT_INLINE
(
void
)
add_to_cache
(
git_filebuf
*
file
,
const
void
*
buf
,
size_t
len
)
...
@@ -372,7 +370,7 @@ int git_filebuf_printf(git_filebuf *file, const char *format, ...)
...
@@ -372,7 +370,7 @@ int git_filebuf_printf(git_filebuf *file, const char *format, ...)
if
(
len
<
0
||
(
size_t
)
len
>=
space_left
)
{
if
(
len
<
0
||
(
size_t
)
len
>=
space_left
)
{
if
((
error
=
flush_buffer
(
file
))
<
GIT_SUCCESS
)
if
((
error
=
flush_buffer
(
file
))
<
GIT_SUCCESS
)
return
git__rethrow
(
error
,
"Failed to
prin
t to buffer"
);
return
git__rethrow
(
error
,
"Failed to
outpu
t to buffer"
);
len
=
vsnprintf
((
char
*
)
file
->
buffer
+
file
->
buf_pos
,
space_left
,
format
,
arglist
);
len
=
vsnprintf
((
char
*
)
file
->
buffer
+
file
->
buf_pos
,
space_left
,
format
,
arglist
);
if
(
len
<
0
||
(
size_t
)
len
>
file
->
buf_size
)
if
(
len
<
0
||
(
size_t
)
len
>
file
->
buf_size
)
...
...
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