Skip to content

Commit

Permalink
blame: move entry prepend to libgit
Browse files Browse the repository at this point in the history
Signed-off-by: Jeff Smith <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
whydoubt authored and gitster committed May 25, 2017
1 parent 09002f1 commit bd481de
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
16 changes: 16 additions & 0 deletions blame.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
2 changes: 2 additions & 0 deletions blame.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
14 changes: 0 additions & 14 deletions builtin/blame.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit bd481de

Please sign in to comment.