{"thread":{"id":"20501","subject":"[PATCH 8/8] Allow helpers to request marks for fast-import","startedAt":"2009-08-09T19:28:28Z","lastAt":"2009-08-09T21:27:11Z","messageCount":3,"participants":["Daniel Barkalow","Johan Herland","Sverre Rabbelier"],"isPatch":true,"patchVersion":1,"patchTotal":8},"messages":[{"id":"120076","messageId":"alpine.LNX.2.00.0908091527480.27553@iabervon.org","threadId":"20501","inReplyTo":null,"subject":"[PATCH 8/8] Allow helpers to request marks for fast-import","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2009-08-09T19:28:28Z","receivedAt":"2009-08-09T19:28:28Z","isPatch":true,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"From: Johan Herland <johan@herland.net>\n\nThe 'marks' capability is reported by the remote helper if it requires\nthe fast-import marks database to loaded/saved by any git-fast-import\nprocess that is provided by the transport machinery. The feature is\nadvertised along with exactly one argument: the location of the file\ncontaining the marks database.\n\nSigned-off-by: Johan Herland <johan@herland.net>\nSigned-off-by: Daniel Barkalow <barkalow@iabervon.org>\n---\n Documentation/git-remote-helpers.txt |    8 ++++++++\n transport-helper.c                   |   15 +++++++++++++++\n 2 files changed, 23 insertions(+), 0 deletions(-)\n\ndiff --git a/Documentation/git-remote-helpers.txt b/Documentation/git-remote-helpers.txt\nindex 2c5130f..9a3c5bc 100644\n--- a/Documentation/git-remote-helpers.txt\n+++ b/Documentation/git-remote-helpers.txt\n@@ -67,6 +67,14 @@ CAPABILITIES\n 'import'::\n \tThis helper supports the 'import' command.\n \n+'marks' filename::\n+\tHelper requires the marks from a git-fast-import run to be\n+\tloaded from, and saved to, the given filename. When this\n+\t\"feature\" is advertised, each git-fast-import run must load\n+\tand save the internal marks database (see the --import-marks\n+\tand --export-marks option to git-fast-import for more details)\n+\tlocated at the given filename.\n+\n REF LIST ATTRIBUTES\n -------------------\n \ndiff --git a/transport-helper.c b/transport-helper.c\nindex 8134ff4..cc99368 100644\n--- a/transport-helper.c\n+++ b/transport-helper.c\n@@ -10,6 +10,8 @@ struct helper_data\n {\n \tconst char *name;\n \tstruct child_process *helper;\n+\n+\tchar *marks_filename;\n \tunsigned fetch : 1;\n \tunsigned import : 1;\n };\n@@ -53,6 +55,8 @@ static struct child_process *get_helper(struct transport *transport)\n \t\t\tdata->fetch = 1;\n \t\tif (!strcmp(buf.buf, \"import\"))\n \t\t\tdata->import = 1;\n+\t\tif (!prefixcmp(buf.buf, \"marks \"))\n+\t\t\tdata->marks_filename = xstrdup(buf.buf + 6);\n \t}\n \treturn data->helper;\n }\n@@ -105,6 +109,15 @@ static int get_importer(struct transport *transport, struct child_process *fasti\n \tfastimport->argv = xcalloc(5, sizeof(*fastimport->argv));\n \tfastimport->argv[0] = \"fast-import\";\n \tfastimport->argv[1] = \"--quiet\";\n+\tif (data->marks_filename) {\n+\t\tstruct strbuf buf = STRBUF_INIT;\n+\t\tstrbuf_addf(&buf, \"--export-marks=%s\", data->marks_filename);\n+\t\tfastimport->argv[2] = strbuf_detach(&buf, 0);\n+\t\tif (!access(data->marks_filename, R_OK)) {\n+\t\t\tstrbuf_addf(&buf, \"--import-marks=%s\", data->marks_filename);\n+\t\t\tfastimport->argv[3] = strbuf_detach(&buf, 0);\n+\t\t}\n+\t}\n \n \tfastimport->git_cmd = 1;\n \treturn start_command(fastimport);\n@@ -133,6 +146,8 @@ static int fetch_with_import(struct transport *transport,\n \t}\n \tdisconnect_helper(transport);\n \tfinish_command(&fastimport);\n+\tfree((char *) fastimport.argv[2]);\n+\tfree((char *) fastimport.argv[3]);\n \n \tfor (i = 0; i < nr_heads; i++) {\n \t\tposn = to_fetch[i];\n-- \n1.6.4.183.g77eb9.dirty\n"},{"id":"120091","messageId":"200908092325.53040.johan@herland.net","threadId":"20501","inReplyTo":"alpine.LNX.2.00.0908091527480.27553@iabervon.org","subject":"Re: [PATCH 8/8] Allow helpers to request marks for fast-import","fromName":"Johan Herland","fromEmail":"johan@herland.net","sentAt":"2009-08-09T21:25:52Z","receivedAt":"2009-08-09T21:25:52Z","isPatch":true,"sender":{"key":"johan@herland.net","avatar":"https://avatars.githubusercontent.com/u/547031?v=4"},"body":"On Sunday 09 August 2009, Daniel Barkalow wrote:\n> From: Johan Herland <johan@herland.net>\n>\n> The 'marks' capability is reported by the remote helper if it requires\n> the fast-import marks database to loaded/saved by any git-fast-import\n> process that is provided by the transport machinery. The feature is\n> advertised along with exactly one argument: the location of the file\n> containing the marks database.\n>\n> Signed-off-by: Johan Herland <johan@herland.net>\n> Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>\n\nNote that this patch can be dropped if Sverre Rabbelier's suggestion of \nadding an \"option\" command to fast-import is accepted: \nhttp://thread.gmane.org/gmane.comp.version-control.git/124655\n\nIn that case, the CVS helper (or any other helper) can use the \"option\" \nfast-import command instead of having to tell transport-helper.c to invoke \nfast-import appropriately. Seems like a somewhat cleaner solution to me...\n\n\nHave fun!\n\n...Johan\n"},{"id":"120092","messageId":"fabb9a1e0908091427q5dc871dax4fa866d4e0fe8016@mail.gmail.com","threadId":"20501","inReplyTo":"200908092325.53040.johan@herland.net","subject":"Re: [PATCH 8/8] Allow helpers to request marks for fast-import","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2009-08-09T21:27:11Z","receivedAt":"2009-08-09T21:27:11Z","isPatch":true,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Sun, Aug 9, 2009 at 14:25, Johan Herland<johan@herland.net> wrote:\n> In that case, the CVS helper (or any other helper) can use the \"option\"\n> fast-import command instead of having to tell transport-helper.c to invoke\n> fast-import appropriately. Seems like a somewhat cleaner solution to me...\n\nAh, another use case! I guess I'll go clean up my series and resend it then ;).\n\n-- \nCheers,\n\nSverre Rabbelier\n"}]}