git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 10/21] remote: make match_refs() not short-circuit

From
Jay Soffian <jaysoffian@gmail.com>
Date
Feb 25, 2009, 08:32 UTC
Message-ID
<6a24ea1542d8a1ec750005a710f40e0730db1aa4.1235546708.git.jaysoffian@gmail.com>
In-Reply-To
<cover.1235546707.git.jaysoffian@gmail.com>

match_refs() returns non-zero if there is an error in match_explicit_refs(), without handling any remaining pattern ref specs.

Its existing callers exit upon receiving non-zero, so a partial result is of no consequence to them; however a new caller, builtin-remote, is interested in the complete result even if there are errors in match_explicit_refs().

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
---
 remote.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/remote.c b/remote.c
index 81def8b..926f842 100644
--- a/remote.c
+++ b/remote.c
@@ -1044,6 +1044,7 @@ int match_refs(struct ref *src, struct ref *dst, struct ref ***dst_tail,
 	struct refspec *rs;
 	int send_all = flags & MATCH_REFS_ALL;
 	int send_mirror = flags & MATCH_REFS_MIRROR;
+	int errs;
 	static const char *default_refspec[] = { ":", 0 };
 
 	if (!nr_refspec) {
@@ -1051,8 +1052,7 @@ int match_refs(struct ref *src, struct ref *dst, struct ref ***dst_tail,
 		refspec = default_refspec;
 	}
 	rs = parse_push_refspec(nr_refspec, (const char **) refspec);
-	if (match_explicit_refs(src, dst, dst_tail, rs, nr_refspec))
-		return -1;
+	errs = match_explicit_refs(src, dst, dst_tail, rs, nr_refspec);
 
 	/* pick the remainder */
 	for ( ; src; src = src->next) {
@@ -1108,6 +1108,8 @@ int match_refs(struct ref *src, struct ref *dst, struct ref ***dst_tail,
 	free_name:
 		free(dst_name);
 	}
+	if (errs)
+		return -1;
 	return 0;
 }
 
-- 
1.6.2.rc1.291.g83eb
Previous: Jay SoffianNext: Jay Soffian
Message 15 of 28 in “git remote: set-head and new show output”
  1. 00/21 git remote: set-head and new show outputJay Soffian, Feb 25, 2009
  2. 01/21 test scripts: refactor start_httpd helperJay Soffian, Feb 25, 2009
  3. 02/21 add basic http clone/fetch testsJay Soffian, Feb 25, 2009
  4. 03/21 refactor find_ref_by_name() to accept const listJay Soffian, Feb 25, 2009
  5. 04/21 move duplicated get_local_heads() to remote.cJay Soffian, Feb 25, 2009
  6. 05/21 move duplicated ref_newer() to remote.cJay Soffian, Feb 25, 2009
  7. 06/21 move locate_head() to remote.cJay Soffian, Feb 25, 2009
  8. 07/21 remote: simplify guess_remote_head()Jay Soffian, Feb 25, 2009
  9. 08/21 remote: let guess_remote_head() optionally return all matchesJay Soffian, Feb 25, 2009
  10. Jeff KingFeb 26, 2009
  11. Jeff KingFeb 26, 2009
  12. Jay SoffianFeb 26, 2009
  13. Jeff KingFeb 27, 2009
  14. 09/21 remote: make match_refs() copy src ref before assigning to peer_refJay Soffian, Feb 25, 2009
  15. 10/21 remote: make match_refs() not short-circuitJay Soffian, Feb 25, 2009
  16. 11/21 string-list: new for_each_string_list() functionJay Soffian, Feb 25, 2009
  17. 12/21 builtin-remote: refactor duplicated cleanup codeJay Soffian, Feb 25, 2009
  18. 13/21 builtin-remote: remove unused code in get_ref_statesJay Soffian, Feb 25, 2009
  19. 14/21 builtin-remote: rename variables and eliminate redundant function callJay Soffian, Feb 25, 2009
  20. 15/21 builtin-remote: make get_remote_ref_states() always populate states.trackedJay Soffian, Feb 25, 2009
  21. 16/21 builtin-remote: fix two inconsistencies in the output of "show <remote>"Jay Soffian, Feb 25, 2009
  22. 17/21 builtin-remote: teach show to display remote HEADJay Soffian, Feb 25, 2009
  23. 18/21 builtin-remote: add set-head subcommandJay Soffian, Feb 25, 2009
  24. 19/21 remote: make guess_remote_head() use exact HEAD lookup if it is availableJay Soffian, Feb 25, 2009
  25. 20/21 builtin-remote: new show output styleJay Soffian, Feb 25, 2009
  26. 21/21 builtin-remote: new show output style for push refspecsJay Soffian, Feb 25, 2009
  27. Jeff KingFeb 26, 2009
  28. Junio C HamanoFeb 26, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.