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
62dd6d16
Commit
62dd6d16
authored
Nov 06, 2011
by
Vicent Marti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reflog: Do not free references before time
parent
d4a0b124
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
10 deletions
+20
-10
src/reflog.c
+20
-10
No files found.
src/reflog.c
View file @
62dd6d16
...
...
@@ -215,27 +215,37 @@ int git_reflog_write(git_reference *ref, const git_oid *oid_old,
const
git_oid
*
oid
;
if
((
error
=
git_reference_resolve
(
&
r
,
ref
))
<
GIT_SUCCESS
)
return
git__rethrow
(
error
,
"Failed to write reflog. Cannot resolve reference `%s`"
,
ref
->
name
);
return
git__rethrow
(
error
,
"Failed to write reflog. Cannot resolve reference `%s`"
,
ref
->
name
);
oid
=
git_reference_oid
(
r
);
if
(
oid
==
NULL
)
{
git_reference_free
(
r
);
return
git__throw
(
GIT_ERROR
,
"Failed to write reflog. Cannot resolve reference `%s`"
,
r
->
name
);
return
git__throw
(
GIT_ERROR
,
"Failed to write reflog. Cannot resolve reference `%s`"
,
r
->
name
);
}
git_reference_free
(
r
);
git_oid_to_string
(
new
,
GIT_OID_HEXSZ
+
1
,
oid
);
git_path_join_n
(
log_path
,
3
,
ref
->
owner
->
path_repository
,
GIT_REFLOG_DIR
,
ref
->
name
);
git_path_join_n
(
log_path
,
3
,
ref
->
owner
->
path_repository
,
GIT_REFLOG_DIR
,
ref
->
name
);
git_reference_free
(
r
);
if
(
git_futils_exists
(
log_path
))
{
if
((
error
=
git_futils_mkpath2file
(
log_path
,
GIT_REFLOG_DIR_MODE
))
<
GIT_SUCCESS
)
return
git__rethrow
(
error
,
"Failed to write reflog. Cannot create reflog directory"
);
error
=
git_futils_mkpath2file
(
log_path
,
GIT_REFLOG_DIR_MODE
);
if
(
error
<
GIT_SUCCESS
)
return
git__rethrow
(
error
,
"Failed to write reflog. Cannot create reflog directory"
);
}
else
if
(
git_futils_isfile
(
log_path
))
{
return
git__throw
(
GIT_ERROR
,
"Failed to write reflog. `%s` is directory"
,
log_path
);
}
else
if
(
oid_old
==
NULL
)
return
git__throw
(
GIT_ERROR
,
"Failed to write reflog. Old OID cannot be NULL for existing reference"
);
return
git__throw
(
GIT_ERROR
,
"Failed to write reflog. `%s` is directory"
,
log_path
);
}
else
if
(
oid_old
==
NULL
)
{
return
git__throw
(
GIT_ERROR
,
"Failed to write reflog. Old OID cannot be NULL for existing reference"
);
}
if
(
oid_old
)
git_oid_to_string
(
old
,
GIT_OID_HEXSZ
+
1
,
oid_old
);
...
...
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