From ed43de6ec35dfd4c4bd33ae9b5f2ebe38282209f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Sat, 15 Oct 2011 07:04:25 +0200 Subject: fetch: honor the user-provided refspecs when pruning refs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 ref under the origin namespace because we were using the refspec to filter the available refs but using the configured refspec to figure out if a ref had been deleted on the remote. This is clearly the wrong thing to do. Change prune_refs and get_stale_heads to simply accept a list of references and a list of refspecs. The caller of either function needs to decide what refspecs should be used to decide whether a ref is stale. Signed-off-by: Carlos Martín Nieto Signed-off-by: Junio C Hamano --- remote.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'remote.h') diff --git a/remote.h b/remote.h index 9a30a9dba6..f2541b5a29 100644 --- a/remote.h +++ b/remote.h @@ -164,6 +164,6 @@ struct ref *guess_remote_head(const struct ref *head, int all); /* Return refs which no longer exist on remote */ -struct ref *get_stale_heads(struct remote *remote, struct ref *fetch_map); +struct ref *get_stale_heads(struct refspec *refs, int ref_count, struct ref *fetch_map); #endif -- cgit v1.2.3