{"thread":{"id":"20349","subject":"[PATCH 3/3] rebase -i: use \"git sequencer--helper --reset-hard\"","startedAt":"2009-08-03T02:40:22Z","lastAt":"2009-08-03T08:03:54Z","messageCount":5,"participants":["Christian Couder","Sverre Rabbelier","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"119392","messageId":"20090803024023.3794.6487.chriscool@tuxfamily.org","threadId":"20349","inReplyTo":null,"subject":"[PATCH 3/3] rebase -i: use \"git sequencer--helper --reset-hard\"","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2009-08-03T02:40:22Z","receivedAt":"2009-08-03T02:40:22Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"instead of \"git reset --hard\"\n\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n git-rebase--interactive.sh |   13 +++++++++----\n 1 files changed, 9 insertions(+), 4 deletions(-)\n\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex c9c75c0..0041994 100755\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -154,7 +154,8 @@ pick_one () {\n \t\tdie \"Could not get the parent of $sha1\"\n \tcurrent_sha1=$(git rev-parse --verify HEAD)\n \tif test \"$no_ff$current_sha1\" = \"$parent_sha1\"; then\n-\t\toutput git reset --hard $sha1\n+\t\tgit sequencer--helper --reset-hard $sha1 \\\n+\t\t\t\"$GIT_REFLOG_ACTION\" \"$VERBOSE\"\n \t\ttest \"a$1\" = a-n && output git reset --soft $current_sha1\n \t\tsha1=$(git rev-parse --short $sha1)\n \t\toutput warn Fast forward to $sha1\n@@ -238,7 +239,8 @@ pick_one_preserving_merges () {\n \tcase $fast_forward in\n \tt)\n \t\toutput warn \"Fast forward to $sha1\"\n-\t\toutput git reset --hard $sha1 ||\n+\t\tgit sequencer--helper --reset-hard $sha1 \\\n+\t\t\t\"$GIT_REFLOG_ACTION\" \"$VERBOSE\" ||\n \t\t\tdie \"Cannot fast forward to $sha1\"\n \t\t;;\n \tf)\n@@ -536,7 +538,8 @@ first and then run 'git rebase --continue' again.\"\n \t\t\tgit symbolic-ref HEAD $HEADNAME\n \t\t\t;;\n \t\tesac &&\n-\t\toutput git reset --hard $HEAD &&\n+\t\tgit sequencer--helper --reset-hard $HEAD \\\n+\t\t\t\"$GIT_REFLOG_ACTION\" \"$VERBOSE\" &&\n \t\trm -rf \"$DOTEST\"\n \t\texit\n \t\t;;\n@@ -548,7 +551,9 @@ first and then run 'git rebase --continue' again.\"\n \t\tgit rerere clear\n \t\ttest -d \"$DOTEST\" || die \"No interactive rebase running\"\n \n-\t\toutput git reset --hard && do_rest\n+\t\tgit sequencer--helper --reset-hard HEAD \\\n+\t\t\t\"$GIT_REFLOG_ACTION\" \"$VERBOSE\" &&\n+\t\tdo_rest\n \t\t;;\n \t-s)\n \t\tcase \"$#,$1\" in\n-- \n1.6.4.133.g8a5c8\n"},{"id":"119395","messageId":"fabb9a1e0908022158g2578071ewd44bc8d730fb2b8b@mail.gmail.com","threadId":"20349","inReplyTo":"20090803024023.3794.6487.chriscool@tuxfamily.org","subject":"Re: [PATCH 3/3] rebase -i: use \"git sequencer--helper --reset-hard\"","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2009-08-03T04:58:22Z","receivedAt":"2009-08-03T04:58:22Z","isPatch":true,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Sun, Aug 2, 2009 at 19:40, Christian Couder<chriscool@tuxfamily.org> wrote:\n> instead of \"git reset --hard\"\n\nHmmm, why though? The commit message (either this one or those earlier\nin the series) don't really explain. What are the advantages of using\nthis new 'git reset --hard' alternative?\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"119909","messageId":"200908030829.21424.chriscool@tuxfamily.org","threadId":"20349","inReplyTo":"fabb9a1e0908022158g2578071ewd44bc8d730fb2b8b@mail.gmail.com","subject":"Re: [PATCH 3/3] rebase -i: use \"git sequencer--helper --reset-hard\"","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2009-08-03T06:29:21Z","receivedAt":"2009-08-03T06:29:21Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"Hi,\n\nOn Monday 03 August 2009, Sverre Rabbelier wrote:\n> Heya,\n>\n> On Sun, Aug 2, 2009 at 19:40, Christian Couder<chriscool@tuxfamily.org> \nwrote:\n> > instead of \"git reset --hard\"\n>\n> Hmmm, why though? The commit message (either this one or those earlier\n> in the series) don't really explain. What are the advantages of using\n> this new 'git reset --hard' alternative?\n\nThis is part of my work to port git-rebase--interactive.sh to C using code \nfrom the sequencer project. So the advantage is that it introduces and uses \nthe reset_almost_hard() function that will be used in the end when \neverything is done by C code.\n\nRegards,\nChristian.\n"},{"id":"119911","messageId":"fabb9a1e0908022330l6d0ab44fwc1b6454ba67c9af1@mail.gmail.com","threadId":"20349","inReplyTo":"200908030829.21424.chriscool@tuxfamily.org","subject":"Re: [PATCH 3/3] rebase -i: use \"git sequencer--helper --reset-hard\"","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2009-08-03T06:30:57Z","receivedAt":"2009-08-03T06:30:57Z","isPatch":true,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Sun, Aug 2, 2009 at 23:29, Christian Couder<chriscool@tuxfamily.org> wrote:\n> This is part of my work to port git-rebase--interactive.sh to C using code\n> from the sequencer project. So the advantage is that it introduces and uses\n> the reset_almost_hard() function that will be used in the end when\n> everything is done by C code.\n\nHmmm, that almost makes sense, but I don't see the new C code\nreplacing any existing shell code, so what am I missing here?\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"119912","messageId":"7vbpmxe32t.fsf@alter.siamese.dyndns.org","threadId":"20349","inReplyTo":"fabb9a1e0908022330l6d0ab44fwc1b6454ba67c9af1@mail.gmail.com","subject":"Re: [PATCH 3/3] rebase -i: use \"git sequencer--helper --reset-hard\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-08-03T08:03:54Z","receivedAt":"2009-08-03T08:03:54Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sverre Rabbelier <srabbelier@gmail.com> writes:\n\n> Heya,\n>\n> On Sun, Aug 2, 2009 at 23:29, Christian Couder<chriscool@tuxfamily.org> wrote:\n>> This is part of my work to port git-rebase--interactive.sh to C using code\n>> from the sequencer project. So the advantage is that it introduces and uses\n>> the reset_almost_hard() function that will be used in the end when\n>> everything is done by C code.\n>\n> Hmmm, that almost makes sense, but I don't see the new C code\n> replacing any existing shell code, so what am I missing here?\n\nMore importantly, I found the \"almost_hard()\" function way underexplained.\nWhat it does (e.g. does --hard when able but otherwise gives up and falls\nback to something else?), why it is necessary (e.g. when should callers\nuse it, instead of calling unconditional \"reset --hard\"?), what kind of\npreparation is necessary by the caller (e.g. should it read the index\nbefore calling the function?  should it discard the index before?), and\nwhat kind of result should it expect (e.g. is it safe to write a tree out\nof the resulting index, or does it screw up the cache-tree and the caller\nshould discard it before writing a tree?), etc. etc....\n"}]}