{"thread":{"id":"49195","subject":"[PATCH 0/1] Teach the builtin rebase about the builtin interactive rebase","startedAt":"2018-08-22T21:35:25Z","lastAt":"2018-10-12T07:59:57Z","messageCount":22,"participants":["Johannes Schindelin via GitGitGadget","Junio C Hamano","Jonathan Nieder","Johannes Schindelin","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":1},"messages":[{"id":"356308","messageId":"pull.23.git.gitgitgadget@gmail.com","threadId":"49195","inReplyTo":null,"subject":"[PATCH 0/1] Teach the builtin rebase about the builtin interactive rebase","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2018-08-22T21:35:22Z","receivedAt":"2018-08-22T21:35:25Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"The builtin rebase and the builtin interactive rebase have been developed\nindependently, on purpose: Google Summer of Code rules specifically state\nthat students have to work on independent projects, they cannot collaborate\non the same project.\n\nThe reason is probably the very fine tradition in academia to prohibit\nteamwork, which makes grading easier (at the expense of not exactly\npreparing the students for the real world, unless they want to stay in\nacademia).\n\nOne fallout is that the rebase-in-c and rebase-i-in-c patches cause no merge\nconflicts but a royal number of tests in the test suite to fail.\n\nIt is easy to explain why: rebase-in-c was developed under the assumption\nthat all rebase backends are implemented in Unix shell script and can be\nsourced via . git-rebase--<backend>, which is no longer true with \nrebase-i-in-c, where git-rebase--interactive is a hard-linked builtin.\n\nThis patch fixes that.\n\nNote: while this patch targets pk/rebase-in-c-6-final, it will not work\ncorrectly without ag/rebase-i-in-c. So my suggestion is to rewrite the \npk/rebas-in-c-6-final branch by first merging ag/rebase-i-in-c, then\napplying this here patch, and only then cherry-pick \"rebase: default to\nusing the builtin rebase\".\n\nJohannes Schindelin (1):\n  builtin rebase: prepare for builtin rebase -i\n\n builtin/rebase.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 81 insertions(+)\n\n\nbase-commit: a5bb2345d2d414aba04e18531de1e0f041f0434a\nPublished-As: https://github.com/gitgitgadget/git/releases/tags/pr-23%2Fdscho%2Frebase-in-c-6-final-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-23/dscho/rebase-in-c-6-final-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/23\n-- \ngitgitgadget\n"},{"id":"356309","messageId":"29d49819fa88e38d08be288d8ca0020e7aa4679e.1534973720.git.gitgitgadget@gmail.com","threadId":"49195","inReplyTo":"pull.23.git.gitgitgadget@gmail.com","subject":"[PATCH 1/1] builtin rebase: prepare for builtin rebase -i","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2018-08-22T21:35:23Z","receivedAt":"2018-08-22T21:35:27Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nIt is no longer a shell script, so we need to call it in a different way\nthan the other backends.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n builtin/rebase.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 81 insertions(+)\n\ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex c8d632b6f4..87590047b3 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -326,6 +326,13 @@ static void add_var(struct strbuf *buf, const char *name, const char *value)\n \t}\n }\n \n+static const char *resolvemsg =\n+N_(\"Resolve all conflicts manually, mark them as resolved with\\n\"\n+\"\\\"git add/rm <conflicted_files>\\\", then run \\\"git rebase --continue\\\".\\n\"\n+\"You can instead skip this commit: run \\\"git rebase --skip\\\".\\n\"\n+\"To abort and get back to the state before \\\"git rebase\\\", run \"\n+\"\\\"git rebase --abort\\\".\");\n+\n static int run_specific_rebase(struct rebase_options *opts)\n {\n \tconst char *argv[] = { NULL, NULL };\n@@ -333,6 +340,79 @@ static int run_specific_rebase(struct rebase_options *opts)\n \tint status;\n \tconst char *backend, *backend_func;\n \n+\tif (opts->type == REBASE_INTERACTIVE) {\n+\t\t/* Run builtin interactive rebase */\n+\t\tstruct child_process child = CHILD_PROCESS_INIT;\n+\n+\t\targv_array_pushf(&child.env_array, \"GIT_CHERRY_PICK_HELP=%s\",\n+\t\t\t\t resolvemsg);\n+\t\tif (!(opts->flags & REBASE_INTERACTIVE_EXPLICIT)) {\n+\t\t\targv_array_push(&child.env_array, \"GIT_EDITOR=:\");\n+\t\t\topts->autosquash = 0;\n+\t\t}\n+\n+\t\tchild.git_cmd = 1;\n+\t\targv_array_push(&child.args, \"rebase--interactive\");\n+\n+\t\tif (opts->action)\n+\t\t\targv_array_pushf(&child.args, \"--%s\", opts->action);\n+\t\tif (opts->keep_empty)\n+\t\t\targv_array_push(&child.args, \"--keep-empty\");\n+\t\tif (opts->rebase_merges)\n+\t\t\targv_array_push(&child.args, \"--rebase-merges\");\n+\t\tif (opts->rebase_cousins)\n+\t\t\targv_array_push(&child.args, \"--rebase-cousins\");\n+\t\tif (opts->autosquash)\n+\t\t\targv_array_push(&child.args, \"--autosquash\");\n+\t\tif (opts->flags & REBASE_VERBOSE)\n+\t\t\targv_array_push(&child.args, \"--verbose\");\n+\t\tif (opts->flags & REBASE_FORCE)\n+\t\t\targv_array_push(&child.args, \"--no-ff\");\n+\t\tif (opts->restrict_revision)\n+\t\t\targv_array_pushf(&child.args,\n+\t\t\t\t\t \"--restrict-revision=^%s\",\n+\t\t\t\t\t oid_to_hex(&opts->restrict_revision->object.oid));\n+\t\tif (opts->upstream)\n+\t\t\targv_array_pushf(&child.args, \"--upstream=%s\",\n+\t\t\t\t\t oid_to_hex(&opts->upstream->object.oid));\n+\t\tif (opts->onto)\n+\t\t\targv_array_pushf(&child.args, \"--onto=%s\",\n+\t\t\t\t\t oid_to_hex(&opts->onto->object.oid));\n+\t\tif (opts->squash_onto)\n+\t\t\targv_array_pushf(&child.args, \"--squash-onto=%s\",\n+\t\t\t\t\t oid_to_hex(opts->squash_onto));\n+\t\tif (opts->onto_name)\n+\t\t\targv_array_pushf(&child.args, \"--onto-name=%s\",\n+\t\t\t\t\t opts->onto_name);\n+\t\targv_array_pushf(&child.args, \"--head-name=%s\",\n+\t\t\t\t opts->head_name ?\n+\t\t\t\t opts->head_name : \"detached HEAD\");\n+\t\tif (opts->strategy)\n+\t\t\targv_array_pushf(&child.args, \"--strategy=%s\",\n+\t\t\t\t\t opts->strategy);\n+\t\tif (opts->strategy_opts)\n+\t\t\targv_array_pushf(&child.args, \"--strategy-opts=%s\",\n+\t\t\t\t\t opts->strategy_opts);\n+\t\tif (opts->switch_to)\n+\t\t\targv_array_pushf(&child.args, \"--switch-to=%s\",\n+\t\t\t\t\t opts->switch_to);\n+\t\tif (opts->cmd)\n+\t\t\targv_array_pushf(&child.args, \"--cmd=%s\", opts->cmd);\n+\t\tif (opts->allow_empty_message)\n+\t\t\targv_array_push(&child.args, \"--allow-empty-message\");\n+\t\tif (opts->allow_rerere_autoupdate > 0)\n+\t\t\targv_array_push(&child.args, \"--rerere-autoupdate\");\n+\t\telse if (opts->allow_rerere_autoupdate == 0)\n+\t\t\targv_array_push(&child.args, \"--no-rerere-autoupdate\");\n+\t\tif (opts->gpg_sign_opt)\n+\t\t\targv_array_push(&child.args, opts->gpg_sign_opt);\n+\t\tif (opts->signoff)\n+\t\t\targv_array_push(&child.args, \"--signoff\");\n+\n+\t\tstatus = run_command(&child);\n+\t\tgoto finished_rebase;\n+\t}\n+\n \tadd_var(&script_snippet, \"GIT_DIR\", absolute_path(get_git_dir()));\n \tadd_var(&script_snippet, \"state_dir\", opts->state_dir);\n \n@@ -418,6 +498,7 @@ static int run_specific_rebase(struct rebase_options *opts)\n \targv[0] = script_snippet.buf;\n \n \tstatus = run_command_v_opt(argv, RUN_USING_SHELL);\n+finished_rebase:\n \tif (opts->dont_finish_rebase)\n \t\t; /* do nothing */\n \telse if (status == 0) {\n-- \ngitgitgadget\n"},{"id":"356314","messageId":"xmqqmutekr4q.fsf@gitster-ct.c.googlers.com","threadId":"49195","inReplyTo":"pull.23.git.gitgitgadget@gmail.com","subject":"Re: [PATCH 0/1] Teach the builtin rebase about the builtin interactive rebase","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-08-22T21:50:29Z","receivedAt":"2018-08-22T21:50:34Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Johannes Schindelin via GitGitGadget\" <gitgitgadget@gmail.com>\nwrites:\n\n> This patch fixes that.\n>\n> Note: while this patch targets pk/rebase-in-c-6-final, it will not work\n> correctly without ag/rebase-i-in-c. So my suggestion is to rewrite the \n> pk/rebas-in-c-6-final branch by first merging ag/rebase-i-in-c, then\n> applying this here patch, and only then cherry-pick \"rebase: default to\n> using the builtin rebase\".\n\nYup, that sounds like a very sensible structure.\n"},{"id":"356338","messageId":"20180823024856.GH92374@aiede.svl.corp.google.com","threadId":"49195","inReplyTo":"pull.23.git.gitgitgadget@gmail.com","subject":"Re: [PATCH 0/1] Teach the builtin rebase about the builtin interactive rebase","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2018-08-23T02:48:56Z","receivedAt":"2018-08-23T02:49:01Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi,\n\nJohannes Schindelin wrote:\n\n[nice description snipped]\n> This patch fixes that.\n\nPlease include this information in the commit message.  It's super\nhelpful to find this kind of information about why a patch does what\nit does when encountering a patch later \"in the wild\" (in git log -S\noutput).\n\nThanks,\nJonathan\n"},{"id":"356526","messageId":"nycvar.QRO.7.76.6.1808260144570.18296@tvgsbejvaqbjf.bet","threadId":"49195","inReplyTo":"20180823024856.GH92374@aiede.svl.corp.google.com","subject":"Re: [PATCH 0/1] Teach the builtin rebase about the builtin interactive rebase","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2018-08-25T23:46:10Z","receivedAt":"2018-08-26T00:19:26Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Jonathan,\n\nOn Wed, 22 Aug 2018, Jonathan Nieder wrote:\n\n> Johannes Schindelin wrote:\n> \n> [nice description snipped]\n> > This patch fixes that.\n> \n> Please include this information in the commit message.  It's super\n> helpful to find this kind of information about why a patch does what\n> it does when encountering a patch later \"in the wild\" (in git log -S\n> output).\n\nI thought I did include the relevant part? As to the full back story: I\nwas repeatedly dressed down by Junio in recent attempts to include more\nmotivation in my commit messages. So I am reluctant to do as you say,\nbecause Junio is the BDFL here.\n\nCiao,\nDscho\n"},{"id":"356596","messageId":"xmqqa7p7lmzp.fsf@gitster-ct.c.googlers.com","threadId":"49195","inReplyTo":"nycvar.QRO.7.76.6.1808260144570.18296@tvgsbejvaqbjf.bet","subject":"Re: [PATCH 0/1] Teach the builtin rebase about the builtin interactive rebase","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-08-27T17:48:10Z","receivedAt":"2018-08-27T17:48:14Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n>> Please include this information in the commit message.  It's super\n>> helpful to find this kind of information about why a patch does what\n>> it does when encountering a patch later \"in the wild\" (in git log -S\n>> output).\n>\n> I thought I did include the relevant part? As to the full back story: I\n> was repeatedly dressed down by Junio in recent attempts to include more\n> motivation in my commit messages. So I am reluctant to do as you say,\n> because Junio is the BDFL here.\n\nI do recall discouraging you from including irrelevant rant/whine in\nthe log message a few times in the recent past, and also I do recall\nyou never listening to me.  Don't make me an excuse.\n\nI think what Jonathan finds helpful is the other half of the story\nof what you did write in [1/1].  You wrote that it is no longer a\nshell script and needs to follow a separate calling convention.\nWhat was missing from that description that was given in [0/1] is\nwhy the original \"rebase-in-c\" series was done while pretending that\nthe other effort \"rebase-i-in-c\" did not even exist, which made it\nnecessary to do this change as a separate step.\n\nAnd I tend to agree that it _is_ a relevant story in this case.\n\n"},{"id":"356687","messageId":"nycvar.QRO.7.76.6.1808281451191.73@tvgsbejvaqbjf.bet","threadId":"49195","inReplyTo":"xmqqa7p7lmzp.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH 0/1] Teach the builtin rebase about the builtin interactive rebase","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2018-08-28T12:53:13Z","receivedAt":"2018-08-28T12:53:20Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Junio,\n\nOn Mon, 27 Aug 2018, Junio C Hamano wrote:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> \n> >> Please include this information in the commit message.  It's super\n> >> helpful to find this kind of information about why a patch does what\n> >> it does when encountering a patch later \"in the wild\" (in git log -S\n> >> output).\n> >\n> > I thought I did include the relevant part? As to the full back story: I\n> > was repeatedly dressed down by Junio in recent attempts to include more\n> > motivation in my commit messages. So I am reluctant to do as you say,\n> > because Junio is the BDFL here.\n> \n> I do recall discouraging you from including irrelevant rant/whine in\n> the log message a few times in the recent past, and also I do recall\n> you never listening to me.  Don't make me an excuse.\n\nJunio, I would really appreciate less emotional, and more professional\nconduct from you.\n\n> I think what Jonathan finds helpful is the other half of the story\n\nI will await Jonathan's clarification.\n\nCiao,\nDscho\n\n> of what you did write in [1/1].  You wrote that it is no longer a\n> shell script and needs to follow a separate calling convention.\n> What was missing from that description that was given in [0/1] is\n> why the original \"rebase-in-c\" series was done while pretending that\n> the other effort \"rebase-i-in-c\" did not even exist, which made it\n> necessary to do this change as a separate step.\n> \n> And I tend to agree that it _is_ a relevant story in this case.\n> \n> \n"},{"id":"356703","messageId":"xmqq8t4qijym.fsf@gitster-ct.c.googlers.com","threadId":"49195","inReplyTo":"nycvar.QRO.7.76.6.1808281451191.73@tvgsbejvaqbjf.bet","subject":"Re: [PATCH 0/1] Teach the builtin rebase about the builtin interactive rebase","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-08-28T15:34:09Z","receivedAt":"2018-08-28T15:34:14Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n>> I do recall discouraging you from including irrelevant rant/whine in\n>> the log message a few times in the recent past, and also I do recall\n>> you never listening to me.  Don't make me an excuse.\n>\n> Junio, I would really appreciate less emotional, and more professional\n> conduct from you.\n\nWhich part is unprofessional?  \n\nBeing caught and corrected with truth immediately after badmouthing\nanother by lying may hurt, but that is your problem, not mine.\n"},{"id":"356711","messageId":"20180828171748.GC23314@aiede.svl.corp.google.com","threadId":"49195","inReplyTo":"nycvar.QRO.7.76.6.1808281451191.73@tvgsbejvaqbjf.bet","subject":"Re: [PATCH 0/1] Teach the builtin rebase about the builtin interactive rebase","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2018-08-28T17:17:48Z","receivedAt":"2018-08-28T17:17:53Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Johannes Schindelin wrote:\n> On Mon, 27 Aug 2018, Junio C Hamano wrote:\n>> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n>>> Jonathan Nieder wrote:\n\n>>>> Please include this information in the commit message.  It's super\n>>>> helpful to find this kind of information about why a patch does what\n>>>> it does when encountering a patch later \"in the wild\" (in git log -S\n>>>> output).\n[...]\n>> I think what Jonathan finds helpful is the other half of the story\n>\n> I will await Jonathan's clarification.\n\nJunio's understanding is correct.\n\nMore generally, I greatly appreciate the kind of motivation and\nbackstory that you write in cover letters, and I wish that more of\nthat would find its way into the commit messages instead.  Really I\nwish (and don't take this the wrong way --- I am not asking you to\nwrite it unless it's your own itch) that GitGitGadget would put the\ncover letter in single-patch series after the \"---\" line in the\nindividual patches, since that would make it easier for reviewers to\npoint out what content from the cover letter would be useful to add to\nthe commit message.\n\nThat said, this is minor and not a reason to reroll this patch.  It was\nmore that I wanted to give the hint for later patches.\n\nThanks much and hope that helps,\nJonathan\n"},{"id":"356835","messageId":"nycvar.QRO.7.76.6.1808291521250.71@tvgsbejvaqbjf.bet","threadId":"49195","inReplyTo":"xmqq8t4qijym.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH 0/1] Teach the builtin rebase about the builtin interactive rebase","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2018-08-29T13:24:29Z","receivedAt":"2018-08-29T13:24:37Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Junio,\n\nOn Tue, 28 Aug 2018, Junio C Hamano wrote:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> \n> >> I do recall discouraging you from including irrelevant rant/whine in\n> >> the log message a few times in the recent past, and also I do recall\n> >> you never listening to me.  Don't make me an excuse.\n> >\n> > Junio, I would really appreciate less emotional, and more professional\n> > conduct from you.\n> \n> Which part is unprofessional?  \n> \n> Being caught and corrected with truth immediately after badmouthing\n> another by lying may hurt, but that is your problem, not mine.\n\nYou did not catch me doing anything bad.\n\nYou caught me telling Jonathan about having been criticized by you, for\nincluding background information *I* found relevant and *you* found\nirrelevant. And that was very important in this context, as he asked me to\ninclude something that I expected you to find irrelevant, too.\n\nOf course, confusingly, this time you found it relevant, even if it was as\nunrelated to the patch as in the previous case.\n\nSo I am getting the impression that your critique was not actually\nprofessionally motivated, but very personal. And I do not appreciate that.\n\nI do not need to say anything more about this topic.\n\nCiao,\nDscho\n"},{"id":"356838","messageId":"nycvar.QRO.7.76.6.1808291525130.71@tvgsbejvaqbjf.bet","threadId":"49195","inReplyTo":"20180828171748.GC23314@aiede.svl.corp.google.com","subject":"Re: [PATCH 0/1] Teach the builtin rebase about the builtin interactive rebase","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2018-08-29T14:29:16Z","receivedAt":"2018-08-29T14:29:24Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Jonathan,\n\nOn Tue, 28 Aug 2018, Jonathan Nieder wrote:\n\n> Johannes Schindelin wrote:\n> > On Mon, 27 Aug 2018, Junio C Hamano wrote:\n> >> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> >>> Jonathan Nieder wrote:\n> \n> >>>> Please include this information in the commit message.  It's super\n> >>>> helpful to find this kind of information about why a patch does what\n> >>>> it does when encountering a patch later \"in the wild\" (in git log -S\n> >>>> output).\n> [...]\n> >> I think what Jonathan finds helpful is the other half of the story\n> >\n> > I will await Jonathan's clarification.\n> \n> Junio's understanding is correct.\n> \n> More generally, I greatly appreciate the kind of motivation and\n> backstory that you write in cover letters, and I wish that more of\n> that would find its way into the commit messages instead.  Really I\n> wish (and don't take this the wrong way --- I am not asking you to\n> write it unless it's your own itch) that GitGitGadget would put the\n> cover letter in single-patch series after the \"---\" line in the\n> individual patches, since that would make it easier for reviewers to\n> point out what content from the cover letter would be useful to add to\n> the commit message.\n> \n> That said, this is minor and not a reason to reroll this patch.  It was\n> more that I wanted to give the hint for later patches.\n> \n> Thanks much and hope that helps,\n\nIt does.\n\nI'll \"rick-roll\" a new iteration, as I just realized that (contrary to my\nrecollection; I guess I'll need that vacation) the commit message is\n*seriously* lacking. I thought I had remembered that I copy-edited the\ncommit message into the PR description. Clearly that was not the case.\n\nThanks for the clarification that triggered my looking,\nDscho\n"},{"id":"356839","messageId":"pull.23.v2.git.gitgitgadget@gmail.com","threadId":"49195","inReplyTo":"pull.23.git.gitgitgadget@gmail.com","subject":"[PATCH v2 0/1] Teach the builtin rebase about the builtin interactive rebase","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2018-08-29T14:31:15Z","receivedAt":"2018-08-29T14:31:18Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"The builtin rebase and the builtin interactive rebase have been developed\nindependently, on purpose: Google Summer of Code rules specifically state\nthat students have to work on independent projects, they cannot collaborate\non the same project.\n\nThe reason is probably the very fine tradition in academia to prohibit\nteamwork, which makes grading easier (at the expense of not exactly\npreparing the students for the real world, unless they want to stay in\nacademia).\n\nOne fallout is that the rebase-in-c and rebase-i-in-c patches cause no merge\nconflicts but a royal number of tests in the test suite to fail.\n\nIt is easy to explain why: rebase-in-c was developed under the assumption\nthat all rebase backends are implemented in Unix shell script and can be\nsourced via . git-rebase--<backend>, which is no longer true with \nrebase-i-in-c, where git-rebase--interactive is a hard-linked builtin.\n\nThis patch fixes that.\n\nNote: while this patch targets pk/rebase-in-c-6-final, it will not work\ncorrectly without ag/rebase-i-in-c. So my suggestion is to rewrite the \npk/rebas-in-c-6-final branch by first merging ag/rebase-i-in-c, then\napplying this here patch, and only then cherry-pick \"rebase: default to\nusing the builtin rebase\".\n\nChanges since v1:\n\n * replaced the too-terse commit message by a copy-edited version of this\n   cover letter (leaving out only the rant about disallowing teamwork).\n\nJohannes Schindelin (1):\n  builtin rebase: prepare for builtin rebase -i\n\n builtin/rebase.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 81 insertions(+)\n\n\nbase-commit: ae497a044508ebaac1794dcdd7ad04f8685686b2\nPublished-As: https://github.com/gitgitgadget/git/releases/tags/pr-23%2Fdscho%2Frebase-in-c-6-final-v2\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-23/dscho/rebase-in-c-6-final-v2\nPull-Request: https://github.com/gitgitgadget/git/pull/23\n\nRange-diff vs v1:\n\n 1:  29d49819fa ! 1:  5403014be7 builtin rebase: prepare for builtin rebase -i\n     @@ -2,8 +2,21 @@\n      \n          builtin rebase: prepare for builtin rebase -i\n      \n     -    It is no longer a shell script, so we need to call it in a different way\n     -    than the other backends.\n     +    The builtin rebase and the builtin interactive rebase have been\n     +    developed independently, on purpose: Google Summer of Code rules\n     +    specifically state that students have to work on independent projects,\n     +    they cannot collaborate on the same project.\n     +\n     +    One fallout is that the rebase-in-c and rebase-i-in-c patches cause no\n     +    merge conflicts but a royal number of tests in the test suite to fail.\n     +\n     +    It is easy to explain why: rebase-in-c was developed under the\n     +    assumption that all rebase backends are implemented in Unix shell script\n     +    and can be sourced via `. git-rebase--<backend>`, which is no longer\n     +    true with rebase-i-in-c, where git-rebase--interactive is a hard-linked\n     +    builtin.\n     +\n     +    This patch fixes that.\n      \n          Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n      \n\n-- \ngitgitgadget\n"},{"id":"356840","messageId":"5403014be738425e942a9bc1ca2029dd8d2137bb.1535553074.git.gitgitgadget@gmail.com","threadId":"49195","inReplyTo":"pull.23.v2.git.gitgitgadget@gmail.com","subject":"[PATCH v2 1/1] builtin rebase: prepare for builtin rebase -i","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2018-08-29T14:31:17Z","receivedAt":"2018-08-29T14:31:20Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nThe builtin rebase and the builtin interactive rebase have been\ndeveloped independently, on purpose: Google Summer of Code rules\nspecifically state that students have to work on independent projects,\nthey cannot collaborate on the same project.\n\nOne fallout is that the rebase-in-c and rebase-i-in-c patches cause no\nmerge conflicts but a royal number of tests in the test suite to fail.\n\nIt is easy to explain why: rebase-in-c was developed under the\nassumption that all rebase backends are implemented in Unix shell script\nand can be sourced via `. git-rebase--<backend>`, which is no longer\ntrue with rebase-i-in-c, where git-rebase--interactive is a hard-linked\nbuiltin.\n\nThis patch fixes that.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n builtin/rebase.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 81 insertions(+)\n\ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex 4e69458161..99fd5d4017 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -326,6 +326,13 @@ static void add_var(struct strbuf *buf, const char *name, const char *value)\n \t}\n }\n \n+static const char *resolvemsg =\n+N_(\"Resolve all conflicts manually, mark them as resolved with\\n\"\n+\"\\\"git add/rm <conflicted_files>\\\", then run \\\"git rebase --continue\\\".\\n\"\n+\"You can instead skip this commit: run \\\"git rebase --skip\\\".\\n\"\n+\"To abort and get back to the state before \\\"git rebase\\\", run \"\n+\"\\\"git rebase --abort\\\".\");\n+\n static int run_specific_rebase(struct rebase_options *opts)\n {\n \tconst char *argv[] = { NULL, NULL };\n@@ -333,6 +340,79 @@ static int run_specific_rebase(struct rebase_options *opts)\n \tint status;\n \tconst char *backend, *backend_func;\n \n+\tif (opts->type == REBASE_INTERACTIVE) {\n+\t\t/* Run builtin interactive rebase */\n+\t\tstruct child_process child = CHILD_PROCESS_INIT;\n+\n+\t\targv_array_pushf(&child.env_array, \"GIT_CHERRY_PICK_HELP=%s\",\n+\t\t\t\t resolvemsg);\n+\t\tif (!(opts->flags & REBASE_INTERACTIVE_EXPLICIT)) {\n+\t\t\targv_array_push(&child.env_array, \"GIT_EDITOR=:\");\n+\t\t\topts->autosquash = 0;\n+\t\t}\n+\n+\t\tchild.git_cmd = 1;\n+\t\targv_array_push(&child.args, \"rebase--interactive\");\n+\n+\t\tif (opts->action)\n+\t\t\targv_array_pushf(&child.args, \"--%s\", opts->action);\n+\t\tif (opts->keep_empty)\n+\t\t\targv_array_push(&child.args, \"--keep-empty\");\n+\t\tif (opts->rebase_merges)\n+\t\t\targv_array_push(&child.args, \"--rebase-merges\");\n+\t\tif (opts->rebase_cousins)\n+\t\t\targv_array_push(&child.args, \"--rebase-cousins\");\n+\t\tif (opts->autosquash)\n+\t\t\targv_array_push(&child.args, \"--autosquash\");\n+\t\tif (opts->flags & REBASE_VERBOSE)\n+\t\t\targv_array_push(&child.args, \"--verbose\");\n+\t\tif (opts->flags & REBASE_FORCE)\n+\t\t\targv_array_push(&child.args, \"--no-ff\");\n+\t\tif (opts->restrict_revision)\n+\t\t\targv_array_pushf(&child.args,\n+\t\t\t\t\t \"--restrict-revision=^%s\",\n+\t\t\t\t\t oid_to_hex(&opts->restrict_revision->object.oid));\n+\t\tif (opts->upstream)\n+\t\t\targv_array_pushf(&child.args, \"--upstream=%s\",\n+\t\t\t\t\t oid_to_hex(&opts->upstream->object.oid));\n+\t\tif (opts->onto)\n+\t\t\targv_array_pushf(&child.args, \"--onto=%s\",\n+\t\t\t\t\t oid_to_hex(&opts->onto->object.oid));\n+\t\tif (opts->squash_onto)\n+\t\t\targv_array_pushf(&child.args, \"--squash-onto=%s\",\n+\t\t\t\t\t oid_to_hex(opts->squash_onto));\n+\t\tif (opts->onto_name)\n+\t\t\targv_array_pushf(&child.args, \"--onto-name=%s\",\n+\t\t\t\t\t opts->onto_name);\n+\t\targv_array_pushf(&child.args, \"--head-name=%s\",\n+\t\t\t\t opts->head_name ?\n+\t\t\t\t opts->head_name : \"detached HEAD\");\n+\t\tif (opts->strategy)\n+\t\t\targv_array_pushf(&child.args, \"--strategy=%s\",\n+\t\t\t\t\t opts->strategy);\n+\t\tif (opts->strategy_opts)\n+\t\t\targv_array_pushf(&child.args, \"--strategy-opts=%s\",\n+\t\t\t\t\t opts->strategy_opts);\n+\t\tif (opts->switch_to)\n+\t\t\targv_array_pushf(&child.args, \"--switch-to=%s\",\n+\t\t\t\t\t opts->switch_to);\n+\t\tif (opts->cmd)\n+\t\t\targv_array_pushf(&child.args, \"--cmd=%s\", opts->cmd);\n+\t\tif (opts->allow_empty_message)\n+\t\t\targv_array_push(&child.args, \"--allow-empty-message\");\n+\t\tif (opts->allow_rerere_autoupdate > 0)\n+\t\t\targv_array_push(&child.args, \"--rerere-autoupdate\");\n+\t\telse if (opts->allow_rerere_autoupdate == 0)\n+\t\t\targv_array_push(&child.args, \"--no-rerere-autoupdate\");\n+\t\tif (opts->gpg_sign_opt)\n+\t\t\targv_array_push(&child.args, opts->gpg_sign_opt);\n+\t\tif (opts->signoff)\n+\t\t\targv_array_push(&child.args, \"--signoff\");\n+\n+\t\tstatus = run_command(&child);\n+\t\tgoto finished_rebase;\n+\t}\n+\n \tadd_var(&script_snippet, \"GIT_DIR\", absolute_path(get_git_dir()));\n \tadd_var(&script_snippet, \"state_dir\", opts->state_dir);\n \n@@ -418,6 +498,7 @@ static int run_specific_rebase(struct rebase_options *opts)\n \targv[0] = script_snippet.buf;\n \n \tstatus = run_command_v_opt(argv, RUN_USING_SHELL);\n+finished_rebase:\n \tif (opts->dont_finish_rebase)\n \t\t; /* do nothing */\n \telse if (status == 0) {\n-- \ngitgitgadget\n"},{"id":"356911","messageId":"xmqq5zzs94qb.fsf@gitster-ct.c.googlers.com","threadId":"49195","inReplyTo":"5403014be738425e942a9bc1ca2029dd8d2137bb.1535553074.git.gitgitgadget@gmail.com","subject":"Re: [PATCH v2 1/1] builtin rebase: prepare for builtin rebase -i","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-08-29T22:40:12Z","receivedAt":"2018-08-29T22:40:17Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Johannes Schindelin via GitGitGadget\" <gitgitgadget@gmail.com>\nwrites:\n\n> From: Johannes Schindelin <johannes.schindelin@gmx.de>\n>\n> The builtin rebase and the builtin interactive rebase have been\n> developed independently, on purpose: Google Summer of Code rules\n> specifically state that students have to work on independent projects,\n> they cannot collaborate on the same project.\n\nA much better description, especially without the less relevant \"the\nreason probably is...\" omitted from here.  The author's personal\nguess, while adding it does not help understanding what is already\nin the above paragraph an iota, is still a fine reading material in\nthe cover letter 0/1, though.\n\n> One fallout is that the rebase-in-c and rebase-i-in-c patches cause no\n> merge conflicts but a royal number of tests in the test suite to fail.\n>\n> It is easy to explain why: rebase-in-c was developed under the\n> assumption that all rebase backends are implemented in Unix shell script\n> and can be sourced via `. git-rebase--<backend>`, which is no longer\n> true with rebase-i-in-c, where git-rebase--interactive is a hard-linked\n> builtin.\n>\n> This patch fixes that.\n>\n> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n> ---\n>  builtin/rebase.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++++\n>  1 file changed, 81 insertions(+)\n\n\nWill replace by doing:\n\n    $ git checkout js/rebase-in-c-5.5-work-with-rebase-i-in-c\n    $ git checkout HEAD^\n    $ git am -s mbox\n    $ git range-diff @{-1}...\n    $ git checkout -B @{-1}\n\n    $ git checkout pk/rebase-i-in-c-6-final\n    $ git rebase --onto js/rebase-in-c-5.5-work-with-rebase-i-in-c \\\n          js/rebase-in-c-5.5-work-with-rebase-i-in-c@{1} HEAD^0\n    $ git range-diff @{-1}...\n    $ git checkout -B @{-1}\n\nto update the two topics and then rebuilding the integration\nbranches the usual way.  I also need to replace the \"other\" topic\nused in this topic, so the actual procedure would be a bit more\ninvolved than the above, though.\n\nThanks.\n"},{"id":"356961","messageId":"nycvar.QRO.7.76.6.1808301259420.71@tvgsbejvaqbjf.bet","threadId":"49195","inReplyTo":"xmqq5zzs94qb.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH v2 1/1] builtin rebase: prepare for builtin rebase -i","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2018-08-30T11:03:41Z","receivedAt":"2018-08-30T11:03:48Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Junio,\n\nOn Wed, 29 Aug 2018, Junio C Hamano wrote:\n\n> \"Johannes Schindelin via GitGitGadget\" <gitgitgadget@gmail.com>\n> writes:\n> \n> > From: Johannes Schindelin <johannes.schindelin@gmx.de>\n> >\n> > The builtin rebase and the builtin interactive rebase have been\n> > developed independently, on purpose: Google Summer of Code rules\n> > specifically state that students have to work on independent projects,\n> > they cannot collaborate on the same project.\n> \n> A much better description, especially without the less relevant \"the\n> reason probably is...\" omitted from here.  The author's personal\n> guess, while adding it does not help understanding what is already\n> in the above paragraph an iota, is still a fine reading material in\n> the cover letter 0/1, though.\n\nI addressed Jonathan's concern, though.\n\n> > One fallout is that the rebase-in-c and rebase-i-in-c patches cause no\n> > merge conflicts but a royal number of tests in the test suite to fail.\n> >\n> > It is easy to explain why: rebase-in-c was developed under the\n> > assumption that all rebase backends are implemented in Unix shell script\n> > and can be sourced via `. git-rebase--<backend>`, which is no longer\n> > true with rebase-i-in-c, where git-rebase--interactive is a hard-linked\n> > builtin.\n> >\n> > This patch fixes that.\n> >\n> > Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n> > ---\n> >  builtin/rebase.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++++\n> >  1 file changed, 81 insertions(+)\n> \n> \n> Will replace by doing:\n> \n>     $ git checkout js/rebase-in-c-5.5-work-with-rebase-i-in-c\n>     $ git checkout HEAD^\n>     $ git am -s mbox\n>     $ git range-diff @{-1}...\n>     $ git checkout -B @{-1}\n> \n>     $ git checkout pk/rebase-i-in-c-6-final\n>     $ git rebase --onto js/rebase-in-c-5.5-work-with-rebase-i-in-c \\\n>           js/rebase-in-c-5.5-work-with-rebase-i-in-c@{1} HEAD^0\n>     $ git range-diff @{-1}...\n>     $ git checkout -B @{-1}\n> \n> to update the two topics and then rebuilding the integration\n> branches the usual way.  I also need to replace the \"other\" topic\n> used in this topic, so the actual procedure would be a bit more\n> involved than the above, though.\n\nIs there any reason why you avoid using `git rebase -ir` here? This should\nbe so much easier via\n\n\tgit checkout pk/rebase-i-in-c-6-final\n\tgit rebase -ir js/rebase-in-c-5.5-work-with-rebase-i-in-c^\n\nand then inserting this at the appropriate position, followed by the `git\nrange-diff @{-1}...`:\n\n\tgit am -s mbox\n\tgit update-ref js/rebase-in-c-5.5-work-with-rebase-i-in-c HEAD\n\nCiao,\nDscho\n\n"},{"id":"357013","messageId":"20180830200911.GC22407@sigill.intra.peff.net","threadId":"49195","inReplyTo":"nycvar.QRO.7.76.6.1808301259420.71@tvgsbejvaqbjf.bet","subject":"Re: [PATCH v2 1/1] builtin rebase: prepare for builtin rebase -i","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2018-08-30T20:09:12Z","receivedAt":"2018-08-30T20:09:15Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Aug 30, 2018 at 01:03:41PM +0200, Johannes Schindelin wrote:\n\n> > Will replace by doing:\n> > \n> >     $ git checkout js/rebase-in-c-5.5-work-with-rebase-i-in-c\n> >     $ git checkout HEAD^\n> >     $ git am -s mbox\n> >     $ git range-diff @{-1}...\n> >     $ git checkout -B @{-1}\n> > \n> >     $ git checkout pk/rebase-i-in-c-6-final\n> >     $ git rebase --onto js/rebase-in-c-5.5-work-with-rebase-i-in-c \\\n> >           js/rebase-in-c-5.5-work-with-rebase-i-in-c@{1} HEAD^0\n> >     $ git range-diff @{-1}...\n> >     $ git checkout -B @{-1}\n> > \n> > to update the two topics and then rebuilding the integration\n> > branches the usual way.  I also need to replace the \"other\" topic\n> > used in this topic, so the actual procedure would be a bit more\n> > involved than the above, though.\n> \n> Is there any reason why you avoid using `git rebase -ir` here? This should\n> be so much easier via\n> \n> \tgit checkout pk/rebase-i-in-c-6-final\n> \tgit rebase -ir js/rebase-in-c-5.5-work-with-rebase-i-in-c^\n> \n> and then inserting this at the appropriate position, followed by the `git\n> range-diff @{-1}...`:\n> \n> \tgit am -s mbox\n> \tgit update-ref js/rebase-in-c-5.5-work-with-rebase-i-in-c HEAD\n\nRelated discussion, including a fantasy tangent by me (downthread):\n\n  https://public-inbox.org/git/20180727080807.GA11932@sigill.intra.peff.net/#t\n\n-Peff\n"},{"id":"357129","messageId":"nycvar.QRO.7.76.6.1808312238250.71@tvgsbejvaqbjf.bet","threadId":"49195","inReplyTo":"20180830200911.GC22407@sigill.intra.peff.net","subject":"Re: [PATCH v2 1/1] builtin rebase: prepare for builtin rebase -i","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2018-08-31T20:38:44Z","receivedAt":"2018-08-31T20:38:56Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Peff,\n\nOn Thu, 30 Aug 2018, Jeff King wrote:\n\n> On Thu, Aug 30, 2018 at 01:03:41PM +0200, Johannes Schindelin wrote:\n> \n> > > Will replace by doing:\n> > > \n> > >     $ git checkout js/rebase-in-c-5.5-work-with-rebase-i-in-c\n> > >     $ git checkout HEAD^\n> > >     $ git am -s mbox\n> > >     $ git range-diff @{-1}...\n> > >     $ git checkout -B @{-1}\n> > > \n> > >     $ git checkout pk/rebase-i-in-c-6-final\n> > >     $ git rebase --onto js/rebase-in-c-5.5-work-with-rebase-i-in-c \\\n> > >           js/rebase-in-c-5.5-work-with-rebase-i-in-c@{1} HEAD^0\n> > >     $ git range-diff @{-1}...\n> > >     $ git checkout -B @{-1}\n> > > \n> > > to update the two topics and then rebuilding the integration\n> > > branches the usual way.  I also need to replace the \"other\" topic\n> > > used in this topic, so the actual procedure would be a bit more\n> > > involved than the above, though.\n> > \n> > Is there any reason why you avoid using `git rebase -ir` here? This should\n> > be so much easier via\n> > \n> > \tgit checkout pk/rebase-i-in-c-6-final\n> > \tgit rebase -ir js/rebase-in-c-5.5-work-with-rebase-i-in-c^\n> > \n> > and then inserting this at the appropriate position, followed by the `git\n> > range-diff @{-1}...`:\n> > \n> > \tgit am -s mbox\n> > \tgit update-ref js/rebase-in-c-5.5-work-with-rebase-i-in-c HEAD\n> \n> Related discussion, including a fantasy tangent by me (downthread):\n> \n>   https://public-inbox.org/git/20180727080807.GA11932@sigill.intra.peff.net/#t\n\nI have no idea what you meant there...\n\nCiao,\nDscho\n"},{"id":"357130","messageId":"20180831204832.GA14869@sigill.intra.peff.net","threadId":"49195","inReplyTo":"nycvar.QRO.7.76.6.1808312238250.71@tvgsbejvaqbjf.bet","subject":"Re: [PATCH v2 1/1] builtin rebase: prepare for builtin rebase -i","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2018-08-31T20:48:32Z","receivedAt":"2018-08-31T20:48:36Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Aug 31, 2018 at 10:38:44PM +0200, Johannes Schindelin wrote:\n\n> > > Is there any reason why you avoid using `git rebase -ir` here? This should\n> > > be so much easier via\n> > > \n> > > \tgit checkout pk/rebase-i-in-c-6-final\n> > > \tgit rebase -ir js/rebase-in-c-5.5-work-with-rebase-i-in-c^\n> > > \n> > > and then inserting this at the appropriate position, followed by the `git\n> > > range-diff @{-1}...`:\n> > > \n> > > \tgit am -s mbox\n> > > \tgit update-ref js/rebase-in-c-5.5-work-with-rebase-i-in-c HEAD\n> > \n> > Related discussion, including a fantasy tangent by me (downthread):\n> > \n> >   https://public-inbox.org/git/20180727080807.GA11932@sigill.intra.peff.net/#t\n> \n> I have no idea what you meant there...\n\nI thought you were asking why Junio does not just use \"git am\" from\ninside \"git rebase\". I asked the same thing recently, and the answer is\nbecause he is afraid of how the two interact. I dug a little into it\n(the fantasy part is that I laid out a dream for how operations like\nthis could safely stack).\n\n-Peff\n"},{"id":"359692","messageId":"pull.23.v3.git.gitgitgadget@gmail.com","threadId":"49195","inReplyTo":"pull.23.v2.git.gitgitgadget@gmail.com","subject":"[PATCH v3 0/1] Teach the builtin rebase about the builtin interactive rebase","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2018-10-05T15:54:36Z","receivedAt":"2018-10-05T15:54:40Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"The builtin rebase and the builtin interactive rebase have been developed\nindependently, on purpose: Google Summer of Code rules specifically state\nthat students have to work on independent projects, they cannot collaborate\non the same project.\n\nThe reason is probably the very fine tradition in academia to prohibit\nteamwork, which makes grading easier (at the expense of not exactly\npreparing the students for the real world, unless they want to stay in\nacademia).\n\nOne fallout is that the rebase-in-c and rebase-i-in-c patches cause no merge\nconflicts but a royal number of tests in the test suite to fail.\n\nIt is easy to explain why: rebase-in-c was developed under the assumption\nthat all rebase backends are implemented in Unix shell script and can be\nsourced via . git-rebase--<backend>, which is no longer true with \nrebase-i-in-c, where git-rebase--interactive is a hard-linked builtin.\n\nThis patch fixes that.\n\nNote: while this patch targets pk/rebase-in-c-6-final, it will not work\ncorrectly without ag/rebase-i-in-c. So my suggestion is to rewrite the \npk/rebas-in-c-6-final branch by first merging ag/rebase-i-in-c, then\napplying this here patch, and only then cherry-pick \"rebase: default to\nusing the builtin rebase\".\n\nChanges since v2:\n\n * Prepare for the break command, by skipping the call to finish_rebase() \n   for interactive rebases altogether (the built-in interactive rebase\n   already takes care of that).\n * Remove a no-longer-used case arm (skipped by the newly-introduced code).\n\nChanges since v1:\n\n * replaced the too-terse commit message by a copy-edited version of this\n   cover letter (leaving out only the rant about disallowing teamwork).\n\nJohannes Schindelin (1):\n  builtin rebase: prepare for builtin rebase -i\n\n builtin/rebase.c | 87 +++++++++++++++++++++++++++++++++++++++++++++---\n 1 file changed, 83 insertions(+), 4 deletions(-)\n\n\nbase-commit: 67e0df2f391ec4177942a4d8b70e530aa5653c0d\nPublished-As: https://github.com/gitgitgadget/git/releases/tags/pr-23%2Fdscho%2Frebase-in-c-6-final-v3\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-23/dscho/rebase-in-c-6-final-v3\nPull-Request: https://github.com/gitgitgadget/git/pull/23\n\nRange-diff vs v2:\n\n 1:  5403014be7 ! 1:  db1652ef3e builtin rebase: prepare for builtin rebase -i\n     @@ -18,6 +18,15 @@\n      \n          This patch fixes that.\n      \n     +    Please note that we also skip the finish_rebase() call for interactive\n     +    rebases because the built-in interactive rebase already takes care of\n     +    that. This is needed to support the upcoming `break` command that wants\n     +    to interrupt the rebase with exit code 0 (and naturally wants to keep\n     +    the state directory intact when doing so).\n     +\n     +    While at it, remove the `case` arm for the interactive rebase that is\n     +    now skipped in favor of the short-cut to the built-in rebase.\n     +\n          Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n      \n      diff --git a/builtin/rebase.c b/builtin/rebase.c\n     @@ -117,6 +126,17 @@\n       \tadd_var(&script_snippet, \"GIT_DIR\", absolute_path(get_git_dir()));\n       \tadd_var(&script_snippet, \"state_dir\", opts->state_dir);\n       \n     +@@\n     + \t\tbackend = \"git-rebase--am\";\n     + \t\tbackend_func = \"git_rebase__am\";\n     + \t\tbreak;\n     +-\tcase REBASE_INTERACTIVE:\n     +-\t\tbackend = \"git-rebase--interactive\";\n     +-\t\tbackend_func = \"git_rebase__interactive\";\n     +-\t\tbreak;\n     + \tcase REBASE_MERGE:\n     + \t\tbackend = \"git-rebase--merge\";\n     + \t\tbackend_func = \"git_rebase__merge\";\n      @@\n       \targv[0] = script_snippet.buf;\n       \n     @@ -124,4 +144,8 @@\n      +finished_rebase:\n       \tif (opts->dont_finish_rebase)\n       \t\t; /* do nothing */\n     ++\telse if (opts->type == REBASE_INTERACTIVE)\n     ++\t\t; /* interactive rebase cleans up after itself */\n       \telse if (status == 0) {\n     + \t\tif (!file_exists(state_dir_path(\"stopped-sha\", opts)))\n     + \t\t\tfinish_rebase(opts);\n\n-- \ngitgitgadget\n"},{"id":"359693","messageId":"db1652ef3e6f46cace5edc9c420411f08e5420aa.1538754875.git.gitgitgadget@gmail.com","threadId":"49195","inReplyTo":"pull.23.v3.git.gitgitgadget@gmail.com","subject":"[PATCH v3 1/1] builtin rebase: prepare for builtin rebase -i","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2018-10-05T15:54:38Z","receivedAt":"2018-10-05T15:54:41Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nThe builtin rebase and the builtin interactive rebase have been\ndeveloped independently, on purpose: Google Summer of Code rules\nspecifically state that students have to work on independent projects,\nthey cannot collaborate on the same project.\n\nOne fallout is that the rebase-in-c and rebase-i-in-c patches cause no\nmerge conflicts but a royal number of tests in the test suite to fail.\n\nIt is easy to explain why: rebase-in-c was developed under the\nassumption that all rebase backends are implemented in Unix shell script\nand can be sourced via `. git-rebase--<backend>`, which is no longer\ntrue with rebase-i-in-c, where git-rebase--interactive is a hard-linked\nbuiltin.\n\nThis patch fixes that.\n\nPlease note that we also skip the finish_rebase() call for interactive\nrebases because the built-in interactive rebase already takes care of\nthat. This is needed to support the upcoming `break` command that wants\nto interrupt the rebase with exit code 0 (and naturally wants to keep\nthe state directory intact when doing so).\n\nWhile at it, remove the `case` arm for the interactive rebase that is\nnow skipped in favor of the short-cut to the built-in rebase.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n builtin/rebase.c | 87 +++++++++++++++++++++++++++++++++++++++++++++---\n 1 file changed, 83 insertions(+), 4 deletions(-)\n\ndiff --git a/builtin/rebase.c b/builtin/rebase.c\nindex 1a697d70c9..20f7159cf2 100644\n--- a/builtin/rebase.c\n+++ b/builtin/rebase.c\n@@ -326,6 +326,13 @@ static void add_var(struct strbuf *buf, const char *name, const char *value)\n \t}\n }\n \n+static const char *resolvemsg =\n+N_(\"Resolve all conflicts manually, mark them as resolved with\\n\"\n+\"\\\"git add/rm <conflicted_files>\\\", then run \\\"git rebase --continue\\\".\\n\"\n+\"You can instead skip this commit: run \\\"git rebase --skip\\\".\\n\"\n+\"To abort and get back to the state before \\\"git rebase\\\", run \"\n+\"\\\"git rebase --abort\\\".\");\n+\n static int run_specific_rebase(struct rebase_options *opts)\n {\n \tconst char *argv[] = { NULL, NULL };\n@@ -333,6 +340,79 @@ static int run_specific_rebase(struct rebase_options *opts)\n \tint status;\n \tconst char *backend, *backend_func;\n \n+\tif (opts->type == REBASE_INTERACTIVE) {\n+\t\t/* Run builtin interactive rebase */\n+\t\tstruct child_process child = CHILD_PROCESS_INIT;\n+\n+\t\targv_array_pushf(&child.env_array, \"GIT_CHERRY_PICK_HELP=%s\",\n+\t\t\t\t resolvemsg);\n+\t\tif (!(opts->flags & REBASE_INTERACTIVE_EXPLICIT)) {\n+\t\t\targv_array_push(&child.env_array, \"GIT_EDITOR=:\");\n+\t\t\topts->autosquash = 0;\n+\t\t}\n+\n+\t\tchild.git_cmd = 1;\n+\t\targv_array_push(&child.args, \"rebase--interactive\");\n+\n+\t\tif (opts->action)\n+\t\t\targv_array_pushf(&child.args, \"--%s\", opts->action);\n+\t\tif (opts->keep_empty)\n+\t\t\targv_array_push(&child.args, \"--keep-empty\");\n+\t\tif (opts->rebase_merges)\n+\t\t\targv_array_push(&child.args, \"--rebase-merges\");\n+\t\tif (opts->rebase_cousins)\n+\t\t\targv_array_push(&child.args, \"--rebase-cousins\");\n+\t\tif (opts->autosquash)\n+\t\t\targv_array_push(&child.args, \"--autosquash\");\n+\t\tif (opts->flags & REBASE_VERBOSE)\n+\t\t\targv_array_push(&child.args, \"--verbose\");\n+\t\tif (opts->flags & REBASE_FORCE)\n+\t\t\targv_array_push(&child.args, \"--no-ff\");\n+\t\tif (opts->restrict_revision)\n+\t\t\targv_array_pushf(&child.args,\n+\t\t\t\t\t \"--restrict-revision=^%s\",\n+\t\t\t\t\t oid_to_hex(&opts->restrict_revision->object.oid));\n+\t\tif (opts->upstream)\n+\t\t\targv_array_pushf(&child.args, \"--upstream=%s\",\n+\t\t\t\t\t oid_to_hex(&opts->upstream->object.oid));\n+\t\tif (opts->onto)\n+\t\t\targv_array_pushf(&child.args, \"--onto=%s\",\n+\t\t\t\t\t oid_to_hex(&opts->onto->object.oid));\n+\t\tif (opts->squash_onto)\n+\t\t\targv_array_pushf(&child.args, \"--squash-onto=%s\",\n+\t\t\t\t\t oid_to_hex(opts->squash_onto));\n+\t\tif (opts->onto_name)\n+\t\t\targv_array_pushf(&child.args, \"--onto-name=%s\",\n+\t\t\t\t\t opts->onto_name);\n+\t\targv_array_pushf(&child.args, \"--head-name=%s\",\n+\t\t\t\t opts->head_name ?\n+\t\t\t\t opts->head_name : \"detached HEAD\");\n+\t\tif (opts->strategy)\n+\t\t\targv_array_pushf(&child.args, \"--strategy=%s\",\n+\t\t\t\t\t opts->strategy);\n+\t\tif (opts->strategy_opts)\n+\t\t\targv_array_pushf(&child.args, \"--strategy-opts=%s\",\n+\t\t\t\t\t opts->strategy_opts);\n+\t\tif (opts->switch_to)\n+\t\t\targv_array_pushf(&child.args, \"--switch-to=%s\",\n+\t\t\t\t\t opts->switch_to);\n+\t\tif (opts->cmd)\n+\t\t\targv_array_pushf(&child.args, \"--cmd=%s\", opts->cmd);\n+\t\tif (opts->allow_empty_message)\n+\t\t\targv_array_push(&child.args, \"--allow-empty-message\");\n+\t\tif (opts->allow_rerere_autoupdate > 0)\n+\t\t\targv_array_push(&child.args, \"--rerere-autoupdate\");\n+\t\telse if (opts->allow_rerere_autoupdate == 0)\n+\t\t\targv_array_push(&child.args, \"--no-rerere-autoupdate\");\n+\t\tif (opts->gpg_sign_opt)\n+\t\t\targv_array_push(&child.args, opts->gpg_sign_opt);\n+\t\tif (opts->signoff)\n+\t\t\targv_array_push(&child.args, \"--signoff\");\n+\n+\t\tstatus = run_command(&child);\n+\t\tgoto finished_rebase;\n+\t}\n+\n \tadd_var(&script_snippet, \"GIT_DIR\", absolute_path(get_git_dir()));\n \tadd_var(&script_snippet, \"state_dir\", opts->state_dir);\n \n@@ -395,10 +475,6 @@ static int run_specific_rebase(struct rebase_options *opts)\n \t\tbackend = \"git-rebase--am\";\n \t\tbackend_func = \"git_rebase__am\";\n \t\tbreak;\n-\tcase REBASE_INTERACTIVE:\n-\t\tbackend = \"git-rebase--interactive\";\n-\t\tbackend_func = \"git_rebase__interactive\";\n-\t\tbreak;\n \tcase REBASE_MERGE:\n \t\tbackend = \"git-rebase--merge\";\n \t\tbackend_func = \"git_rebase__merge\";\n@@ -418,8 +494,11 @@ static int run_specific_rebase(struct rebase_options *opts)\n \targv[0] = script_snippet.buf;\n \n \tstatus = run_command_v_opt(argv, RUN_USING_SHELL);\n+finished_rebase:\n \tif (opts->dont_finish_rebase)\n \t\t; /* do nothing */\n+\telse if (opts->type == REBASE_INTERACTIVE)\n+\t\t; /* interactive rebase cleans up after itself */\n \telse if (status == 0) {\n \t\tif (!file_exists(state_dir_path(\"stopped-sha\", opts)))\n \t\t\tfinish_rebase(opts);\n-- \ngitgitgadget\n"},{"id":"359778","messageId":"xmqqy3bavdmk.fsf@gitster-ct.c.googlers.com","threadId":"49195","inReplyTo":"pull.23.v3.git.gitgitgadget@gmail.com","subject":"Re: [PATCH v3 0/1] Teach the builtin rebase about the builtin interactive rebase","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-10-06T23:50:27Z","receivedAt":"2018-10-06T23:50:32Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Johannes Schindelin via GitGitGadget\" <gitgitgadget@gmail.com>\nwrites:\n\n> Note: while this patch targets pk/rebase-in-c-6-final, it will not work\n> correctly without ag/rebase-i-in-c. So my suggestion is to rewrite the \n> pk/rebas-in-c-6-final branch by first merging ag/rebase-i-in-c, then\n> applying this here patch, and only then cherry-pick \"rebase: default to\n> using the builtin rebase\".\n\nIs this a stale comment in the context of v3, where we pretty much\nknow how the resulting topic should intertwine with other topics?  I\nam trying to see if I have do to anything differently this time, or\njust replacing the single commit while keeping the structure around\nthat commit the same is fine.\n\nAlso, I see there is a new iteration v8 of ag/rebase-i-in-c on the\nlist, sent on Sep 27th (you were CC'ed but I suspect it was before\nyou came back).  Are you happy with that update?  Otherwise, we\nshould make sure that topic is solid enough before extending\n(meaning: I'd replace this one while keeping ag/rebase-i-in-c that\nhas been cooking in 'pu', without updating the latter).\n\n> Changes since v2:\n>\n>  * Prepare for the break command, by skipping the call to finish_rebase() \n>    for interactive rebases altogether (the built-in interactive rebase\n>    already takes care of that).\n\nThanks.\n"},{"id":"360280","messageId":"nycvar.QRO.7.76.6.1810120957480.45@tvgsbejvaqbjf.bet","threadId":"49195","inReplyTo":"xmqqy3bavdmk.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH v3 0/1] Teach the builtin rebase about the builtin interactive rebase","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2018-10-12T07:59:51Z","receivedAt":"2018-10-12T07:59:57Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Junio,\n\nOn Sun, 7 Oct 2018, Junio C Hamano wrote:\n\n> \"Johannes Schindelin via GitGitGadget\" <gitgitgadget@gmail.com>\n> writes:\n> \n> > Note: while this patch targets pk/rebase-in-c-6-final, it will not work\n> > correctly without ag/rebase-i-in-c. So my suggestion is to rewrite the \n> > pk/rebas-in-c-6-final branch by first merging ag/rebase-i-in-c, then\n> > applying this here patch, and only then cherry-pick \"rebase: default to\n> > using the builtin rebase\".\n> \n> Is this a stale comment in the context of v3, where we pretty much\n> know how the resulting topic should intertwine with other topics?  I\n> am trying to see if I have do to anything differently this time, or\n> just replacing the single commit while keeping the structure around\n> that commit the same is fine.\n\nJust replacing the single commit. For technical reasons, I still have to\ntarget pk/rebase-in-c-6-final in my branch.\n\n> Also, I see there is a new iteration v8 of ag/rebase-i-in-c on the\n> list, sent on Sep 27th (you were CC'ed but I suspect it was before\n> you came back).  Are you happy with that update?\n\nTo be quite honest, I did not yet have time to look over it, but I\nverified that it has my suggested fix for the -S option.\n\nCiao,\nDscho\n"}]}