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

[PATCH 1/2] transport-helper: improve push messages

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Apr 11, 2013, 00:07 UTC
Message-ID
<1365638832-9000-2-git-send-email-felipe.contreras@gmail.com>
In-Reply-To
<1365638832-9000-1-git-send-email-felipe.contreras@gmail.com>

If there's already a remote-helper tracking ref, we can fetch the SHA-1 to report proper push messages (as opposed to always reporting [new branch]).

The remote-helper currently can specify the old SHA-1 to avoid this problem, but there's no point in forcing all remote-helpers to be aware of git commit ids; they should be able to be agnostic of them.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 t/t5801-remote-helpers.sh | 14 ++++++++++++++
 transport-helper.c        |  1 +
 2 files changed, 15 insertions(+)
diff --git a/t/t5801-remote-helpers.sh b/t/t5801-remote-helpers.sh
index f387027..214aa40 100755
--- a/t/t5801-remote-helpers.sh
+++ b/t/t5801-remote-helpers.sh
@@ -166,4 +166,18 @@ test_expect_success 'push ref with existing object' '
 	compare_refs local dup server dup
 '
 
+test_expect_success 'push messages' '
+	(cd local &&
+	git checkout -b new_branch master &&
+	echo new >>file &&
+	git commit -a -m new &&
+	git push origin new_branch &&
+	git fetch origin &&
+	echo new >>file &&
+	git commit -a -m new &&
+	git push origin new_branch 2> msg &&
+	! grep "\[new branch\]" msg
+	)
+'
+
 test_done
diff --git a/transport-helper.c b/transport-helper.c
index cb3ef7d..2257025 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -801,6 +801,7 @@ static int push_refs_with_export(struct transport *transport,
 		if (private && !get_sha1(private, sha1)) {
 			strbuf_addf(&buf, "^%s", private);
 			string_list_append(&revlist_args, strbuf_detach(&buf, NULL));
+			hashcpy(ref->old_sha1, sha1);
 		}
 		free(private);
 
-- 
1.8.2.1
Previous: Felipe ContrerasNext: Jeff King
Message 2 of 14 in “transport-helper: general fixes”
  1. 0/2 transport-helper: general fixesFelipe Contreras, Apr 11, 2013
  2. 1/2 transport-helper: improve push messagesFelipe Contreras, Apr 11, 2013
  3. Jeff KingApr 11, 2013
  4. 2/2 transport-helper: update remote helper namespaceFelipe Contreras, Apr 11, 2013
  5. Jeff KingApr 11, 2013
  6. Felipe ContrerasApr 11, 2013
  7. Jeff KingApr 11, 2013
  8. Felipe ContrerasApr 11, 2013
  9. Felipe ContrerasApr 13, 2013
  10. Junio C HamanoApr 14, 2013
  11. Felipe ContrerasApr 14, 2013
  12. Junio C HamanoApr 14, 2013
  13. Jeff KingApr 14, 2013
  14. Jonathan NiederApr 16, 2013

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.