From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH 2/5] Add for_each_commit_graft() to iterate all grafts
Date: Thu, 18 Aug 2011 19:29:35 +0700 [thread overview]
Message-ID: <1313670578-2939-3-git-send-email-pclouds@gmail.com> (raw)
In-Reply-To: <1313670578-2939-1-git-send-email-pclouds@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
commit.c | 8 ++++++++
commit.h | 2 ++
2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/commit.c b/commit.c
index dc22695..efd647d 100644
--- a/commit.c
+++ b/commit.c
@@ -226,6 +226,14 @@ struct commit_graft *lookup_commit_graft(const unsigned char *sha1)
return commit_graft[pos];
}
+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 write_shallow_commits(struct strbuf *out, int use_pack_protocol)
{
int i, count = 0;
diff --git a/commit.h b/commit.h
index 0e36fd0..9030d42 100644
--- a/commit.h
+++ b/commit.h
@@ -143,6 +143,7 @@ struct commit_graft {
int nr_parent; /* < 0 if shallow commit */
unsigned char parent[FLEX_ARRAY][20]; /* more */
};
+typedef int (*each_commit_graft_fn)(const struct commit_graft *, void *);
struct commit_graft *read_graft_line(char *buf, int len);
int register_commit_graft(struct commit_graft *, int);
@@ -155,6 +156,7 @@ extern struct commit_list *get_octopus_merge_bases(struct commit_list *in);
extern int register_shallow(const unsigned char *sha1);
extern int unregister_shallow(const unsigned char *sha1);
extern int write_shallow_commits(struct strbuf *out, int use_pack_protocol);
+extern int for_each_commit_graft(each_commit_graft_fn, void *);
extern int is_repository_shallow(void);
extern struct commit_list *get_shallow_commits(struct object_array *heads,
int depth, int shallow_flag, int not_shallow_flag);
--
1.7.4.74.g639db
next prev parent reply other threads:[~2011-08-18 12:30 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-17 15:02 [PATCH] log: decorate grafted commits with "grafted" Nguyễn Thái Ngọc Duy
2011-08-17 18:48 ` Junio C Hamano
2011-08-18 2:02 ` Nguyen Thai Ngoc Duy
2011-08-18 12:29 ` [PATCH v2 0/5] Decorate grafts and replaces Nguyễn Thái Ngọc Duy
2011-08-18 12:29 ` [PATCH 1/5] decoration: do not mis-decorate refs with same prefix Nguyễn Thái Ngọc Duy
2011-08-18 17:58 ` Junio C Hamano
2011-08-18 12:29 ` Nguyễn Thái Ngọc Duy [this message]
2011-08-18 12:29 ` [PATCH 3/5] Move write_shallow_commits to fetch-pack.c Nguyễn Thái Ngọc Duy
2011-08-18 18:01 ` Junio C Hamano
2011-08-18 12:29 ` [PATCH 4/5] log: decorate grafted commits with "grafted" Nguyễn Thái Ngọc Duy
2011-08-18 18:10 ` Junio C Hamano
2011-08-18 12:29 ` [PATCH 5/5] log: decorate "replaced" on to replaced commits Nguyễn Thái Ngọc Duy
2011-08-18 18:16 ` Junio C Hamano
2011-08-19 12:43 ` [PATCH] " Nguyễn Thái Ngọc Duy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1313670578-2939-3-git-send-email-pclouds@gmail.com \
--to=pclouds@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.