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
0d5d5190
Commit
0d5d5190
authored
May 23, 2011
by
Vicent Marti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refs: Reword errors
parent
5bdf7b9f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
12 deletions
+9
-12
src/refs.c
+9
-12
No files found.
src/refs.c
View file @
0d5d5190
...
@@ -1489,16 +1489,15 @@ int git_reference_resolve(git_reference **resolved_ref, git_reference *ref)
...
@@ -1489,16 +1489,15 @@ int git_reference_resolve(git_reference **resolved_ref, git_reference *ref)
*
resolved_ref
=
ref
;
*
resolved_ref
=
ref
;
if
(
ref
->
type
&
GIT_REF_OID
)
{
if
(
ref
->
type
&
GIT_REF_OID
)
return
GIT_SUCCESS
;
return
GIT_SUCCESS
;
}
ref_sym
=
(
reference_symbolic
*
)
ref
;
ref_sym
=
(
reference_symbolic
*
)
ref
;
if
((
error
=
git_reference_lookup
(
&
ref
,
repo
,
ref_sym
->
target
))
<
GIT_SUCCESS
)
if
((
error
=
git_reference_lookup
(
&
ref
,
repo
,
ref_sym
->
target
))
<
GIT_SUCCESS
)
return
git__rethrow
(
error
,
"Failed to resolve reference"
)
;
return
error
;
}
}
return
git__throw
(
GIT_E
TOONESTEDSYMREF
,
"Failed to resolve reference. Reference is too nested"
);
return
git__throw
(
GIT_E
NOMEM
,
"Failed to resolve reference. Reference is too nested"
);
}
}
int
git_reference_packall
(
git_repository
*
repo
)
int
git_reference_packall
(
git_repository
*
repo
)
...
@@ -1533,7 +1532,7 @@ int git_reference_listcb(git_repository *repo, unsigned int list_flags, int (*ca
...
@@ -1533,7 +1532,7 @@ int git_reference_listcb(git_repository *repo, unsigned int list_flags, int (*ca
GIT_HASHTABLE_FOREACH
(
repo
->
references
.
packfile
,
ref_name
,
_unused
,
GIT_HASHTABLE_FOREACH
(
repo
->
references
.
packfile
,
ref_name
,
_unused
,
if
((
error
=
callback
(
ref_name
,
payload
))
<
GIT_SUCCESS
)
if
((
error
=
callback
(
ref_name
,
payload
))
<
GIT_SUCCESS
)
return
git__
rethrow
(
error
,
"Failed to list references
"
);
return
git__
throw
(
error
,
"Failed to list references. User callback failed
"
);
);
);
}
}
...
@@ -1573,7 +1572,7 @@ int git_reference_listall(git_strarray *array, git_repository *repo, unsigned in
...
@@ -1573,7 +1572,7 @@ int git_reference_listall(git_strarray *array, git_repository *repo, unsigned in
if
(
error
<
GIT_SUCCESS
)
{
if
(
error
<
GIT_SUCCESS
)
{
git_vector_free
(
&
ref_list
);
git_vector_free
(
&
ref_list
);
return
git__rethrow
(
error
,
"Failed to list references"
)
;
return
error
;
}
}
array
->
strings
=
(
char
**
)
ref_list
.
contents
;
array
->
strings
=
(
char
**
)
ref_list
.
contents
;
...
@@ -1632,7 +1631,7 @@ void git_repository__refcache_free(git_refcache *refs)
...
@@ -1632,7 +1631,7 @@ void git_repository__refcache_free(git_refcache *refs)
static
int
check_valid_ref_char
(
char
ch
)
static
int
check_valid_ref_char
(
char
ch
)
{
{
if
(
ch
<=
' '
)
if
(
ch
<=
' '
)
return
git__throw
(
GIT_ERROR
,
"Not a valid reference char"
)
;
return
GIT_ERROR
;
switch
(
ch
)
{
switch
(
ch
)
{
case
'~'
:
case
'~'
:
...
@@ -1642,7 +1641,7 @@ static int check_valid_ref_char(char ch)
...
@@ -1642,7 +1641,7 @@ static int check_valid_ref_char(char ch)
case
'?'
:
case
'?'
:
case
'['
:
case
'['
:
case
'*'
:
case
'*'
:
return
git__throw
(
GIT_ERROR
,
"Not a valid reference char"
)
;
return
GIT_ERROR
;
break
;
break
;
default:
default:
...
@@ -1652,7 +1651,6 @@ static int check_valid_ref_char(char ch)
...
@@ -1652,7 +1651,6 @@ static int check_valid_ref_char(char ch)
static
int
normalize_name
(
char
*
buffer_out
,
const
char
*
name
,
int
is_oid_ref
)
static
int
normalize_name
(
char
*
buffer_out
,
const
char
*
name
,
int
is_oid_ref
)
{
{
int
error
=
GIT_SUCCESS
;
const
char
*
name_end
,
*
buffer_out_start
;
const
char
*
name_end
,
*
buffer_out_start
;
char
*
current
;
char
*
current
;
int
contains_a_slash
=
0
;
int
contains_a_slash
=
0
;
...
@@ -1715,12 +1713,11 @@ static int normalize_name(char *buffer_out, const char *name, int is_oid_ref)
...
@@ -1715,12 +1713,11 @@ static int normalize_name(char *buffer_out, const char *name, int is_oid_ref)
* For object id references, name has to start with refs/. Again,
* For object id references, name has to start with refs/. Again,
* we need to allow HEAD to be in a detached state.
* we need to allow HEAD to be in a detached state.
*/
*/
if
(
is_oid_ref
&&
if
(
is_oid_ref
&&
!
(
git__prefixcmp
(
buffer_out_start
,
GIT_REFS_DIR
)
||
!
(
git__prefixcmp
(
buffer_out_start
,
GIT_REFS_DIR
)
||
strcmp
(
buffer_out_start
,
GIT_HEAD_FILE
)))
strcmp
(
buffer_out_start
,
GIT_HEAD_FILE
)))
return
git__throw
(
GIT_EINVALIDREFNAME
,
"Failed to normalize name. Reference name does not start with 'refs/'"
);
return
git__throw
(
GIT_EINVALIDREFNAME
,
"Failed to normalize name. Reference name does not start with 'refs/'"
);
return
error
==
GIT_SUCCESS
?
GIT_SUCCESS
:
git__rethrow
(
error
,
"Failed to normalize name"
)
;
return
GIT_SUCCESS
;
}
}
int
git_reference__normalize_name
(
char
*
buffer_out
,
const
char
*
name
)
int
git_reference__normalize_name
(
char
*
buffer_out
,
const
char
*
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