diff options
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | 2008-02-29 01:46:07 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-03-01 01:51:44 -0800 |
commit | 4ebc914c880cf724222a6e5097a21a85ed8e5951 (patch) | |
tree | 7ff3b0a40b5fb1fd9904dc0b0a354c7cb57dfc59 /builtin-remote.c | |
parent | 211c89682eeef310f39022b91e88d07cd5784953 (diff) | |
download | git-4ebc914c880cf724222a6e5097a21a85ed8e5951.tar.gz git-4ebc914c880cf724222a6e5097a21a85ed8e5951.tar.xz |
builtin-remote: prune remotes correctly that were added with --mirror
This adds special handling for mirror remotes.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-remote.c')
-rw-r--r-- | builtin-remote.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/builtin-remote.c b/builtin-remote.c index 25b02275d..d0c07c7a0 100644 --- a/builtin-remote.c +++ b/builtin-remote.c @@ -396,12 +396,22 @@ static int show_or_prune(int argc, const char **argv, int prune) if (prune) { struct strbuf buf; + int prefix_len; strbuf_init(&buf, 0); + if (states.remote->fetch_refspec_nr == 1 && + states.remote->fetch->pattern && + !strcmp(states.remote->fetch->src, + states.remote->fetch->dst)) + /* handle --mirror remote */ + strbuf_addstr(&buf, "refs/heads/"); + else + strbuf_addf(&buf, "refs/remotes/%s/", *argv); + prefix_len = buf.len; + for (i = 0; i < states.stale.nr; i++) { - strbuf_reset(&buf); - strbuf_addf(&buf, "refs/remotes/%s/%s", *argv, - states.stale.items[i].path); + strbuf_setlen(&buf, prefix_len); + strbuf_addstr(&buf, states.stale.items[i].path); result |= delete_ref(buf.buf, NULL); } |