Skip to content

Commit bd481de

Browse files
whydoubtgitster
authored andcommitted
blame: move entry prepend to libgit
Signed-off-by: Jeff Smith <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 09002f1 commit bd481de

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

blame.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1845,3 +1845,19 @@ void setup_scoreboard(struct blame_scoreboard *sb, const char *path, struct blam
18451845
if (orig)
18461846
*orig = o;
18471847
}
1848+
1849+
1850+
1851+
struct blame_entry *blame_entry_prepend(struct blame_entry *head,
1852+
long start, long end,
1853+
struct blame_origin *o)
1854+
{
1855+
struct blame_entry *new_head = xcalloc(1, sizeof(struct blame_entry));
1856+
new_head->lno = start;
1857+
new_head->num_lines = end - start;
1858+
new_head->suspect = o;
1859+
new_head->s_lno = start;
1860+
new_head->next = head;
1861+
blame_origin_incref(o);
1862+
return new_head;
1863+
}

blame.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,4 +170,6 @@ extern const char *blame_nth_line(struct blame_scoreboard *sb, long lno);
170170
extern void init_scoreboard(struct blame_scoreboard *sb);
171171
extern void setup_scoreboard(struct blame_scoreboard *sb, const char *path, struct blame_origin **orig);
172172

173+
extern struct blame_entry *blame_entry_prepend(struct blame_entry *head, long start, long end, struct blame_origin *o);
174+
173175
#endif /* BLAME_H */

builtin/blame.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -648,20 +648,6 @@ static int blame_move_callback(const struct option *option, const char *arg, int
648648
return 0;
649649
}
650650

651-
struct blame_entry *blame_entry_prepend(struct blame_entry *head,
652-
long start, long end,
653-
struct blame_origin *o)
654-
{
655-
struct blame_entry *new_head = xcalloc(1, sizeof(struct blame_entry));
656-
new_head->lno = start;
657-
new_head->num_lines = end - start;
658-
new_head->suspect = o;
659-
new_head->s_lno = start;
660-
new_head->next = head;
661-
blame_origin_incref(o);
662-
return new_head;
663-
}
664-
665651
int cmd_blame(int argc, const char **argv, const char *prefix)
666652
{
667653
struct rev_info revs;

0 commit comments

Comments
 (0)