Skip to content

Move code from builtin to libgit.a

Nguyễn Thái Ngọc Duy git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest7 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7Move try_merge_command and checkout_fast_forward to libgit.aMakefile builtin/merge.c cache.h +3 more+125 -1120 replies
2/7Move estimate_bisect_steps to libgit.abisect.c builtin/rev-list.c+38 -390 replies
3/7Move print_commit_list to libgit.abisect.h builtin/rev-list.c commit.c +1 more+14 -140 replies
4/7Move setup_diff_pager to libgit.abuiltin.h builtin/diff.c cache.h +4 more+52 -530 replies
5/7send-pack: move core code to libgit.aMakefile builtin/send-pack.c send-pack.c +1 more+350 -3330 replies
6/7fetch-pack: remove global (static) configuration variable "args"builtin/fetch-pack.c+83 -770 replies
7/7fetch-pack: move core code to libgit.aMakefile builtin/fetch-pack.c fetch-pack.c+952 -9490 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/7] Move code from builtin to libgit.a
Quoted 7 lines · Jeff King
Quoted 2 lines

OK. I checked around for similar issues and found these used by libgit.a but stay in builtin/ instead:

Yeah, we have traditionally been kind of lazy about the distinction, because it doesn't really matter for our build system (i.e., libgit.a is not _really_ a library, but just a convenience in the build process). So one option is just not caring about these.

Yeah. We can fix it up when we encounter new undefined reference errors (e.g. a new test program that links to libgit.a). Anyway it does not look too difficult to do. Take it or drop it. Your call.

Quoted 10 lines

I'm also fine with fixing.

Quoted 4 lines

estimate_bisect_steps: bisect.c and builtin/rev-list.c
print_commit_list: bisect.c and builtin/rev-list.c

-> move them to bisect.c? another candidate is revision.c.

I'd probably say bisect.c for the first, and commit.c for the latter (that is where commit_list functions are defined, and it is really about that).

Makes sense.

Quoted 8 lines
Quoted 3 lines

setup_diff_pager: diff-no-index.c and builtin/diff.c

-> to diff-lib.c?

I'm not sure (to be honest, I am not even sure of the intended difference between diff.c and diff-lib.c). That function is really not for general diffing, but for diff-like commands. Probably it would be OK in diff.c.

Ditto. check_pager_config() is also moved from git.c to pager.c.

Quoted 9 lines
Quoted 6 lines

fetch_pack: transport.c and builtin/fetch-pack.c
send_pack: transport.c and builtin/send-pack.c

-> move them to transport.c? or new files fetch-pack.c and
send-pack.c? I haven't check how many functions they may pull together.

I think I'd rather have fetch-pack.c and send-pack.c than putting them into transport.c (which is getting kind of bloated already).

These two are big code moves, basically all {fetch,send}-pack code. While I think this is good cleanup (I get surprise every time I look at transport.c and it leads to buitin/fetch-pack.c), this is probably not a good idea if we have on flight topics, which may cause lots of conflicts for you and Junio. Fortunately we don't at the moment.

Nguyễn Thái Ngọc Duy (7):
Move try_merge_command and checkout_fast_forward to libgit.a Move estimate_bisect_steps to libgit.a
Move print_commit_list to libgit.a
Move setup_diff_pager to libgit.a
send-pack: move core code to libgit.a
fetch-pack: remove global (static) configuration variable "args"
fetch-pack: move core code to libgit.a

 Makefile             |   3 +
 bisect.c             |  38 ++
 bisect.h             |   4 -
 builtin.h            |   4 -
 builtin/diff.c       |  16 -
 builtin/fetch-pack.c | 951 +--------------------------------------------------
 builtin/merge.c      | 106 +-----
 builtin/rev-list.c   |  49 ---
 builtin/send-pack.c  | 333 ------------------
 cache.h              |  12 +-
 commit.c             |  10 +
 commit.h             |   4 +
 diff.c               |  16 +
 diff.h               |   1 +
 fetch-pack.c         | 951 +++++++++++++++++++++++++++++++++++++++++++++++++++
 git.c                |  33 --
 merge-recursive.h    |   5 -
 merge.c              | 112 ++++++
 pager.c              |  34 ++
 send-pack.c          | 344 +++++++++++++++++++
 sequencer.c          |   2 +-
 transport.h          |   5 +
 22 files changed, 1535 insertions(+), 1498 deletions(-)
 create mode 100644 fetch-pack.c
 create mode 100644 merge.c
 create mode 100644 send-pack.c
Signature · 1 line
1.8.0.rc2.23.g1fb49df