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

[PATCH v6 p2 5/9] transport-helper: fix pushing with straight refspec

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Nov 24, 2012, 03:25 UTC
Message-ID
<1353727520-26039-6-git-send-email-felipe.contreras@gmail.com>
In-Reply-To
<1353727520-26039-1-git-send-email-felipe.contreras@gmail.com>
For example '*:*'.

Obviously '^refs/heads/master refs/heads/master' is not going to work, so lets check that the ref we are negating is not the same we are pushing.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 t/t5801-remote-helpers.sh | 2 +-
 transport-helper.c        | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/t/t5801-remote-helpers.sh b/t/t5801-remote-helpers.sh
index b268cd2..9c7871b 100755
--- a/t/t5801-remote-helpers.sh
+++ b/t/t5801-remote-helpers.sh
@@ -126,7 +126,7 @@ test_expect_success 'pulling with straight refspec' '
 	compare_refs local2 HEAD server HEAD
 '
 
-test_expect_failure 'pushing with straight refspec' '
+test_expect_success 'pushing with straight refspec' '
 	test_when_finished "(cd local2 && git reset --hard origin)" &&
 	(cd local2 &&
 	echo content >>file &&
diff --git a/transport-helper.c b/transport-helper.c
index 899eb36..6dbb72e 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -784,7 +784,7 @@ static int push_refs_with_export(struct transport *transport,
 		if (!data->refspecs)
 			continue;
 		private = apply_refspecs(data->refspecs, data->refspec_nr, ref->name);
-		if (private && !get_sha1(private, sha1)) {
+		if (private && strcmp(private, ref->name) && !get_sha1(private, sha1)) {
 			strbuf_addf(&buf, "^%s", private);
 			string_list_append(&revlist_args, strbuf_detach(&buf, NULL));
 		}
-- 
1.8.0
Previous: Felipe ContrerasNext: Felipe Contreras
Message 12 of 16 in “transport-helper and fast-export fixes”
  1. 0/9 transport-helper and fast-export fixesFelipe Contreras, Nov 24, 2012
  2. 1/9 transport-helper: update remote helper namespaceFelipe Contreras, Nov 24, 2012
  3. Felipe ContrerasNov 24, 2012
  4. 2/9 fast-export: don't handle uninteresting refsFelipe Contreras, Nov 24, 2012
  5. Felipe ContrerasNov 24, 2012
  6. 3/9 transport-helper: trivial code shuffleFelipe Contreras, Nov 24, 2012
  7. Junio C HamanoNov 27, 2012
  8. Felipe ContrerasNov 28, 2012
  9. Junio C HamanoNov 28, 2012
  10. Felipe ContrerasNov 28, 2012
  11. 4/9 transport-helper: fix push without refspecFelipe Contreras, Nov 24, 2012
  12. 5/9 transport-helper: fix pushing with straight refspecFelipe Contreras, Nov 24, 2012
  13. 6/9 transport-helper: fix push without marksFelipe Contreras, Nov 24, 2012
  14. 7/9 fast-export: make extra_refs globalFelipe Contreras, Nov 24, 2012
  15. 8/9 fast-export: refactor get_tags_and_duplicates()Felipe Contreras, Nov 24, 2012
  16. 9/9 fast-export: trivial cleanupsFelipe Contreras, Nov 24, 2012

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.