Thread (31 messages) 31 messages, 4 authors, 2016-06-15

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

From: Elijah Newren <hidden>
Date: 2016-06-15 22:49:14

Hi,

2010/7/31 Nguyễn Thái Ngọc Duy [off-list ref]:
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.
+/*
+ * 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'?

+                       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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help