Re: [PATCH v4 1/4] checkout: factor out functions to new lib file
From: Junio C Hamano <hidden>
Date: 2017-11-24 06:47:07
Thomas Gummerer [off-list ref] writes:
quoted hunk
Factor the functions out, so they can be re-used from other places. In particular these functions will be re-used in builtin/worktree.c to make git worktree add dwim more. While there add some docs to the function. Signed-off-by: Thomas Gummerer <redacted> --- Makefile | 1 + builtin/checkout.c | 41 +---------------------------------------- checkout.c | 42 ++++++++++++++++++++++++++++++++++++++++++ checkout.h | 13 +++++++++++++ 4 files changed, 57 insertions(+), 40 deletions(-) create mode 100644 checkout.c create mode 100644 checkout.hdiff --git a/Makefile b/Makefile index cd75985991..8d603c7443 100644 --- a/Makefile +++ b/Makefile@@ -757,6 +757,7 @@ LIB_OBJS += branch.o LIB_OBJS += bulk-checkin.o LIB_OBJS += bundle.o LIB_OBJS += cache-tree.o +LIB_OBJS += checkout.o LIB_OBJS += color.o LIB_OBJS += column.o LIB_OBJS += combine-diff.odiff --git a/builtin/checkout.c b/builtin/checkout.c index fc4f8fd2ea..9e1cfd10b3 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c@@ -1,5 +1,6 @@ #include "builtin.h" #include "config.h" +#include "checkout.h" #include "lockfile.h" #include "parse-options.h" #include "refs.h"
With this, and also ...
quoted hunk
diff --git a/checkout.c b/checkout.c new file mode 100644 index 0000000000..b0c744d37a --- /dev/null +++ b/checkout.c@@ -0,0 +1,42 @@ +#include "cache.h" +#include "remote.h"
... with this, I sort of expected that builtin/checkout.c no longer has to include "remote.h" but can now rely on the common helpers in this new file to perform anything remote-related operation. But it seems that it is not the case (yet). Just recording my observation for future reference, as we might also want to move report_tracking(), etc., to this new file in the future.