Code

lf_to_crlf_filter(): tell the caller we added "\n" when draining
[git.git] / commit.c
index 913dbabd1c12772d574f5814f73a12ed6bd4a9da..97b43279cdf46159462d5f56abc20f2161f4c7ea 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -214,22 +214,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)