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
2f6f6ebc
Commit
2f6f6ebc
authored
Jun 01, 2014
by
Vicent Marti
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2392 from libgit2/cmn/remote-delete
remote: build up the list of refs to remove
parents
9bc2813b
8a9419aa
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
7 deletions
+33
-7
src/remote.c
+33
-7
No files found.
src/remote.c
View file @
2f6f6ebc
...
...
@@ -1809,24 +1809,50 @@ static int remove_branch_config_related_entries(
return
error
;
}
static
int
remove_refs
(
git_repository
*
repo
,
const
char
*
glob
)
static
int
remove_refs
(
git_repository
*
repo
,
const
git_refspec
*
spec
)
{
git_reference_iterator
*
iter
;
git_reference_iterator
*
iter
=
NULL
;
git_vector
refs
;
const
char
*
name
;
char
*
dup
;
int
error
;
size_t
i
;
if
((
error
=
git_
reference_iterator_glob_new
(
&
iter
,
repo
,
glob
))
<
0
)
if
((
error
=
git_
vector_init
(
&
refs
,
8
,
NULL
))
<
0
)
return
error
;
if
((
error
=
git_reference_iterator_new
(
&
iter
,
repo
))
<
0
)
goto
cleanup
;
while
((
error
=
git_reference_next_name
(
&
name
,
iter
))
==
0
)
{
if
((
error
=
git_reference_remove
(
repo
,
name
))
<
0
)
break
;
if
(
!
git_refspec_dst_matches
(
spec
,
name
))
continue
;
dup
=
git__strdup
(
name
);
if
(
!
dup
)
{
error
=
-
1
;
goto
cleanup
;
}
git_reference_iterator_free
(
iter
);
if
((
error
=
git_vector_insert
(
&
refs
,
dup
))
<
0
)
goto
cleanup
;
}
if
(
error
==
GIT_ITEROVER
)
error
=
0
;
if
(
error
<
0
)
goto
cleanup
;
git_vector_foreach
(
&
refs
,
i
,
name
)
{
if
((
error
=
git_reference_remove
(
repo
,
name
))
<
0
)
break
;
}
cleanup:
git_reference_iterator_free
(
iter
);
git_vector_foreach
(
&
refs
,
i
,
dup
)
{
git__free
(
dup
);
}
git_vector_free
(
&
refs
);
return
error
;
}
...
...
@@ -1848,7 +1874,7 @@ static int remove_remote_tracking(git_repository *repo, const char *remote_name)
if
(
refspec
==
NULL
)
continue
;
if
((
error
=
remove_refs
(
repo
,
git_refspec_dst
(
refspec
)
))
<
0
)
if
((
error
=
remove_refs
(
repo
,
refspec
))
<
0
)
break
;
}
...
...
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