git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Restore ls-remote reference pattern matching
@ 2007-12-09  2:35 Daniel Barkalow
  2007-12-09  3:22 ` Junio C Hamano
  0 siblings, 1 reply; 10+ messages in thread
From: Daniel Barkalow @ 2007-12-09  2:35 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Eyvind Bernhardsen

I entirely missed that "git ls-remote <repo> <ref-pattern>..." is
supposed to work. This restores it.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
---
How's this? I vaguely tested it, and it doesn't break existing tests, and 
it matches my guess at how the old code worked, at least maybe.

 builtin-ls-remote.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/builtin-ls-remote.c b/builtin-ls-remote.c
index 56f3f88..f8669ce 100644
--- a/builtin-ls-remote.c
+++ b/builtin-ls-remote.c
@@ -17,6 +17,7 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
 	struct remote *remote;
 	struct transport *transport;
 	const struct ref *ref;
+	const char **refpathspec = NULL;
 
 	setup_git_directory_gently(&nongit);
 
@@ -50,9 +51,12 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
 		break;
 	}
 
-	if (!dest || i != argc - 1)
+	if (!dest)
 		usage(ls_remote_usage);
 
+	if (argc > i + 1)
+		refpathspec = get_pathspec("*", argv + i);
+
 	remote = nongit ? NULL : remote_get(dest);
 	if (remote && !remote->url_nr)
 		die("remote %s has no configured URL", dest);
@@ -66,7 +70,9 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
 		return 1;
 
 	while (ref) {
-		if (check_ref_type(ref, flags))
+		if (check_ref_type(ref, flags) && 
+		    (!refpathspec || 
+		     pathspec_match(refpathspec, NULL, ref->name, 0)))
 			printf("%s	%s\n", sha1_to_hex(ref->old_sha1), ref->name);
 		ref = ref->next;
 	}
-- 
1.5.3.6.886.gb204

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2007-12-10  9:56 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-09  2:35 [PATCH] Restore ls-remote reference pattern matching Daniel Barkalow
2007-12-09  3:22 ` Junio C Hamano
2007-12-09  5:16   ` Daniel Barkalow
2007-12-09  6:51     ` Junio C Hamano
2007-12-09 13:26       ` Sergey Vlasov
2007-12-09 15:31         ` Eyvind Bernhardsen
2007-12-09 18:15         ` Junio C Hamano
2007-12-09 20:26         ` Junio C Hamano
2007-12-10  9:16           ` Eyvind Bernhardsen
2007-12-10  9:56             ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).