summaryrefslogtreecommitdiff
path: root/commit.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-08-29 04:22:58 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-08-29 04:22:58 (GMT)
commit3400c222d9a2dfe8a63684fd47ad5ee7f5d6c4c4 (patch)
treef041c784ac07013cbf8783800ad046bf5da7efe9 /commit.c
parent2730f55527143d3476c159cebbdb63d5e6a5c2a8 (diff)
parentb9ad500262843c6110968da1f4e7b6717bc71303 (diff)
downloadgit-3400c222d9a2dfe8a63684fd47ad5ee7f5d6c4c4.zip
git-3400c222d9a2dfe8a63684fd47ad5ee7f5d6c4c4.tar.gz
git-3400c222d9a2dfe8a63684fd47ad5ee7f5d6c4c4.tar.bz2
Merge branch 'nd/decorate-grafts'
* nd/decorate-grafts: log: Do not decorate replacements with --no-replace-objects log: decorate "replaced" on to replaced commits log: decorate grafted commits with "grafted" Move write_shallow_commits to fetch-pack.c Add for_each_commit_graft() to iterate all grafts decoration: do not mis-decorate refs with same prefix
Diffstat (limited to 'commit.c')
-rw-r--r--commit.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/commit.c b/commit.c
index 913dbab..97b4327 100644
--- 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)