summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Smith <whydoubt@gmail.com>2017-05-24 00:15:37 -0500
committerJunio C Hamano <gitster@pobox.com>2017-05-25 13:08:23 +0900
commitbd481de713cb59a57f5f988b9bc46550c954dc45 (patch)
tree9ffb3af28b05c08e58b2c3d4021f6c3f766f9984
parent09002f1b31482dfbd0f471cd3614d542ea7a77a4 (diff)
downloadgit-bd481de713cb59a57f5f988b9bc46550c954dc45.tar.gz
blame: move entry prepend to libgit
Signed-off-by: Jeff Smith <whydoubt@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--blame.c16
-rw-r--r--blame.h2
-rw-r--r--builtin/blame.c14
3 files changed, 18 insertions, 14 deletions
diff --git a/blame.c b/blame.c
index f6c9cb7df9..00404b9738 100644
--- a/blame.c
+++ b/blame.c
@@ -1845,3 +1845,19 @@ void setup_scoreboard(struct blame_scoreboard *sb, const char *path, struct blam
if (orig)
*orig = o;
}
+
+
+
+struct blame_entry *blame_entry_prepend(struct blame_entry *head,
+ long start, long end,
+ struct blame_origin *o)
+{
+ struct blame_entry *new_head = xcalloc(1, sizeof(struct blame_entry));
+ new_head->lno = start;
+ new_head->num_lines = end - start;
+ new_head->suspect = o;
+ new_head->s_lno = start;
+ new_head->next = head;
+ blame_origin_incref(o);
+ return new_head;
+}
diff --git a/blame.h b/blame.h
index 76fd8efe15..a6c915c277 100644
--- a/blame.h
+++ b/blame.h
@@ -170,4 +170,6 @@ extern const char *blame_nth_line(struct blame_scoreboard *sb, long lno);
extern void init_scoreboard(struct blame_scoreboard *sb);
extern void setup_scoreboard(struct blame_scoreboard *sb, const char *path, struct blame_origin **orig);
+extern struct blame_entry *blame_entry_prepend(struct blame_entry *head, long start, long end, struct blame_origin *o);
+
#endif /* BLAME_H */
diff --git a/builtin/blame.c b/builtin/blame.c
index 7d9e322d45..08f35bd2de 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -648,20 +648,6 @@ static int blame_move_callback(const struct option *option, const char *arg, int
return 0;
}
-struct blame_entry *blame_entry_prepend(struct blame_entry *head,
- long start, long end,
- struct blame_origin *o)
-{
- struct blame_entry *new_head = xcalloc(1, sizeof(struct blame_entry));
- new_head->lno = start;
- new_head->num_lines = end - start;
- new_head->suspect = o;
- new_head->s_lno = start;
- new_head->next = head;
- blame_origin_incref(o);
- return new_head;
-}
-
int cmd_blame(int argc, const char **argv, const char *prefix)
{
struct rev_info revs;