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

Re: [PATCH 09/16] subtree: rewrite incoming commits

From
Elijah Newren <newren@gmail.com>
Date
Aug 2, 2010, 04:37 UTC
Message-ID
<AANLkTi=pgJGSY2-h2cqf2s7q49Uj0ra8tGCOWd5Do33G@mail.gmail.com>
In-Reply-To
<1280593105-22015-10-git-send-email-pclouds@gmail.com>
Hi,
2010/7/31 Nguyễn Thái Ngọc Duy <pclouds@gmail.com>:
Show 7 quoted lines
> This adds the main function, subtree_import(), which is intended to be
> used by "git clone".
>
> Because subtree packs are not complete. They are barely usable. Git
> client will cry out missing objects here and there... Theortically,
> client code could be adapted to only look for objects within
> subtree. That was painful to try.

It may have been painful, but personally I think it's still the right way to do it. Of course, that's a pretty easy thing for me to say, since you're pretty far ahead of me and I haven't felt your pain yet. Maybe I'll change my mind after trying it for a while, but I'm not convinced just yet.

Show 6 quoted lines
> +/*
> + * Take sha1 of a tree, rewrite it to only return the prefix and return
> + * the newsha1.
> + *
> + * If if is zero, write to object store. If fd is greater than zero,
> + * it's a pack file handle.
Should the second word of the second paragraph be 'fd' rather than another 'if'?
Show 6 quoted lines
> +                       if (slash && slash[1]) /* trailing slash does not count */
> +                               narrow_tree(entry.sha1, newtree_sha1, prefix+subtree_len+1, fd);
> +                       else
> +                               memcpy(newtree_sha1, entry.sha1, 20);
> +
> +                       strbuf_addf(&buffer, "%o %.*s%c", entry.mode, strlen(entry.path), entry.path, '\0');

My compiler complains that you didn't typecast the return value from strlen to an int.

Previous: Nguyễn Thái Ngọc DuyNext: Nguyễn Thái Ngọc Duy
Message 19 of 33 in “Subtree clone proof of concept”
  1. 00/16 Subtree clone proof of conceptNguyễn Thái Ngọc Duy, Jul 31, 2010
  2. 01/16 Add core.subtreeNguyễn Thái Ngọc Duy, Jul 31, 2010
  3. 02/16 list-objects: limit traversing within the given subtree if core.subtree is setNguyễn Thái Ngọc Duy, Jul 31, 2010
  4. Ævar Arnfjörð BjarmasonAug 1, 2010
  5. Nguyen Thai Ngoc DuyAug 1, 2010
  6. Elijah NewrenAug 2, 2010
  7. Nguyen Thai Ngoc DuyAug 2, 2010
  8. 03/16 parse_object: keep sha1 even when parsing replaced oneNguyễn Thái Ngọc Duy, Jul 31, 2010
  9. 04/16 Allow to invalidate a commit in in-memory object storeNguyễn Thái Ngọc Duy, Jul 31, 2010
  10. 05/16 Hook up replace-object to allow bulk commit replacementNguyễn Thái Ngọc Duy, Jul 31, 2010
  11. Junio C HamanoAug 2, 2010
  12. Nguyen Thai Ngoc DuyAug 2, 2010
  13. 06/16 upload-pack: use a separate variable to control whether internal rev-list is usedNguyễn Thái Ngọc Duy, Jul 31, 2010
  14. Elijah NewrenAug 2, 2010
  15. 07/16 upload-pack: support subtree packNguyễn Thái Ngọc Duy, Jul 31, 2010
  16. Elijah NewrenAug 2, 2010
  17. 08/16 fetch-pack: support --subtreeNguyễn Thái Ngọc Duy, Jul 31, 2010
  18. 09/16 subtree: rewrite incoming commitsNguyễn Thái Ngọc Duy, Jul 31, 2010
  19. Elijah NewrenAug 2, 2010
  20. 10/16 clone: support subtree clone with parameter --subtreeNguyễn Thái Ngọc Duy, Jul 31, 2010
  21. 11/16 pack-objects: add --subtree (for pushing)Nguyễn Thái Ngọc Duy, Jul 31, 2010
  22. 12/16 subtree: rewriting outgoing commitsNguyễn Thái Ngọc Duy, Jul 31, 2010
  23. Elijah NewrenAug 2, 2010
  24. 13/16 Update commit_tree() interface to take base tree tooNguyễn Thái Ngọc Duy, Jul 31, 2010
  25. 14/16 commit_tree(): rewriting/replacing new commitsNguyễn Thái Ngọc Duy, Jul 31, 2010
  26. 15/16 commit: rewrite outgoing commitsNguyễn Thái Ngọc Duy, Jul 31, 2010
  27. 16/16 do not use thin packs and subtree together (just a bad feeling about this)Nguyễn Thái Ngọc Duy, Jul 31, 2010
  28. Sverre RabbelierAug 1, 2010
  29. Nguyen Thai Ngoc DuyAug 1, 2010
  30. Sverre RabbelierAug 1, 2010
  31. Elijah NewrenAug 2, 2010
  32. Nguyen Thai Ngoc DuyAug 2, 2010
  33. Nguyen Thai Ngoc DuyAug 2, 2010

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.