{"thread":{"id":"20390","subject":"[PATCH 10/13] Allow helpers to request marks for fast-import","startedAt":"2009-08-05T05:02:17Z","lastAt":"2009-08-05T21:05:53Z","messageCount":2,"participants":["Daniel Barkalow","Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":13},"messages":[{"id":"119570","messageId":"alpine.LNX.2.00.0908050056050.2147@iabervon.org","threadId":"20390","inReplyTo":null,"subject":"[PATCH 10/13] Allow helpers to request marks for fast-import","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2009-08-05T05:02:17Z","receivedAt":"2009-08-05T05:02:17Z","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 956cece..cc8707f 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@@ -50,6 +52,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@@ -101,6 +105,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@@ -127,6 +140,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.rc3.27.g95032.dirty\n"},{"id":"119693","messageId":"alpine.DEB.1.00.0908052304490.8306@pacific.mpi-cbg.de","threadId":"20390","inReplyTo":"alpine.LNX.2.00.0908050056050.2147@iabervon.org","subject":"Re: [PATCH 10/13] Allow helpers to request marks for fast-import","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-08-05T21:05:53Z","receivedAt":"2009-08-05T21:05:53Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 5 Aug 2009, Daniel Barkalow wrote:\n\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\nShould the name not rather be specified when _asking_ for the marks, \nrather than at the time when we do not even know if the caller _needs_ \nmarks?\n\nCiao,\nDscho\n"}]}