@matheusbsbs / matheus-bagliano / commits / c649657501
Fork 0

rev-list --objects-edge

This new flag is similar to --objects, but causes rev-list to show list of "uninteresting" commits that appear on the edge commit prefixed with '-'. Downstream pack-objects will be changed to take these as hints to use the trees and blobs contained with them as base objects of resulting pack, producing an incomplete (not self-contained) pack. Such a pack cannot be used in .git/objects/pack (it is prevented by git-index-pack erroring out if it is fed to git-fetch-pack -k or git-clone-pack), but would be useful when transferring only small changes to huge blobs. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Feb 19, 2006 at 03:32 UTC c649657501bada28794a30102d9c13cc28ca0e5e
2 files changed +29 -6
rev-list.c
+28 -6
@@ -30,7 +30,7 @@ static const char rev_list_usage[] =
30 " --date-order\n"
31 " formatting output:\n"
32 " --parents\n"
33 -" --objects\n"
33 +" --objects | --objects-edge\n"
34 " --unpacked\n"
35 " --header | --pretty\n"
36 " --abbrev=nr | --no-abbrev\n"
@@ -44,6 +44,7 @@ static int bisect_list = 0;
44 static int tag_objects = 0;
45 static int tree_objects = 0;
46 static int blob_objects = 0;
47 +static int edge_hint = 0;
48 static int verbose_header = 0;
49 static int abbrev = DEFAULT_ABBREV;
50 static int show_parents = 0;
@@ -430,16 +431,30 @@ static struct commit_list *find_bisection(struct commit_list *list)
431 return best;
432 }
433
434 +static void mark_edge_parents_uninteresting(struct commit *commit)
435 +{
436 + struct commit_list *parents;
437 +
438 + for (parents = commit->parents; parents; parents = parents->next) {
439 + struct commit *parent = parents->item;
440 + if (!(parent->object.flags & UNINTERESTING))
441 + continue;
442 + mark_tree_uninteresting(parent->tree);
443 + if (edge_hint)
444 + printf("-%s\n", sha1_to_hex(parent->object.sha1));
445 + }
446 +}
447 +
448 static void mark_edges_uninteresting(struct commit_list *list)
449 {
450 for ( ; list; list = list->next) {
436 - struct commit_list *parents = list->item->parents;
451 + struct commit *commit = list->item;
452
438 - for ( ; parents; parents = parents->next) {
439 - struct commit *commit = parents->item;
440 - if (commit->object.flags & UNINTERESTING)
441 - mark_tree_uninteresting(commit->tree);
453 + if (commit->object.flags & UNINTERESTING) {
454 + mark_tree_uninteresting(commit->tree);
455 + continue;
456 }
457 + mark_edge_parents_uninteresting(commit);
458 }
459 }
460
@@ -843,6 +858,13 @@ int main(int argc, const char **argv)
858 blob_objects = 1;
859 continue;
860 }
861 + if (!strcmp(arg, "--objects-edge")) {
862 + tag_objects = 1;
863 + tree_objects = 1;
864 + blob_objects = 1;
865 + edge_hint = 1;
866 + continue;
867 + }
868 if (!strcmp(arg, "--unpacked")) {
869 unpacked = 1;
870 limited = 1;
rev-parse.c
+1
@@ -43,6 +43,7 @@ static int is_rev_argument(const char *arg)
43 "--min-age=",
44 "--no-merges",
45 "--objects",
46 + "--objects-edge",
47 "--parents",
48 "--pretty",
49 "--show-breaks",