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

[PATCH] clone: add test for push on an empty clone.

From
Matthieu Moy <matthieu.moy@imag.fr>
Date
Apr 20, 2009, 11:09 UTC
Message-ID
<1240225777-31334-1-git-send-email-Matthieu.Moy@imag.fr>
In-Reply-To
<7vfxg3ipib.fsf@gitster.siamese.dyndns.org>

Commit 55f0566 (get_local_heads(): do not return random pointer if there is no head, 2009-04-17) fixed a segfault for git push, this patch adds a test-case to avoid future regressions.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
 t/t5701-clone-local.sh |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/t/t5701-clone-local.sh b/t/t5701-clone-local.sh
index 3559d17..f26b511 100755
--- a/t/t5701-clone-local.sh
+++ b/t/t5701-clone-local.sh
@@ -132,4 +132,14 @@ test_expect_success 'clone empty repository' '
 	 test $actual = $expected)
 '
 
+test_expect_success 'clone empty repository, and then push should not segfault.' '
+	cd "$D" &&
+	rm -fr empty/ empty-clone/ &&
+	mkdir empty &&
+	(cd empty && git init) &&
+	git clone empty empty-clone &&
+	cd empty-clone &&
+	test_must_fail git push
+'
+
 test_done
-- 
1.6.2.2.449.g92961.dirty
Previous: Matthieu Moy
Message 11 of 11 in “BUG: git push on an empty clone segfaults.”
  1. BUG: git push on an empty clone segfaults.Matthieu Moy, Apr 20, 2009
  2. Fix uninitialized memory in get_local_heads()Johannes Schindelin, Apr 20, 2009
  3. Jay SoffianApr 20, 2009
  4. Junio C HamanoApr 20, 2009
  5. Johannes SchindelinApr 20, 2009
  6. Junio C HamanoApr 20, 2009
  7. Petr BaudisApr 20, 2009
  8. Johannes SchindelinApr 20, 2009
  9. Petr BaudisApr 20, 2009
  10. Matthieu MoyApr 20, 2009
  11. clone: add test for push on an empty clone.Matthieu Moy, Apr 20, 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.