| 937 | } |
| 938 | |
| 939 | static void compute_layer_order(struct object_entry **wo, unsigned int *wo_end) |
| 940 | { |
| 941 | unsigned int i, last_untagged; |
| 942 | struct object_entry *objects = to_pack.objects; |
| 943 | |
| 944 | for (i = 0; i < to_pack.nr_objects; i++) { |
| 945 | if (objects[i].tagged) |
| 946 | break; |
| 947 | add_to_write_order(wo, wo_end, &objects[i]); |
| 948 | } |
| 949 | last_untagged = i; |
| 950 | |
| 951 | /* |
| 952 | * Then fill all the tagged tips. |
| 953 | */ |
| 954 | for (; i < to_pack.nr_objects; i++) { |
| 955 | if (objects[i].tagged) |
| 956 | add_to_write_order(wo, wo_end, &objects[i]); |
| 957 | } |
| 958 | |
| 959 | /* |
| 960 | * And then all remaining commits and tags. |
| 961 | */ |
| 962 | for (i = last_untagged; i < to_pack.nr_objects; i++) { |
| 963 | if (oe_type(&objects[i]) != OBJ_COMMIT && |
| 964 | oe_type(&objects[i]) != OBJ_TAG) |
| 965 | continue; |
| 966 | add_to_write_order(wo, wo_end, &objects[i]); |
| 967 | } |
| 968 | |
| 969 | /* |
| 970 | * And then all the trees. |
| 971 | */ |
| 972 | for (i = last_untagged; i < to_pack.nr_objects; i++) { |
| 973 | if (oe_type(&objects[i]) != OBJ_TREE) |
| 974 | continue; |
| 975 | add_to_write_order(wo, wo_end, &objects[i]); |
| 976 | } |
| 977 | |
| 978 | /* |
| 979 | * Finally all the rest in really tight order |
| 980 | */ |
| 981 | for (i = last_untagged; i < to_pack.nr_objects; i++) { |
| 982 | if (!objects[i].filled && oe_layer(&to_pack, &objects[i]) == write_layer) |
| 983 | add_family_to_write_order(wo, wo_end, &objects[i]); |
| 984 | } |
| 985 | } |
| 986 | |
| 987 | static struct object_entry **compute_write_order(void) |
| 988 | { |
no test coverage detected