aboutsummaryrefslogtreecommitdiff
path: root/transport.h
diff options
context:
space:
mode:
authorMichael Lukashov <michael.lukashov@gmail.com>2010-02-16 23:42:52 +0000
committerJunio C Hamano <gitster@pobox.com>2010-02-17 15:07:15 -0800
commitf1863d0d16b9a5288671e17b7fa2eba8244ead2f (patch)
treeddd1b513802a0a97f715b47a22e2ed790364c2da /transport.h
parent6d816301cd53e54af3398b634d47588a6f184be4 (diff)
downloadgit-f1863d0d16b9a5288671e17b7fa2eba8244ead2f.tar.gz
git-f1863d0d16b9a5288671e17b7fa2eba8244ead2f.tar.xz
refactor duplicated code in builtin-send-pack.c and transport.c
The following functions are (almost) identical: verify_remote_names update_tracking_ref refs_pushed print_push_status Move common versions of these functions to transport.c and rename them, as suggested by Jeff King and Junio C Hamano. These functions have been removed entirely from builtin-send-pack.c, since they are only used internally by print_push_status(): print_ref_status status_abbrev print_ok_ref_status print_one_push_status Also, move #define SUMMARY_WIDTH to transport.h and rename it TRANSPORT_SUMMARY_WIDTH as it is used in builtin-fetch.c and transport.c Signed-off-by: Michael Lukashov <michael.lukashov@gmail.com> Acked-by: Tay Ray Chuan <rctay89@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'transport.h')
-rw-r--r--transport.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/transport.h b/transport.h
index 7cea5cc72..7a9bb57d9 100644
--- a/transport.h
+++ b/transport.h
@@ -92,6 +92,7 @@ struct transport {
#define TRANSPORT_PUSH_PORCELAIN 32
#define TRANSPORT_PUSH_QUIET 64
#define TRANSPORT_PUSH_SET_UPSTREAM 128
+#define TRANSPORT_SUMMARY_WIDTH (2 * DEFAULT_ABBREV + 3)
/* Returns a transport suitable for the url */
struct transport *transport_get(struct remote *, const char *);
@@ -142,4 +143,14 @@ int transport_connect(struct transport *transport, const char *name,
/* Transport methods defined outside transport.c */
int transport_helper_init(struct transport *transport, const char *name);
+/* common methods used by transport.c and builtin-send-pack.c */
+void transport_verify_remote_names(int nr_heads, const char **heads);
+
+void transport_update_tracking_ref(struct remote *remote, struct ref *ref, int verbose);
+
+int transport_refs_pushed(struct ref *ref);
+
+void transport_print_push_status(const char *dest, struct ref *refs,
+ int verbose, int porcelain, int *nonfastforward);
+
#endif