X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=commit.c;h=9f4cc636dd74e99a1311500e15501bdb4875cb9d;hb=00653435488f5ed86c5d6dc411fa14fa56f5e3bc;hp=50fcf96c243c975a9c1be8443e84c7c4517cdc5b;hpb=baf18fc261ca475343fe3cb9cd2c0dded4bc1bb7;p=git.git diff --git a/commit.c b/commit.c index 50fcf96c2..9f4cc636d 100644 --- a/commit.c +++ b/commit.c @@ -226,22 +226,12 @@ struct commit_graft *lookup_commit_graft(const unsigned char *sha1) return commit_graft[pos]; } -int write_shallow_commits(struct strbuf *out, int use_pack_protocol) -{ - int i, count = 0; - for (i = 0; i < commit_graft_nr; i++) - if (commit_graft[i]->nr_parent < 0) { - const char *hex = - sha1_to_hex(commit_graft[i]->sha1); - count++; - if (use_pack_protocol) - packet_buf_write(out, "shallow %s", hex); - else { - strbuf_addstr(out, hex); - strbuf_addch(out, '\n'); - } - } - return count; +int for_each_commit_graft(each_commit_graft_fn fn, void *cb_data) +{ + int i, ret; + for (i = ret = 0; i < commit_graft_nr && !ret; i++) + ret = fn(commit_graft[i], cb_data); + return ret; } int unregister_shallow(const unsigned char *sha1) @@ -527,7 +517,7 @@ void sort_in_topological_order(struct commit_list ** list, int lifo) commit = work_item->item; for (parents = commit->parents; parents ; parents = parents->next) { - struct commit *parent=parents->item; + struct commit *parent = parents->item; if (!parent->indegree) continue;