{"thread":{"id":"14765","subject":"[PATCH] Add NO_RSYNC to allow building without rsync","startedAt":"2008-07-30T18:52:25Z","lastAt":"2008-07-30T21:42:09Z","messageCount":6,"participants":["Aidan Van Dyk","Linus Torvalds","Junio C Hamano","Boyd Lynn Gerber"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"85670","messageId":"20080730185225.GG10399@yugib.highrise.ca","threadId":"14765","inReplyTo":null,"subject":"[PATCH] Add NO_RSYNC to allow building without rsync","fromName":"Aidan Van Dyk","fromEmail":"aidan@highrise.ca","sentAt":"2008-07-30T18:52:25Z","receivedAt":"2008-07-30T18:52:25Z","isPatch":true,"sender":{"key":"aidan@highrise.ca","avatar":"https://gravatar.com/avatar/853c50d90cce753dc1c390fdc6cbed558f5f969bd43fa4f5cb0118d8f71316f6?d=mp&s=160"},"body":"This is similar to NO_CURL.\n\nSigned-off-by: Aidan Van Dyk <aidan@highrise.ca>\n---\n\nI came about this because SCO OpenServer doesnt' have mkdtemp.  But I never use\nrsync, so making it optional was an easy fix.\n\n Makefile    |    4 ++++\n transport.c |    9 ++++++++-\n 2 files changed, 12 insertions(+), 1 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 798a2f2..b0a2985 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -789,6 +789,10 @@ else\n        CC_LD_DYNPATH = -R\n endif\n\n+ifdef NO_RSYNC\n+       BASIC_CFLAGS += -DNO_RSYNC\n+endif\n+\n ifdef NO_CURL\n        BASIC_CFLAGS += -DNO_CURL\n else\ndiff --git a/transport.c b/transport.c\nindex 6eb65b8..867b01f 100644\n--- a/transport.c\n+++ b/transport.c\n@@ -142,6 +142,7 @@ static void insert_packed_refs(const char *packed_refs, struct ref **list)\n        }\n }\n\n+#ifndef NO_RSYNC\n static struct ref *get_refs_via_rsync(struct transport *transport)\n {\n        struct strbuf buf = STRBUF_INIT, temp_dir = STRBUF_INIT;\n@@ -232,6 +233,7 @@ static int fetch_objs_via_rsync(struct transport *transport,\n\n        return result;\n }\n+#endif\n\n static int write_one_ref(const char *name, const unsigned char *sha1,\n                int flags, void *data)\n@@ -276,6 +278,7 @@ static int write_refs_to_temp_dir(struct strbuf *temp_dir,\n        return 0;\n }\n\n+#ifndef NO_RSYNC\n static int rsync_transport_push(struct transport *transport,\n                int refspec_nr, const char **refspec, int flags)\n {\n@@ -345,6 +348,7 @@ static int rsync_transport_push(struct transport *transport,\n\n        return result;\n }\n+#endif\n\n /* Generic functions for using commit walkers */\n\n@@ -731,10 +735,13 @@ struct transport *transport_get(struct remote *remote, const char *url)\n        ret->url = url;\n\n        if (!prefixcmp(url, \"rsync://\")) {\n+#ifdef NO_RSYNC\n+               error(\"git was compiled without rsync support.\");\n+#else\n                ret->get_refs_list = get_refs_via_rsync;\n                ret->fetch = fetch_objs_via_rsync;\n                ret->push = rsync_transport_push;\n-\n+#endif\n        } else if (!prefixcmp(url, \"http://\")\n                || !prefixcmp(url, \"https://\")\n                || !prefixcmp(url, \"ftp://\")) {\n--\n1.6.0.rc1.dirty\n"},{"id":"85675","messageId":"alpine.LFD.1.10.0807301231050.3334@nehalem.linux-foundation.org","threadId":"14765","inReplyTo":"20080730185225.GG10399@yugib.highrise.ca","subject":"Re: [PATCH] Add NO_RSYNC to allow building without rsync","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2008-07-30T19:33:17Z","receivedAt":"2008-07-30T19:33:17Z","isPatch":true,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Wed, 30 Jul 2008, Aidan Van Dyk wrote:\n> \n> I came about this because SCO OpenServer doesnt' have mkdtemp.  But I never use\n> rsync, so making it optional was an easy fix.\n\nHmm. Without mkdtemp(), maybe you could just do a trivial compat function \nsomethin glike\n\n\tchar *git_mkdtemp(char *template)\n\t{\n\t\tchar *n = mktemp(template);\n\t\tif (mkdir(n))\n\t\t\tn = NULL;\n\t\treturn n;\n\t}\n\ninstead?\n\n\t\tLinus\n"},{"id":"85676","messageId":"20080730194905.GI10399@yugib.highrise.ca","threadId":"14765","inReplyTo":"alpine.LFD.1.10.0807301231050.3334@nehalem.linux-foundation.org","subject":"Re: [PATCH] Add NO_RSYNC to allow building without rsync","fromName":"Aidan Van Dyk","fromEmail":"aidan@highrise.ca","sentAt":"2008-07-30T19:49:05Z","receivedAt":"2008-07-30T19:49:05Z","isPatch":true,"sender":{"key":"aidan@highrise.ca","avatar":"https://gravatar.com/avatar/853c50d90cce753dc1c390fdc6cbed558f5f969bd43fa4f5cb0118d8f71316f6?d=mp&s=160"},"body":"* Linus Torvalds <torvalds@linux-foundation.org> [080730 15:42]:\n \n> Hmm. Without mkdtemp(), maybe you could just do a trivial compat function \n> somethin glike\n> \n> \tchar *git_mkdtemp(char *template)\n> \t{\n> \t\tchar *n = mktemp(template);\n> \t\tif (mkdir(n))\n> \t\t\tn = NULL;\n> \t\treturn n;\n> \t}\n> \n> instead?\n\n\nAnd as I go to whip that up (ya, I'm lazy and just needed a prod), I see\nit's already done:\n\n# Define NO_MKDTEMP if you don't have mkdtemp in the C library.\n\nBut since rsync isn't available on this compile anyways, I still think\nNO_RSYNC is worth having on it's own, just like NO_CURL or NO_TCLTK\n\na.\n\n-- \nAidan Van Dyk                                             Create like a god,\naidan@highrise.ca                                       command like a king,\nhttp://www.highrise.ca/                                   work like a slave.\n"},{"id":"85680","messageId":"7vod4f3zfu.fsf@gitster.siamese.dyndns.org","threadId":"14765","inReplyTo":"20080730185225.GG10399@yugib.highrise.ca","subject":"Re: [PATCH] Add NO_RSYNC to allow building without rsync","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-07-30T20:11:01Z","receivedAt":"2008-07-30T20:11:01Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Aidan Van Dyk <aidan@highrise.ca> writes:\n\n> This is similar to NO_CURL.\n\nI am not sure if this is a good change.\n\nWe link with libcurl so supporting NO_CURL makes sense for an environment\nwithout the library, but for rsync transport we just spawn it as a\nseparate process.  The net effect on a machine without rsync installed is\nthe same (you cannot use rsync transport), but you can later choose to\ninstall rsync and things will start working without recompiling git.\n\n> Signed-off-by: Aidan Van Dyk <aidan@highrise.ca>\n> ---\n>\n> I came about this because SCO OpenServer doesnt' have mkdtemp.  But I never use\n> rsync, so making it optional was an easy fix.\n\nPerhaps \"make NO_MKDTEMP=YesPlease\" is a much better fix for your\nparticular environment?\n\nThe patch is seriously whitespace damaged, in any case.\n"},{"id":"85684","messageId":"20080730204948.GK10399@yugib.highrise.ca","threadId":"14765","inReplyTo":"7vod4f3zfu.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] Add NO_RSYNC to allow building without rsync","fromName":"Aidan Van Dyk","fromEmail":"aidan@highrise.ca","sentAt":"2008-07-30T20:49:48Z","receivedAt":"2008-07-30T20:49:48Z","isPatch":true,"sender":{"key":"aidan@highrise.ca","avatar":"https://gravatar.com/avatar/853c50d90cce753dc1c390fdc6cbed558f5f969bd43fa4f5cb0118d8f71316f6?d=mp&s=160"},"body":"* Junio C Hamano <gitster@pobox.com> [080730 16:11]:\n\n> > I came about this because SCO OpenServer doesnt' have mkdtemp.  But I never use\n> > rsync, so making it optional was an easy fix.\n> \n> Perhaps \"make NO_MKDTEMP=YesPlease\" is a much better fix for your\n> particular environment?\n\nYes, I found that out after...\n\n> The patch is seriously whitespace damaged, in any case.\n\nOoops... copy-n-paste from git-format-patch|more on some crappy sco terminal\nthrough a screen session...  I guess someone in there translated tabs to\nspaces...\n\na.\n\n-- \nAidan Van Dyk                                             Create like a god,\naidan@highrise.ca                                       command like a king,\nhttp://www.highrise.ca/                                   work like a slave.\n"},{"id":"85694","messageId":"alpine.LNX.1.10.0807301539160.13032@xenau.zenez.com","threadId":"14765","inReplyTo":"20080730204948.GK10399@yugib.highrise.ca","subject":"Re: [PATCH] Add NO_RSYNC to allow building without rsync","fromName":"Boyd Lynn Gerber","fromEmail":"gerberb@zenez.com","sentAt":"2008-07-30T21:42:09Z","receivedAt":"2008-07-30T21:42:09Z","isPatch":true,"sender":{"key":"gerberb@zenez.com","avatar":null},"body":"On Wed, 30 Jul 2008, Aidan Van Dyk wrote:\n> * Junio C Hamano <gitster@pobox.com> [080730 16:11]:\n> > > I came about this because SCO OpenServer doesnt' have mkdtemp.  But I never use\n> > > rsync, so making it optional was an easy fix.\n> > \n> > Perhaps \"make NO_MKDTEMP=YesPlease\" is a much better fix for your\n> > particular environment?\n> \n> Yes, I found that out after...\n> \n> > The patch is seriously whitespace damaged, in any case.\n> \n> Ooops... copy-n-paste from git-format-patch|more on some crappy sco terminal\n> through a screen session...  I guess someone in there translated tabs to\n> spaces...\n\nI do have rsync.  I use it all the time on OpenServer 6.  I have automated \nrsync backups of certain Openserver 6 machines.\n\ntech0 > rsync --version\nrsync  version 3.0.2  protocol version 30\nCopyright (C) 1996-2008 by Andrew Tridgell, Wayne Davison, and others.\nWeb site: http://rsync.samba.org/\nCapabilities:\n    64-bit files, 64-bit inums, 32-bit timestamps, 64-bit long ints,\n    socketpairs, hardlinks, symlinks, no IPv6, batchfiles, inplace,\n    append, ACLs, no xattrs, iconv, no symtimes\n\ntech0.zenez.com and osr600.zenez.com are OpenServer 6 machines.\n\n--\nBoyd Gerber <gerberb@zenez.com>\nZENEZ\t1042 East Fort Union #135, Midvale Utah  84047\n"}]}