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

[PATCH 2/6] shallow: only add shallow graft points to new shallow file

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Aug 16, 2013, 09:52 UTC
Message-ID
<1376646727-22318-2-git-send-email-pclouds@gmail.com>
In-Reply-To
<1376646727-22318-1-git-send-email-pclouds@gmail.com>

for_each_commit_graft() goes through all graft points and shallow boudaries are just one special kind of grafting. If $GIT_DIR/shallow and $GIT_DIR/info/grafts are both present, write_shallow_commits may catch both sets, accidentally turning some graft points to shallow boundaries. Don't do that.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 shallow.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/shallow.c b/shallow.c
index 68dd106..5f626c0 100644
--- a/shallow.c
+++ b/shallow.c
@@ -153,6 +153,8 @@ static int write_one_shallow(const struct commit_graft *graft, void *cb_data)
 {
 	struct write_shallow_data *data = cb_data;
 	const char *hex = sha1_to_hex(graft->sha1);
+	if (graft->nr_parent != -1)
+		return 0;
 	data->count++;
 	if (data->use_pack_protocol)
 		packet_buf_write(data->out, "shallow %s", hex);
-- 
1.8.2.82.gc24b958
Previous: Nguyễn Thái Ngọc DuyNext: Eric Sunshine
Message 16 of 30 in “During a shallow fetch, prevent sending over unneeded objects”
  1. During a shallow fetch, prevent sending over unneeded objectsMatthijs Kooijman, Jul 11, 2013
  2. Junio C HamanoJul 11, 2013
  3. Matthijs KooijmanJul 12, 2013
  4. Matthijs KooijmanAug 7, 2013
  5. Junio C HamanoAug 8, 2013
  6. Duy NguyenAug 8, 2013
  7. Junio C HamanoAug 8, 2013
  8. Duy NguyenAug 8, 2013
  9. Junio C HamanoAug 8, 2013
  10. Duy NguyenAug 8, 2013
  11. Junio C HamanoAug 8, 2013
  12. Duy NguyenAug 9, 2013
  13. Matthijs KooijmanAug 12, 2013
  14. Duy NguyenAug 16, 2013
  15. 1/6 Move setup_alternate_shallow and write_shallow_commits to shallow.cNguyễn Thái Ngọc Duy, Aug 16, 2013
  16. 2/6 shallow: only add shallow graft points to new shallow fileNguyễn Thái Ngọc Duy, Aug 16, 2013
  17. Eric SunshineAug 16, 2013
  18. 3/6 shallow: add setup_temporary_shallow()Nguyễn Thái Ngọc Duy, Aug 16, 2013
  19. Eric SunshineAug 16, 2013
  20. 4/6 upload-pack: delegate rev walking in shallow fetch to pack-objectsNguyễn Thái Ngọc Duy, Aug 16, 2013
  21. Matthijs KooijmanAug 28, 2013
  22. Duy NguyenAug 29, 2013
  23. 5/6 list-objects: reduce one argument in mark_edges_uninterestingNguyễn Thái Ngọc Duy, Aug 16, 2013
  24. 6/6 list-objects: mark more commits as edges in mark_edges_uninterestingNguyễn Thái Ngọc Duy, Aug 16, 2013
  25. Matthijs KooijmanAug 28, 2013
  26. Add testcase for needless objects during a shallow fetchMatthijs Kooijman, Aug 28, 2013
  27. Duy NguyenAug 29, 2013
  28. Duy NguyenAug 31, 2013
  29. Matthijs KooijmanOct 21, 2013
  30. Duy NguyenOct 26, 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.