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
129007b4
Commit
129007b4
authored
Mar 03, 2011
by
nulltoken
Committed by
Vicent Marti
Mar 03, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix refs renaming to prevent renaming with an invalid name
parent
65cc1f44
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletions
+6
-1
src/refs.c
+6
-1
No files found.
src/refs.c
View file @
129007b4
...
@@ -1123,11 +1123,16 @@ int git_reference_rename(git_reference *ref, const char *new_name)
...
@@ -1123,11 +1123,16 @@ int git_reference_rename(git_reference *ref, const char *new_name)
{
{
int
error
;
int
error
;
char
*
old_name
;
char
*
old_name
;
char
old_path
[
GIT_PATH_MAX
],
new_path
[
GIT_PATH_MAX
];
char
old_path
[
GIT_PATH_MAX
],
new_path
[
GIT_PATH_MAX
]
,
normalized_name
[
MAX_GITDIR_TREE_STRUCTURE_PATH_LENGTH
]
;
git_reference
*
looked_up_ref
;
git_reference
*
looked_up_ref
;
assert
(
ref
);
assert
(
ref
);
/* Ensure the name is valid */
error
=
normalize_name
(
normalized_name
,
new_name
,
ref
->
type
&
GIT_REF_OID
);
if
(
error
<
GIT_SUCCESS
)
return
error
;
/* Ensure we're not going to overwrite an existing reference */
/* Ensure we're not going to overwrite an existing reference */
error
=
git_repository_lookup_ref
(
&
looked_up_ref
,
ref
->
owner
,
new_name
);
error
=
git_repository_lookup_ref
(
&
looked_up_ref
,
ref
->
owner
,
new_name
);
if
(
error
==
GIT_SUCCESS
)
if
(
error
==
GIT_SUCCESS
)
...
...
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