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
0f642f31
Commit
0f642f31
authored
Jun 06, 2017
by
Patrick Steinhardt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refs: properly report errors from `update_wt_heads`
parent
0c28c72d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
6 deletions
+16
-6
src/refs.c
+16
-6
No files found.
src/refs.c
View file @
0f642f31
...
...
@@ -622,15 +622,25 @@ typedef struct {
static
int
update_wt_heads
(
git_repository
*
repo
,
const
char
*
path
,
void
*
payload
)
{
rename_cb_data
*
data
=
(
rename_cb_data
*
)
payload
;
git_reference
*
head
;
git_reference
*
head
=
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
||
git_reference_type
(
head
)
!=
GIT_REF_SYMBOLIC
||
git__strcmp
(
head
->
target
.
symbolic
,
data
->
old_name
)
!=
0
||
(
gitdir
=
git_path_dirname
(
path
))
==
NULL
)
if
((
gitdir
=
git_path_dirname
(
path
))
==
NULL
)
{
error
=
-
1
;
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 */
if
((
error
=
git_repository_create_head
(
gitdir
,
data
->
new_name
))
<
0
)
{
...
...
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