Skip to contentSkip to conversation

Libify blame

PATCH2/2 pi song 4 participants 5 messages Jun 15, 2016 Kbuild

lore
Share & tools
lore

pi song

author
#0 lore raw

This looks like a very HUGE patch but it does merely splitting the current builtin-blame.c into smaller blame.c without changing any logic. This is still WIP. The next patch will organize functions more appropriately.

---
 Makefile        |    1 +
 blame.c         | 1744 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 blame.h         |   21 +
 builtin-blame.c | 1703 -----------------------------------------------------
 4 files changed, 1766 insertions(+), 1703 deletions(-)
 create mode 100644 blame.c
Makefile +1 -0
index cc0fb5a..ac438a5 100644
@@ -423,6 +423,7 @@ LIB_OBJS += archive-tar.o
 LIB_OBJS += archive-zip.o
 LIB_OBJS += attr.o
 LIB_OBJS += base85.o
+LIB_OBJS += blame.o
 LIB_OBJS += blob.o
 LIB_OBJS += branch.o
 LIB_OBJS += bundle.o
blame.c new file +1744 -0

1,744 lines not on this page · raw message

blame.h +21 -0
index 72d1e2a..37318b5 100644
@@ -161,6 +161,27 @@ struct blame_scoreboard {
 	struct blame_info *ssb;
 };
 
+/* these will be reorganized again */
+extern const char *nth_line(struct blame_scoreboard *sb, int lno) ;
+extern struct origin *make_origin(struct commit *commit, const char *path) ;
+extern const char *add_prefix(const char *prefix, const char *path) ;
+extern struct origin *get_origin(struct blame_scoreboard *sb,
+				 struct commit *commit,
+			 	 const char *path) ;
+
+extern unsigned parse_score(const char *arg) ;
+
+extern int has_string_in_work_tree(const char *path) ;
+extern int fill_blob_sha1(struct origin *origin) ;
+extern int prepare_lines(struct blame_scoreboard *sb) ;
+
+extern int read_ancestry(const char *graft_file) ;
+
+extern void output(struct blame_scoreboard *sb, int option) ;
+
+extern void find_alignment(struct blame_scoreboard *sb, int *option) ;
+
 extern void assign_blame(struct blame_scoreboard *sb, int opt) ;
+extern void coalesce(struct blame_scoreboard *sb) ;
 
 #endif
builtin-blame.c +0 -1703

1,222 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.5.4.3

Part of the diff is not shown here. View the raw message.

#1 lore raw

Heya,

Quoted 2 lines · pi song

This looks like a very HUGE patch but it does merely splitting the current builtin-blame.c into smaller blame.c without changing any logic. This is still WIP. The next patch will organize functions more appropriately.

It would be nice if you could paste the output of "git diff -M" after the triple-dash to show that it is indeed only a small change.

Signature · 3 lines
Cheers,

Sverre Rabbelier
#2 lore raw
Quoted 2 lines · Sverre Rabbelier

It would be nice if you could paste the output of "git diff -M" after the triple-dash to show that it is indeed only a small change.

Or just use git format-patch -M?

author
#3 lore raw

This was generated from git format-patch -M. After applying the patch, you can look in git gui to confirm that I didn't change any logic.

Pi Song

Quoted 6 lines · Miklos Vajna
Quoted 2 lines · Sverre Rabbelier

It would be nice if you could paste the output of "git diff -M" after the triple-dash to show that it is indeed only a small change.

Or just use git format-patch -M?

#4 lore raw
In reply to Miklos Vajna
Quoted 5 lines · Miklos Vajna
Quoted 2 lines · Sverre Rabbelier

It would be nice if you could paste the output of "git diff -M" after the triple-dash to show that it is indeed only a small change.

Or just use git format-patch -M?

No file disappears, so -M alone won't cut it.

I think -B -M may do something interesting, but even then, I suspect you will see a lot of deletions (e.g. you start from two copies of the original builtin-blame.c and remove different parts to arrive at the new builtin-blame.c and blame.c) that amounts roughly about the same size as the original builtin-blame.c itself.