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

Re: [PATCH 0/5] Extend pattern refspecs

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 8, 2009, 08:31 UTC
Message-ID
<7vocwcl8ku.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<76718490903052119y4d6a7e0ck24bfeb1c0964e413@mail.gmail.com>
Jay Soffian <jaysoffian@gmail.com> writes:
> This series and js/remote-improvements (e5dcbfd) in pu may not get
> along completely. "git remote show" tries to show how the refspecs
> expand out.

I've created an "early semantic conflict resolution" topic branch that is a cross between this series and js/remote-improvements, like so:

    $ git checkout -b xx/db-refspec-vs-js-remote db/refspec-wildcard-in-the-middle
    $ git merge js/remote-improvements
    $ git apply evil-fixup.diff
    $ git commit --amend -a -m "Evil merge."

with the following "fixup-as-an-evil-merge patch", which I'd appreciate if you two can sanity check.

The result will be queued at the tip of 'pu', and hopefully I can merge it to 'next' when this series goes to 'next'. Similarly, whichever one goes first to 'master' can be merged straight, but the merge of the other one needs to merge this branch as well.

diff --git a/builtin-remote.c b/builtin-remote.c
index 7e82a52..3e4a41b 100644
--- a/builtin-remote.c
+++ b/builtin-remote.c
@@ -359,14 +358,9 @@ static int get_push_ref_states_noquery(struct ref_states *states)
 	}
 	for (i = 0; i < remote->push_refspec_nr; i++) {
 		struct refspec *spec = remote->push + i;
-		char buf[PATH_MAX];
 		if (spec->matching)
 			item = string_list_append("(matching)", &states->push);
-		else if (spec->pattern) {
-			snprintf(buf, (sizeof(buf)), "%s*", spec->src);
-			item = string_list_append(buf, &states->push);
-			snprintf(buf, (sizeof(buf)), "%s*", spec->dst);
-		} else if (strlen(spec->src))
+		else if (strlen(spec->src))
 			item = string_list_append(spec->src, &states->push);
 		else
 			item = string_list_append("(delete)", &states->push);
@@ -374,10 +368,7 @@ static int get_push_ref_states_noquery(struct ref_states *states)
 		info = item->util = xcalloc(sizeof(struct push_info), 1);
 		info->forced = spec->force;
 		info->status = PUSH_STATUS_NOTQUERIED;
-		if (spec->pattern)
-			info->dest = xstrdup(buf);
-		else
-			info->dest = xstrdup(spec->dst ? spec->dst : item->string);
+		info->dest = xstrdup(spec->dst ? spec->dst : item->string);
 	}
 	return 0;
 }
@@ -390,7 +381,7 @@ static int get_head_names(const struct ref *remote_refs, struct ref_states *stat
 
 	refspec.force = 0;
 	refspec.pattern = 1;
-	refspec.src = refspec.dst = "refs/heads/";
+	refspec.src = refspec.dst = "refs/heads/*";
 	states->heads.strdup_strings = 1;
 	get_fetch_map(remote_refs, &refspec, &fetch_map_tail, 0);
 	matches = guess_remote_head(find_ref_by_name(remote_refs, "HEAD"),
Previous: Jay SoffianNext: Daniel Barkalow
Message 7 of 9 in “Extend pattern refspecs”
  1. 0/5 Extend pattern refspecsDaniel Barkalow, Mar 6, 2009
  2. Jay SoffianMar 6, 2009
  3. Daniel BarkalowMar 6, 2009
  4. Jay SoffianMar 6, 2009
  5. Daniel BarkalowMar 6, 2009
  6. Jay SoffianMar 6, 2009
  7. Junio C HamanoMar 8, 2009
  8. Daniel BarkalowMar 8, 2009
  9. Jay SoffianMar 9, 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.