summaryrefslogtreecommitdiff
path: root/builtin/remote.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin/remote.c')
-rw-r--r--builtin/remote.c40
1 files changed, 5 insertions, 35 deletions
diff --git a/builtin/remote.c b/builtin/remote.c
index ec9ec98..e4c3ea1 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -587,7 +587,6 @@ static int migrate_file(struct remote *remote)
{
struct strbuf buf = STRBUF_INIT;
int i;
- const char *path = NULL;
strbuf_addf(&buf, "remote.%s.url", remote->name);
for (i = 0; i < remote->url_nr; i++)
@@ -607,11 +606,9 @@ static int migrate_file(struct remote *remote)
return error(_("Could not append '%s' to '%s'"),
remote->fetch_refspec[i], buf.buf);
if (remote->origin == REMOTE_REMOTES)
- path = git_path("remotes/%s", remote->name);
+ unlink_or_warn(git_path("remotes/%s", remote->name));
else if (remote->origin == REMOTE_BRANCHES)
- path = git_path("branches/%s", remote->name);
- if (path)
- unlink_or_warn(path);
+ unlink_or_warn(git_path("branches/%s", remote->name));
return 0;
}
@@ -752,26 +749,6 @@ static int mv(int argc, const char **argv)
return 0;
}
-static int remove_branches(struct string_list *branches)
-{
- struct strbuf err = STRBUF_INIT;
- int i, result = 0;
-
- if (repack_without_refs(branches, &err))
- result |= error("%s", err.buf);
- strbuf_release(&err);
-
- for (i = 0; i < branches->nr; i++) {
- struct string_list_item *item = branches->items + i;
- const char *refname = item->string;
-
- if (delete_ref(refname, NULL, 0))
- result |= error(_("Could not remove branch %s"), refname);
- }
-
- return result;
-}
-
static int rm(int argc, const char **argv)
{
struct option options[] = {
@@ -828,7 +805,7 @@ static int rm(int argc, const char **argv)
strbuf_release(&buf);
if (!result)
- result = remove_branches(&branches);
+ result = delete_refs(&branches);
string_list_clear(&branches, 0);
if (skipped.nr) {
@@ -1340,19 +1317,12 @@ static int prune_remote(const char *remote, int dry_run)
string_list_append(&refs_to_prune, item->util);
string_list_sort(&refs_to_prune);
- if (!dry_run) {
- struct strbuf err = STRBUF_INIT;
- if (repack_without_refs(&refs_to_prune, &err))
- result |= error("%s", err.buf);
- strbuf_release(&err);
- }
+ if (!dry_run)
+ result |= delete_refs(&refs_to_prune);
for_each_string_list_item(item, &states.stale) {
const char *refname = item->util;
- if (!dry_run)
- result |= delete_ref(refname, NULL, 0);
-
if (dry_run)
printf_ln(_(" * [would prune] %s"),
abbrev_ref(refname, "refs/remotes/"));