aboutsummaryrefslogtreecommitdiff
path: root/builtin-tar-tree.c
Commit message (Collapse)AuthorAge
* git-tar-tree: no more void pointer arithmeticRene Scharfe2006-06-18
| | | | | | | | | Noticed by Florian Forster: Use a char pointer when adding offsets, because void pointer arithmetic is a GNU extension. Const'ify the function arguments while we're at it. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-tar-tree: Simplify write_trailer()Rene Scharfe2006-06-18
| | | | | | | | | We can write the trailer in one or at most two steps; it will always fit within two blocks. With the last caller of get_record() gone we can get rid of it. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Implement safe_strncpy() as strlcpy() and use it more.Peter Eriksen2006-06-16
| | | | | Signed-off-by: Peter Eriksen <s022018@student.dtu.dk> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Built-in git-get-tar-commit-idRene Scharfe2006-06-10
| | | | | | | | | | | | By being an internal command git-get-commit-id can make use of struct ustar_header and other stuff and stops wasting precious disk space. Note: I recycled one of the two "tar-tree" entries instead of splitting that cleanup into a separate patch. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Off-by-one error in get_path_prefix(), found by ValgrindRene Scharfe2006-06-07
| | | | | | | | | [jc: original fix was done by Pavel and this contains improvements by Rene.] Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Acked-by: Pavel Roskin <proski@gnu.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* tree_entry(): new tree-walking helper functionLinus Torvalds2006-05-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a "tree_entry()" function that combines the common operation of doing a "tree_entry_extract()" + "update_tree_entry()". It also has a simplified calling convention, designed for simple loops that traverse over a whole tree: the arguments are pointers to the tree descriptor and a name_entry structure to fill in, and it returns a boolean "true" if there was an entry left to be gotten in the tree. This allows tree traversal with struct tree_desc desc; struct name_entry entry; desc.buf = tree->buffer; desc.size = tree->size; while (tree_entry(&desc, &entry) { ... use "entry.{path, sha1, mode, pathlen}" ... } which is not only shorter than writing it out in full, it's hopefully less error prone too. [ It's actually a tad faster too - we don't need to recalculate the entry pathlength in both extract and update, but need to do it only once. Also, some callers can avoid doing a "strlen()" on the result, since it's returned as part of the name_entry structure. However, by now we're talking just 1% speedup on "git-rev-list --objects --all", and we're definitely at the point where tree walking is no longer the issue any more. ] NOTE! Not everybody wants to use this new helper function, since some of the tree walkers very much on purpose do the descriptor update separately from the entry extraction. So the "extract + update" sequence still remains as the core sequence, this is just a simplified interface. We should probably add a silly two-line inline helper function for initializing the descriptor from the "struct tree" too, just to cut down on the noise from that common "desc" initializer. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Merge branch 'jc/tartree' into jc/builtin-n-tar-treeJunio C Hamano2006-05-23
|\ | | | | | | | | * jc/tartree: built-in tar-tree and remote tar-tree
| * built-in tar-tree and remote tar-treeJunio C Hamano2006-05-19
| | | | | | | | | | | | This makes tar-tree a built-in. As an added bonus, you can now say: git tar-tree --remote=remote-repository <ent> [<base>] This does not work with git-daemon yet, but should work with localhost and git over ssh transports. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Builtin git-tar-tree.Peter Eriksen2006-05-23
Signed-off-by: Peter Eriksen <s022018@student.dtu.dk> Signed-off-by: Junio C Hamano <junkio@cox.net>