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

[PATCH v3 04/23] t5800: document some non-functional parts of remote helpers

From
Sverre Rabbelier <srabbelier@gmail.com>
Date
Jul 16, 2011, 13:03 UTC
Message-ID
<1310821424-4750-5-git-send-email-srabbelier@gmail.com>
In-Reply-To
<1310821424-4750-1-git-send-email-srabbelier@gmail.com>
From: Jeff King <peff@peff.net>

These are all things one might expect to work in a helper that is capable of handling multiple branches (which our testgit helper in theory should be able to do, as it is backed by git). All of these bugs are specific to the import/export codepaths, so they don't affect helpers like git-remote-curl that use fetch/push commands.

The first and fourth tests are about fetching and pushing new refs, and demonstrate bugs in the git_remote_helpers library (so they would be most likely to impact helpers for other VCSs which import/export git).

The second test is about importing multiple refs; it demonstrates a bug in git-remote-testgit, which is mostly for exercising the test code. Therefore it probably doesn't affect anyone in practice.

The third test demonstrates a bug in git's side of the helper code when the upstream has added refs that we do not have locally. This could impact git users who use remote helpers to access foreign VCSs.

All of those bugs have fixes later in this series.

The fifth test is the most complex, and does not have a fix in this series. It tests pushing a ref via the export mechanism to a new name on the remote side (i.e., "git push $remote old:new").

The problem is that we push all of the work of generating the export stream onto fast-export, but we have no way of communicating to fast-export that this name mapping is happening. So we tell fast-export to generate a stream with the commits for "old", but we can't tell it to label them all as "new".

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com>
---
  Unchanged
 t/t5800-remote-helpers.sh |   47 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 47 insertions(+), 0 deletions(-)
diff --git a/t/t5800-remote-helpers.sh b/t/t5800-remote-helpers.sh
index f6796e3..9db8ca8 100755
--- a/t/t5800-remote-helpers.sh
+++ b/t/t5800-remote-helpers.sh
@@ -85,4 +85,51 @@ test_expect_success 'pushing remote local repo' '
 	compare_refs clone HEAD server HEAD
 '
 
+test_expect_failure 'fetch new branch' '
+	(cd public &&
+	 git checkout -b new &&
+	 echo content >>file &&
+	 git commit -a -m five &&
+	 git push origin new
+	) &&
+	(cd localclone &&
+	 git fetch origin new
+	) &&
+	compare_refs public HEAD localclone FETCH_HEAD
+'
+
+test_expect_failure 'fetch multiple branches' '
+	(cd localclone &&
+	 git fetch
+	) &&
+	compare_refs server master localclone refs/remotes/origin/master &&
+	compare_refs server new localclone refs/remotes/origin/new
+'
+
+test_expect_failure 'push when remote has extra refs' '
+	(cd clone &&
+	 echo content >>file &&
+	 git commit -a -m six &&
+	 git push
+	) &&
+	compare_refs clone master server master
+'
+
+test_expect_failure 'push new branch by name' '
+	(cd clone &&
+	 git checkout -b new-name  &&
+	 echo content >>file &&
+	 git commit -a -m seven &&
+	 git push origin new-name
+	) &&
+	compare_refs clone HEAD server refs/heads/new-name
+'
+
+test_expect_failure 'push new branch with old:new refspec' '
+	(cd clone &&
+	 git push origin new-name:new-refspec
+	) &&
+	compare_refs clone HEAD server refs/heads/new-refspec
+'
+
 test_done
-- 
1.7.5.1.292.g728120
Previous: Sverre RabbelierNext: Sverre Rabbelier
Message 5 of 29 in “remote-helper improvements”
  1. 00/23 remote-helper improvementsSverre Rabbelier, Jul 16, 2011
  2. 01/23 transport-helper: fix minor leak in push_refs_with_exportSverre Rabbelier, Jul 16, 2011
  3. 02/23 t5800: factor out some ref testsSverre Rabbelier, Jul 16, 2011
  4. 03/23 t5800: use skip_all instead of prereqSverre Rabbelier, Jul 16, 2011
  5. 04/23 t5800: document some non-functional parts of remote helpersSverre Rabbelier, Jul 16, 2011
  6. 05/23 git-remote-testgit: import non-HEAD refsSverre Rabbelier, Jul 16, 2011
  7. 06/23 transport-helper: don't feed bogus refs to export pushSverre Rabbelier, Jul 16, 2011
  8. 07/23 git_remote_helpers: push all refs during a non-local exportSverre Rabbelier, Jul 16, 2011
  9. Junio C HamanoJul 17, 2011
  10. Sverre RabbelierJul 23, 2011
  11. 08/23 remote-helpers: export GIT_DIR variable to helpersSverre Rabbelier, Jul 16, 2011
  12. 09/23 remote-curl: accept empty line as terminatorSverre Rabbelier, Jul 16, 2011
  13. 10/23 git-remote-testgit: only push for non-local repositoriesSverre Rabbelier, Jul 16, 2011
  14. 11/23 git-remote-testgit: fix error handlingSverre Rabbelier, Jul 16, 2011
  15. 12/23 fast-import: introduce 'done' commandSverre Rabbelier, Jul 16, 2011
  16. 13/23 fast-export: support done featureSverre Rabbelier, Jul 16, 2011
  17. 14/23 transport-helper: factor out push_update_refs_statusSverre Rabbelier, Jul 16, 2011
  18. 15/23 transport-helper: check status code of finish_commandSverre Rabbelier, Jul 16, 2011
  19. 16/23 transport-helper: use the new done feature where possibleSverre Rabbelier, Jul 16, 2011
  20. 17/23 transport-helper: update ref status after push with exportSverre Rabbelier, Jul 16, 2011
  21. 18/23 transport-helper: change import semanticsSverre Rabbelier, Jul 16, 2011
  22. Dmitry IvankovJul 18, 2011
  23. 19/23 transport-helper: Use capname for refspec capability tooSverre Rabbelier, Jul 16, 2011
  24. 20/23 transport-helper: implement marks location as capabilitySverre Rabbelier, Jul 16, 2011
  25. 21/23 transport-helper: die early on encountering deleted refsSverre Rabbelier, Jul 16, 2011
  26. 22/23 t5800: document inability to push new branch with old contentSverre Rabbelier, Jul 16, 2011
  27. 23/23 t5800: point out that deleting branches does not workSverre Rabbelier, Jul 16, 2011
  28. Jeff KingJul 18, 2011
  29. Sverre RabbelierJul 23, 2011

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.