On Thu, Oct 06, 2011 at 11:21:46PM +0200, Carlos Martín Nieto wrote: > If the user gave us refspecs on the command line, we should use those > when deciding whether to prune a ref instead of relying on the > refspecs in the config. > > Previously, running > > git fetch --prune origin refs/heads/master:refs/remotes/origin/master > > would delete every other tag under the origin namespace because we I assume you mean s/tag/branch/ in the last line? > --- > builtin/fetch.c | 6 ++-- > builtin/remote.c | 2 +- > remote.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++++----- > remote.h | 3 +- > 4 files changed, 77 insertions(+), 12 deletions(-) Tests? > static int get_stale_heads_cb(const char *refname, > const unsigned char *sha1, int flags, void *cb_data) > { > struct stale_heads_info *info = cb_data; > struct refspec refspec; > + int ret; > memset(&refspec, 0, sizeof(refspec)); > refspec.dst = (char *)refname; > - if (!remote_find_tracking(info->remote, &refspec)) { > - if (!((flags & REF_ISSYMREF) || > - string_list_has_string(info->ref_names, refspec.src))) { > - struct ref *ref = make_linked_ref(refname, &info->stale_refs_tail); > - hashcpy(ref->new_sha1, sha1); > - } > + > + /* > + * If the user speicified refspecs on the command line, we > + * should only use those to check. Otherwise, look in the > + * remote's configuration for the branch. > + */ > + if (info->ref_count) > + ret = find_in_refs(info->refs, info->ref_count, &refspec); > + else > + ret = remote_find_tracking(info->remote, &refspec); Minor typo in the comment. But more importantly, this feels like a very low-level place to be thinking about things like what the user gave us on the command line. Shouldn't get_stale_heads not get a remote at all, and just get a set of refspecs? Those should be the minimal information it needs to get its answer, right? -Peff -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html