{"thread":{"id":"18531","subject":"[PATCH 1/2] init: support --import to add all files and commit right after init","startedAt":"2009-03-25T10:58:40Z","lastAt":"2009-03-28T13:09:23Z","messageCount":14,"participants":["Nguyễn Thái Ngọc Duy","Jeff King","Santi Béjar","Johannes Schindelin","Nguyen Thai Ngoc Duy","Markus Heidelberg"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"109336","messageId":"1237978720-2500-1-git-send-email-pclouds@gmail.com","threadId":"18531","inReplyTo":null,"subject":"[PATCH 1/2] init: support --import to add all files and commit right after init","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2009-03-25T10:58:40Z","receivedAt":"2009-03-25T10:58:40Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"This is equivalent to \"git init;git add .;git commit -q -m blah\".\nI find myself doing that too many times, hence this shortcut.\n\nIn future, --fast-import support would also be nice if the import\ndirectory has a lot of files.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n Documentation/git-init.txt |   17 ++++++++++++++-\n builtin-init-db.c          |   49 ++++++++++++++++++++++++++++++++++++++++---\n t/t0001-init.sh            |   44 +++++++++++++++++++++++++++++++++++++++\n 3 files changed, 105 insertions(+), 5 deletions(-)\n\ndiff --git a/Documentation/git-init.txt b/Documentation/git-init.txt\nindex 71749c0..ab75c10 100644\n--- a/Documentation/git-init.txt\n+++ b/Documentation/git-init.txt\n@@ -8,7 +8,8 @@ git-init - Create an empty git repository or reinitialize an existing one\n \n SYNOPSIS\n --------\n-'git init' [-q | --quiet] [--bare] [--template=<template_directory>] [--shared[=<permissions>]]\n+'git init' [-q | --quiet] [--bare] [--template=<template_directory>]\n+           [--shared[=<permissions>]] [-m|--import [<message>]]\n \n \n OPTIONS\n@@ -68,6 +69,20 @@ By default, the configuration flag receive.denyNonFastForwards is enabled\n in shared repositories, so that you cannot force a non fast-forwarding push\n into it.\n \n+-m <message>::\n+--import <message>::\n+\n+Commit everything to the newly initialized repository. This is equivalent to:\n+\n+----------------\n+$ git init\n+$ git add .\n+$ git commit -q -m <message>\n+----------------\n+\n+If no message is given, \"Initial commit\" will be used.\n+This option does not work with `--bare` nor already initialized repository.\n+\n --\n \n \ndiff --git a/builtin-init-db.c b/builtin-init-db.c\nindex ee3911f..3ace4ca 100644\n--- a/builtin-init-db.c\n+++ b/builtin-init-db.c\n@@ -6,6 +6,7 @@\n #include \"cache.h\"\n #include \"builtin.h\"\n #include \"exec_cmd.h\"\n+#include \"run-command.h\"\n \n #ifndef DEFAULT_GIT_TEMPLATE_DIR\n #define DEFAULT_GIT_TEMPLATE_DIR \"/usr/share/git-core/templates\"\n@@ -19,6 +20,7 @@\n \n static int init_is_bare_repository = 0;\n static int init_shared_repository = -1;\n+static int reinit;\n \n static void safe_create_dir(const char *dir, int share)\n {\n@@ -279,7 +281,7 @@ int init_db(const char *template_dir, unsigned int flags)\n {\n \tconst char *sha1_dir;\n \tchar *path;\n-\tint len, reinit;\n+\tint len;\n \n \tsafe_create_dir(get_git_dir(), 0);\n \n@@ -363,8 +365,29 @@ static int guess_repository_type(const char *git_dir)\n \treturn 1;\n }\n \n+static int import_files(const char *import_message)\n+{\n+\tconst char *args[6];\n+\tint i = 0;\n+\tint ret;\n+\n+\targs[i++] = \"add\";\n+\targs[i++] = \".\";\n+\targs[i] = NULL;\n+\tret = run_command_v_opt(args, RUN_GIT_CMD);\n+\tif (ret)\n+\t\treturn ret;\n+\ti = 0;\n+\targs[i++] = \"commit\";\n+\targs[i++] = \"-q\";\n+\targs[i++] = \"-m\";\n+\targs[i++] = import_message;\n+\targs[i] = NULL;\n+\treturn run_command_v_opt(args, RUN_GIT_CMD);\n+}\n+\n static const char init_db_usage[] =\n-\"git init [-q | --quiet] [--bare] [--template=<template-directory>] [--shared[=<permissions>]]\";\n+\"git init [-q | --quiet] [--bare] [--template=<template-directory>] [--shared[=<permissions>]] [-m|--import [<message>]]\";\n \n /*\n  * If you want to, you can share the DB area with any number of branches.\n@@ -377,7 +400,8 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)\n \tconst char *git_dir;\n \tconst char *template_dir = NULL;\n \tunsigned int flags = 0;\n-\tint i;\n+\tconst char *import_message = NULL;\n+\tint ret, i;\n \n \tfor (i = 1; i < argc; i++, argv++) {\n \t\tconst char *arg = argv[1];\n@@ -392,12 +416,24 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)\n \t\t\tinit_shared_repository = PERM_GROUP;\n \t\telse if (!prefixcmp(arg, \"--shared=\"))\n \t\t\tinit_shared_repository = git_config_perm(\"arg\", arg+9);\n+\t\telse if (!strcmp(arg, \"--import\") || !strcmp(arg, \"-m\")) {\n+\t\t\tif (i+1 >= argc)\n+\t\t\t\timport_message = \"Initial commit\";\n+\t\t\telse {\n+\t\t\t\timport_message = argv[2];\n+\t\t\t\ti++;\n+\t\t\t\targv++;\n+\t\t\t}\n+\t\t}\n \t\telse if (!strcmp(arg, \"-q\") || !strcmp(arg, \"--quiet\"))\n \t\t\tflags |= INIT_DB_QUIET;\n \t\telse\n \t\t\tusage(init_db_usage);\n \t}\n \n+\tif (import_message && is_bare_repository_cfg == 1)\n+\t\tdie(\"--import does not work with --bare\");\n+\n \t/*\n \t * GIT_WORK_TREE makes sense only in conjunction with GIT_DIR\n \t * without --bare.  Catch the error early.\n@@ -440,5 +476,10 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)\n \n \tset_git_dir(make_absolute_path(git_dir));\n \n-\treturn init_db(template_dir, flags);\n+\tret = init_db(template_dir, flags);\n+\tif (ret || !import_message)\n+\t\treturn ret;\n+\tif (reinit)\n+\t\tdie(\"--import does not work with already initialized repository\");\n+\treturn import_files(import_message);\n }\ndiff --git a/t/t0001-init.sh b/t/t0001-init.sh\nindex 5ac0a27..83a9e06 100755\n--- a/t/t0001-init.sh\n+++ b/t/t0001-init.sh\n@@ -199,4 +199,48 @@ test_expect_success 'init honors global core.sharedRepository' '\n \tx`git config -f shared-honor-global/.git/config core.sharedRepository`\n '\n \n+test_expect_success 'init --import does not work with --bare' '\n+\t(\n+\t\tunset GIT_DIR GIT_WORK_TREE GIT_CONFIG\n+\t\tmkdir init-import-bare.git &&\n+\t\tcd init-import-bare.git &&\n+\t\t! git init --bare --import test\n+\t)\n+\n+'\n+\n+test_expect_success 'init --import no message' '\n+\t(\n+\t\ttest_tick\n+\t\tunset GIT_DIR GIT_WORK_TREE GIT_CONFIG\n+\t\tmkdir init-import-nomsg &&\n+\t\tcd init-import-nomsg &&\n+\t\ttouch foo bar &&\n+\t\tgit init --import &&\n+\t\ttest \"$(git rev-parse HEAD)\" = 4ff955458fd61a7b5d798b81e28c9249e8ebb5df\n+\t)\n+'\n+\n+test_expect_success 'init --import' '\n+\t(\n+\t\ttest_tick\n+\t\tunset GIT_DIR GIT_WORK_TREE GIT_CONFIG\n+\t\tmkdir init-import &&\n+\t\tcd init-import &&\n+\t\ttouch foo bar &&\n+\t\tgit init --import test &&\n+\t\ttest \"$(git rev-parse HEAD)\" = 758aa5a579e42200a6fd4e4964c7e1dc1875d67d\n+\t)\n+'\n+\n+test_expect_success 'init --import on already init(ed) should fail' '\n+\t(\n+\t\ttest_tick\n+\t\tunset GIT_DIR GIT_WORK_TREE GIT_CONFIG\n+\t\tcd init-import &&\n+\t\t! git init --import testagain &&\n+\t\ttest \"$(git rev-parse HEAD)\" = 758aa5a579e42200a6fd4e4964c7e1dc1875d67d\n+\t)\n+'\n+\n test_done\n-- \n1.6.1.446.gc7851\n"},{"id":"109341","messageId":"20090325113510.GB4437@coredump.intra.peff.net","threadId":"18531","inReplyTo":"1237978720-2500-1-git-send-email-pclouds@gmail.com","subject":"Re: [PATCH 1/2] init: support --import to add all files and commit right after init","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-03-25T11:35:10Z","receivedAt":"2009-03-25T11:35:10Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Mar 25, 2009 at 09:58:40PM +1100, Nguyễn Thái Ngọc Duy wrote:\n\n> -'git init' [-q | --quiet] [--bare] [--template=<template_directory>] [--shared[=<permissions>]]\n> +'git init' [-q | --quiet] [--bare] [--template=<template_directory>]\n> +           [--shared[=<permissions>]] [-m|--import [<message>]]\n\nWhat happened to --import=? Whether or not \"--import <arg>\" works, the\n--long-opt= form should always work.\n\n> +\t\telse if (!strcmp(arg, \"--import\") || !strcmp(arg, \"-m\")) {\n> +\t\t\tif (i+1 >= argc)\n> +\t\t\t\timport_message = \"Initial commit\";\n> +\t\t\telse {\n> +\t\t\t\timport_message = argv[2];\n> +\t\t\t\ti++;\n> +\t\t\t\targv++;\n> +\t\t\t}\n> +\t\t}\n\nThis is the wrong way to do optional arguments. It means that\n\n  git init --template=foo --import\n\nis different from\n\n  git init --import --template=foo\n\nI think what you want is:\n\n  else if (!strcmp(arg, \"-m\")) {\n    if (i+1 >= argc)\n      die(\"-m requires an import message\");\n    import_message = argv[2];\n    i++;\n    argv++;\n  }\n  else if (!strcmp(arg, \"--import\"))\n    import_message = \"Initial commit\";\n  else if (!prefixcmp(arg, \"--import=\"))\n      import_message = arg+9;\n\nThat is, --import has a message or not depending on the '=', and \"-m\"\nalways has a message. If you want \"-m\" to optionally have a message then\nit must be used as\n\n  git init -mfoo\n\n-Peff\n"},{"id":"109345","messageId":"adf1fd3d0903250456l3c14a863pd6ee00c0025100c4@mail.gmail.com","threadId":"18531","inReplyTo":"1237978720-2500-1-git-send-email-pclouds@gmail.com","subject":"Re: [PATCH 1/2] init: support --import to add all files and commit right after init","fromName":"Santi Béjar","fromEmail":"santi@agolina.net","sentAt":"2009-03-25T11:56:02Z","receivedAt":"2009-03-25T11:56:02Z","isPatch":true,"sender":{"key":"santi@agolina.net","avatar":null},"body":"2009/3/25 Nguyễn Thái Ngọc Duy <pclouds@gmail.com>:\n> +-m <message>::\n> +--import <message>::\n> +\n> +Commit everything to the newly initialized repository. This is equivalent to:\n> +\n> +----------------\n> +$ git init\n> +$ git add .\n> +$ git commit -q -m <message>\n> +----------------\n> +\n> +If no message is given, \"Initial commit\" will be used.\n\nWhy a default message and not running the editor?\n\nSanti\n"},{"id":"109350","messageId":"alpine.DEB.1.00.0903251338130.26370@intel-tinevez-2-302","threadId":"18531","inReplyTo":"adf1fd3d0903250456l3c14a863pd6ee00c0025100c4@mail.gmail.com","subject":"Re: [PATCH 1/2] init: support --import to add all files and commit right after init","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-03-25T12:38:30Z","receivedAt":"2009-03-25T12:38:30Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 25 Mar 2009, Santi Béjar wrote:\n\n> 2009/3/25 Nguyễn Thái Ngọc Duy <pclouds@gmail.com>:\n> > +-m <message>::\n> > +--import <message>::\n> > +\n> > +Commit everything to the newly initialized repository. This is equivalent to:\n> > +\n> > +----------------\n> > +$ git init\n> > +$ git add .\n> > +$ git commit -q -m <message>\n> > +----------------\n> > +\n> > +If no message is given, \"Initial commit\" will be used.\n> \n> Why a default message and not running the editor?\n\nBecause I would say \"Initial commit\" anyway.\n\nCiao,\nDscho\n"},{"id":"109351","messageId":"20090325124219.GA5307@coredump.intra.peff.net","threadId":"18531","inReplyTo":"alpine.DEB.1.00.0903251338130.26370@intel-tinevez-2-302","subject":"Re: [PATCH 1/2] init: support --import to add all files and commit right after init","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-03-25T12:42:19Z","receivedAt":"2009-03-25T12:42:19Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Mar 25, 2009 at 01:38:30PM +0100, Johannes Schindelin wrote:\n\n> > > +If no message is given, \"Initial commit\" will be used.\n> > \n> > Why a default message and not running the editor?\n> \n> Because I would say \"Initial commit\" anyway.\n\nAgreed. This feature is about convenience. If you really want to say\nsomething more exciting, then use \"git commit\" directly. Heck, you can\neven \"git commit --amend\" it afterwards.\n\n-Peff\n"},{"id":"109352","messageId":"adf1fd3d0903250549l60e4a2d1j8bd57ba66d24a678@mail.gmail.com","threadId":"18531","inReplyTo":"20090325124219.GA5307@coredump.intra.peff.net","subject":"Re: [PATCH 1/2] init: support --import to add all files and commit right after init","fromName":"Santi Béjar","fromEmail":"santi@agolina.net","sentAt":"2009-03-25T12:49:40Z","receivedAt":"2009-03-25T12:49:40Z","isPatch":true,"sender":{"key":"santi@agolina.net","avatar":null},"body":"2009/3/25 Jeff King <peff@peff.net>:\n> On Wed, Mar 25, 2009 at 01:38:30PM +0100, Johannes Schindelin wrote:\n>\n>> > > +If no message is given, \"Initial commit\" will be used.\n>> >\n>> > Why a default message and not running the editor?\n>>\n>> Because I would say \"Initial commit\" anyway.\n\nAnd I would say \"Commit inicial\".\n\n>\n> Agreed. This feature is about convenience.\n\n... for project in english.\n\n> If you really want to say\n> something more exciting, then use \"git commit\" directly. Heck, you can\n> even \"git commit --amend\" it afterwards.\n\nI can. But then it is no longer \"convenience\".\n\nBut anyway, it is like the \"Merge branch...\" commit message for\nmerges. So nothing new.\n\nSanti\n"},{"id":"109440","messageId":"fcaeb9bf0903251554o5c6d390cmbb81d06f9886f8e2@mail.gmail.com","threadId":"18531","inReplyTo":"20090325113510.GB4437@coredump.intra.peff.net","subject":"Re: [PATCH 1/2] init: support --import to add all files and commit right after init","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2009-03-25T22:54:56Z","receivedAt":"2009-03-25T22:54:56Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"2009/3/25 Jeff King <peff@peff.net>:\n> On Wed, Mar 25, 2009 at 09:58:40PM +1100, Nguyễn Thái Ngọc Duy wrote:\n>\n>> -'git init' [-q | --quiet] [--bare] [--template=<template_directory>] [--shared[=<permissions>]]\n>> +'git init' [-q | --quiet] [--bare] [--template=<template_directory>]\n>> +           [--shared[=<permissions>]] [-m|--import [<message>]]\n>\n> What happened to --import=? Whether or not \"--import <arg>\" works, the\n> --long-opt= form should always work.\n>\n>> +             else if (!strcmp(arg, \"--import\") || !strcmp(arg, \"-m\")) {\n>> +                     if (i+1 >= argc)\n>> +                             import_message = \"Initial commit\";\n>> +                     else {\n>> +                             import_message = argv[2];\n>> +                             i++;\n>> +                             argv++;\n>> +                     }\n>> +             }\n>\n> This is the wrong way to do optional arguments. It means that\n>\n>  git init --template=foo --import\n>\n> is different from\n>\n>  git init --import --template=foo\n>\n> I think what you want is:\n>\n>  else if (!strcmp(arg, \"-m\")) {\n>    if (i+1 >= argc)\n>      die(\"-m requires an import message\");\n>    import_message = argv[2];\n>    i++;\n>    argv++;\n>  }\n>  else if (!strcmp(arg, \"--import\"))\n>    import_message = \"Initial commit\";\n>  else if (!prefixcmp(arg, \"--import=\"))\n>      import_message = arg+9;\n>\n> That is, --import has a message or not depending on the '=', and \"-m\"\n> always has a message. If you want \"-m\" to optionally have a message then\n> it must be used as\n>\n>  git init -mfoo\n\nRight. Should not work late (or send it in the same night). Will rework.\n-- \nDuy\n"},{"id":"109574","messageId":"200903262223.28546.markus.heidelberg@web.de","threadId":"18531","inReplyTo":"adf1fd3d0903250549l60e4a2d1j8bd57ba66d24a678@mail.gmail.com","subject":"Re: [PATCH 1/2] init: support --import to add all files and commit right after init","fromName":"Markus Heidelberg","fromEmail":"markus.heidelberg@web.de","sentAt":"2009-03-26T21:23:27Z","receivedAt":"2009-03-26T21:23:27Z","isPatch":true,"sender":{"key":"markus.heidelberg@web.de","avatar":"https://avatars.githubusercontent.com/u/6334512?v=4"},"body":"Santi Béjar, 25.03.2009:\n> 2009/3/25 Jeff King <peff@peff.net>:\n> > On Wed, Mar 25, 2009 at 01:38:30PM +0100, Johannes Schindelin wrote:\n> >\n> >> > > +If no message is given, \"Initial commit\" will be used.\n> >> >\n> >> > Why a default message and not running the editor?\n> >>\n> >> Because I would say \"Initial commit\" anyway.\n> \n> And I would say \"Commit inicial\".\n\nAnd I would describe the current state in a few words.\n\nInvoking an editor is more universal and I don't think the majority\nwould be contented with \"Initial commit\".\n\nMarkus\n"},{"id":"109591","messageId":"alpine.DEB.1.00.0903270259470.10279@pacific.mpi-cbg.de","threadId":"18531","inReplyTo":"200903262223.28546.markus.heidelberg@web.de","subject":"Re: [PATCH 1/2] init: support --import to add all files and commit right after init","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-03-27T02:03:07Z","receivedAt":"2009-03-27T02:03:07Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 26 Mar 2009, Markus Heidelberg wrote:\n\n> Santi Béjar, 25.03.2009:\n> > 2009/3/25 Jeff King <peff@peff.net>:\n> > > On Wed, Mar 25, 2009 at 01:38:30PM +0100, Johannes Schindelin wrote:\n> > >\n> > >> > > +If no message is given, \"Initial commit\" will be used.\n> > >> >\n> > >> > Why a default message and not running the editor?\n> > >>\n> > >> Because I would say \"Initial commit\" anyway.\n> > \n> > And I would say \"Commit inicial\".\n> \n> And I would describe the current state in a few words.\n> \n> Invoking an editor is more universal and I don't think the majority\n> would be contented with \"Initial commit\".\n\n_Again_, as Peff pointed out, you are welcome to use the current method of \ngit init && git add . && git commit, which _does_ launch an editor.\n\nThe fact that you want to spend much time (anyway) doing your initial \ncommit does not allow you to inconvenience others.\n\nOthers who want to have a quick way to work safely with something they \nmight need to change, and might then want to use the full power of Git to \nsee what they changed.  Without any need for a \"nice\" first commit.\n\nCiao,\nDscho\n"},{"id":"109601","messageId":"20090327050626.GA23512@coredump.intra.peff.net","threadId":"18531","inReplyTo":"alpine.DEB.1.00.0903270259470.10279@pacific.mpi-cbg.de","subject":"Re: [PATCH 1/2] init: support --import to add all files and commit right after init","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-03-27T05:06:26Z","receivedAt":"2009-03-27T05:06:26Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Mar 27, 2009 at 03:03:07AM +0100, Johannes Schindelin wrote:\n\n> _Again_, as Peff pointed out, you are welcome to use the current method of \n> git init && git add . && git commit, which _does_ launch an editor.\n> \n> The fact that you want to spend much time (anyway) doing your initial \n> commit does not allow you to inconvenience others.\n\nAnother option would be a patch on top of the original to allow\n\n  git config --global init.importmessage 'Commit inicial'\n\nor\n\n  git config --global init.importeditor true\n\nI have no interest in writing such a patch, but I don't see a reason to\nreject it.\n\n-Peff\n"},{"id":"109602","messageId":"20090327050828.GA23568@coredump.intra.peff.net","threadId":"18531","inReplyTo":"20090327050626.GA23512@coredump.intra.peff.net","subject":"Re: [PATCH 1/2] init: support --import to add all files and commit right after init","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-03-27T05:08:28Z","receivedAt":"2009-03-27T05:08:28Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Mar 27, 2009 at 01:06:26AM -0400, Jeff King wrote:\n\n> Another option would be a patch on top of the original to allow\n> \n>   git config --global init.importmessage 'Commit inicial'\n> \n> or\n> \n>   git config --global init.importeditor true\n> \n> I have no interest in writing such a patch, but I don't see a reason to\n> reject it.\n\nActually, there is one possible reason to reject it: scripts could not\nrely on the behavior of \"--import\" without it. But I think it is OK to\nmake a conscious decision that this is a feature for _humans_, and that\nscripts can use \"init && add && commit\" (or they can be happy with\ndealing with the human's choice of editor or not).\n\n-Peff\n"},{"id":"109700","messageId":"200903281158.51012.markus.heidelberg@web.de","threadId":"18531","inReplyTo":"alpine.DEB.1.00.0903270259470.10279@pacific.mpi-cbg.de","subject":"Re: [PATCH 1/2] init: support --import to add all files and commit right after init","fromName":"Markus Heidelberg","fromEmail":"markus.heidelberg@web.de","sentAt":"2009-03-28T10:58:50Z","receivedAt":"2009-03-28T10:58:50Z","isPatch":true,"sender":{"key":"markus.heidelberg@web.de","avatar":"https://avatars.githubusercontent.com/u/6334512?v=4"},"body":"Johannes Schindelin, 27.03.2009:\n> Others who want to have a quick way to work safely with something they \n> might need to change, and might then want to use the full power of Git to \n> see what they changed.  Without any need for a \"nice\" first commit.\n\nWhat's the difference between the first commit and the others? I don't\nsee the reason, not to have a short description for it.\n\nMarkus\n"},{"id":"109702","messageId":"alpine.DEB.1.00.0903281334490.12669@intel-tinevez-2-302","threadId":"18531","inReplyTo":"200903281158.51012.markus.heidelberg@web.de","subject":"Re: [PATCH 1/2] init: support --import to add all files and commit right after init","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-03-28T12:39:07Z","receivedAt":"2009-03-28T12:39:07Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sat, 28 Mar 2009, Markus Heidelberg wrote:\n\n> Johannes Schindelin, 27.03.2009:\n> > Others who want to have a quick way to work safely with something they \n> > might need to change, and might then want to use the full power of Git \n> > to see what they changed.  Without any need for a \"nice\" first commit.\n> \n> What's the difference between the first commit and the others? I don't \n> see the reason, not to have a short description for it.\n\nMaybe you can learn a new trick here:\n\n$ tar xf /some/random/project.tar\n$ git init\n$ git add .\n$ git commit -m initial\n\nand now one of two work flows:\n\n# get the thing to work properly, or add a new feature, or clean up...\n$ git diff > diff.patch\n# send the diff to the maintainer, without ever committing\n\nor\n\n# make a patch series, use rebase -i to clean up after it\n# send the patch series to the maintainer of the random project\n\nSee?  The initial commit does not matter at all.\n\nI do this so often that it stops being funny having to type three \ncommands.\n\nAnd having to edit a commit message I do not care about anyway everytime, \njust to please you, would not make it any funnier ;-)\n\nI'll just repeat one of my favorite mantras: optimize for the common case, \nnot for the uncommon case.\n\nCiao,\nDscho\n"},{"id":"109705","messageId":"200903281409.24266.markus.heidelberg@web.de","threadId":"18531","inReplyTo":"alpine.DEB.1.00.0903281334490.12669@intel-tinevez-2-302","subject":"Re: [PATCH 1/2] init: support --import to add all files and commit right after init","fromName":"Markus Heidelberg","fromEmail":"markus.heidelberg@web.de","sentAt":"2009-03-28T13:09:23Z","receivedAt":"2009-03-28T13:09:23Z","isPatch":true,"sender":{"key":"markus.heidelberg@web.de","avatar":"https://avatars.githubusercontent.com/u/6334512?v=4"},"body":"Johannes Schindelin, 28.03.2009:\n> Hi,\n> \n> On Sat, 28 Mar 2009, Markus Heidelberg wrote:\n> \n> > Johannes Schindelin, 27.03.2009:\n> > > Others who want to have a quick way to work safely with something they \n> > > might need to change, and might then want to use the full power of Git \n> > > to see what they changed.  Without any need for a \"nice\" first commit.\n> > \n> > What's the difference between the first commit and the others? I don't \n> > see the reason, not to have a short description for it.\n> \n> Maybe you can learn a new trick here:\n> \n> $ tar xf /some/random/project.tar\n> $ git init\n> $ git add .\n> $ git commit -m initial\n> \n> and now one of two work flows:\n> \n> # get the thing to work properly, or add a new feature, or clean up...\n> $ git diff > diff.patch\n> # send the diff to the maintainer, without ever committing\n> \n> or\n> \n> # make a patch series, use rebase -i to clean up after it\n> # send the patch series to the maintainer of the random project\n> \n> See?  The initial commit does not matter at all.\n\nYep, I only thought about own projects and didn't take this workflow\ninto account. Although I have already used it myself and of course the\ninitial commit is not interesting then.\n\n> I do this so often that it stops being funny having to type three \n> commands.\n> \n> And having to edit a commit message I do not care about anyway everytime, \n> just to please you, would not make it any funnier ;-)\n\nUnderstood :)\nBut note, that my second mail was only about writing an initial commit\nmessage or not. I don't have objections against the default commit\nmessage with --import any more.\n\nMarkus\n"}]}