Comment -p mode for cat-file
A message that is not in the archive (sent off-list or not yet received): f323e83a37efd3b913004666f2fc104578a92833.1165875140.git.andyparkins@gmail.com
PATCH 1/1 Comment -p mode for cat-file
Signed-off-by Andy Parkins <[email protected]>
--- builtin-cat-file.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
builtin-cat-file.c +4 -0
@@ -121,12 +121,16 @@ int cmd_cat_file(int argc, const char **argv, const char *prefix)die ("Not a valid object name %s" , argv[2 ]);/* custom pretty-print here */ +/* Special print tree types using ls-tree +* git-ls-tree argv[1] */ if (!strcmp (type, tree_type))return cmd_ls_tree (2 , argv +1 ,NULL ); +/* For everything else, read the object itself */ buf =read_sha1_file (sha1, type, &size);if (!buf)die ("Cannot read object %s" , argv[2 ]); +/* if the object is a tag, use pprint_tag() above */ if (!strcmp (type, tag_type)) {pprint_tag (sha1, buf, size);return 0 ;
Signature · 1 line
1.4.4.1.geeee8
PATCH 1/1 Comment diff_tree
In reply to a message not in the archiveSigned-off-by Andy Parkins <[email protected]>
--- tree-diff.c | 17 ++++++++++++++--- 1 files changed, 14 insertions(+), 3 deletions(-)
tree-diff.c +14 -3
@@ -160,33 +160,44 @@ static void show_entry(struct diff_options *opt, const char *prefix, struct treeint diff_tree (struct tree_desc *t1,struct tree_desc *t2,const char *base,struct diff_options *opt) { +/* While there are entries left in t1 or t2... */ while (t1->size | t2->size) {if (opt->nr_paths && t1->size && !interesting (t1, base, opt)) { +/* If there are paths left in t1, and the current path is +* not interesting, skip it and try the next path in t1 */ update_tree_entry (t1);continue ; }if (opt->nr_paths && t2->size && !interesting (t2, base, opt)) { +/* If there are paths left in t2, and the current path is +* not interesting, skip it and try the next path in t2 */ update_tree_entry (t2);continue ; } +/* Here if either +* - Either t1 or t2 path is available and interesting +* - No paths available */ if (!t1->size) { +/* If there is no path left in t1, then t2 is a new path */ show_entry (opt,"+" , t2, base);update_tree_entry (t2);continue ; }if (!t2->size) { +/* If there is no path left in t2, then t1 is a remed path */ show_entry (opt,"-" , t1, base);update_tree_entry (t1);continue ; } +/* If both paths are available and interesting then it is a change */ switch (compare_tree_entry (t1, t2, base, opt)) { -case -1 : +case -1 :/* Finished with the path in t1 */ update_tree_entry (t1);continue ; -case 0 : +case 0 :/* Finished with both paths */ update_tree_entry (t1);/* Fallthrough */ -case 1 : +case 1 :/* Finished with the path in t2 */ update_tree_entry (t2);continue ; }
Signature · 1 line
1.4.4.1.geeee8
PATCH 1/1 Add comments to update_tree_entry()
In reply to a message not in the archiveSigned-off-by Andy Parkins <[email protected]>
--- tree-walk.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
tree-walk.c +5 -0
@@ -37,6 +37,11 @@ static void entry_extract(struct tree_desc *t, struct name_entry *a)void update_tree_entry (struct tree_desc *desc) { +/* Each tree is represented by a buffer containing hashes followed +* by space followed by filename; separated with NUL. To move to the +* next entry we simply move forward by strlen() (which skips the filename) +* then skip the hash and the space. */ +/* This function should really be called skip_tree_entry() */ const void *buf = desc->buf;unsigned long size = desc->size;int len =strlen (buf) +1 +20 ;
Signature · 1 line
1.4.4.1.geeee8