{"thread":{"id":"11463","subject":"git-walkthrough-add script","startedAt":"2008-01-04T06:14:31Z","lastAt":"2008-01-05T04:08:50Z","messageCount":16,"participants":["William Morgan","Jeff King","Pedro Melo","Junio C Hamano","Miklos Vajna"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"64412","messageId":"1199426431-sup-6092@south","threadId":"11463","inReplyTo":null,"subject":"git-walkthrough-add script","fromName":"William Morgan","fromEmail":"wmorgan-git@masanjin.net","sentAt":"2008-01-04T06:14:31Z","receivedAt":"2008-01-04T06:14:31Z","isPatch":false,"sender":{"key":"wmorgan-git@masanjin.net","avatar":null},"body":"Hi all,\n\nI've written a little script to do darcs-style hunk-by-hunk\nwalkthroughs. It's based on the git-hunk-commit script that was floating\naround. Maybe someone else will find it useful.\n\nhttp://git-wt-commit.rubyforge.org/\n\n-- \nWilliam <wmorgan-git@masanjin.net>\n"},{"id":"64414","messageId":"20080104072650.GA24685@coredump.intra.peff.net","threadId":"11463","inReplyTo":"1199426431-sup-6092@south","subject":"Re: git-walkthrough-add script","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-01-04T07:26:50Z","receivedAt":"2008-01-04T07:26:50Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Jan 03, 2008 at 10:14:31PM -0800, William Morgan wrote:\n\n> I've written a little script to do darcs-style hunk-by-hunk\n> walkthroughs. It's based on the git-hunk-commit script that was floating\n> around. Maybe someone else will find it useful.\n> \n> http://git-wt-commit.rubyforge.org/\n\nIt didn't work for me, since the diff parsing failed to match my\nparticular colors (I needed /^.....diff/ instead of /^....diff/). I\nsuspect the color matching needs to be more flexible to be generally\nuseful.\n\nHowever, I'm not clear what advantages this has over \"git add -p\".\n\n-Peff\n"},{"id":"64453","messageId":"1199471454-sup-4786@south","threadId":"11463","inReplyTo":"20080104072650.GA24685@coredump.intra.peff.net","subject":"Re: git-walkthrough-add script","fromName":"William Morgan","fromEmail":"wmorgan-git@masanjin.net","sentAt":"2008-01-04T18:31:03Z","receivedAt":"2008-01-04T18:31:03Z","isPatch":false,"sender":{"key":"wmorgan-git@masanjin.net","avatar":null},"body":"Excerpts from Jeff King's message of Thu Jan 03 23:26:50 -0800 2008:\n> It didn't work for me, since the diff parsing failed to match my\n> particular colors (I needed /^.....diff/ instead of /^....diff/). I\n> suspect the color matching needs to be more flexible to be generally\n> useful.\n\nFixed, thanks.\n\n> However, I'm not clear what advantages this has over \"git add -p\".\n\nA better interface. (Where by \"better\", I mean, behaves how I personally\nprefer.)\n\n-- \nWilliam <wmorgan-git@masanjin.net>\n"},{"id":"64467","messageId":"20080104210751.GB26248@coredump.intra.peff.net","threadId":"11463","inReplyTo":"1199471454-sup-4786@south","subject":"Re: git-walkthrough-add script","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-01-04T21:07:51Z","receivedAt":"2008-01-04T21:07:51Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Jan 04, 2008 at 10:31:03AM -0800, William Morgan wrote:\n\n> > However, I'm not clear what advantages this has over \"git add -p\".\n> \n> A better interface. (Where by \"better\", I mean, behaves how I personally\n> prefer.)\n\nOK. If it works for you, then I'm not one to say you shouldn't use it.\nBut if you have interface improvement suggestions for \"git-add -i\" or\n\"git-add -p\", I'm sure they would be well-received (post-1.5.4 release,\nof course).\n\n-Peff\n"},{"id":"64475","messageId":"2CC98B8C-CBB1-4C26-8C94-B152A4D02DDC@simplicidade.org","threadId":"11463","inReplyTo":"1199426431-sup-6092@south","subject":"Re: git-walkthrough-add script","fromName":"Pedro Melo","fromEmail":"melo@simplicidade.org","sentAt":"2008-01-04T23:26:41Z","receivedAt":"2008-01-04T23:26:41Z","isPatch":false,"sender":{"key":"melo@simplicidade.org","avatar":"https://gravatar.com/avatar/13ddbb01e300285a93aa1e3739653a81f9b1d3438bd03a4ac36b88e4ffeeafc3?d=mp&s=160"},"body":"Hi,\n\nOn Jan 4, 2008, at 6:14 AM, William Morgan wrote:\n\n> I've written a little script to do darcs-style hunk-by-hunk\n> walkthroughs. It's based on the git-hunk-commit script that was  \n> floating\n> around. Maybe someone else will find it useful.\n>\n> http://git-wt-commit.rubyforge.org/\n\nMaybe I'm doing something wrong, but comparing git-add -p with your  \nscript, git-add -p is more darcs'ish. With git-add, if I have several  \nchanges in the same file, I get to choose per hunk.\n\nYou script asks me to add all the changes in the same file at once.\n\nBest regards,\n-- \nPedro Melo\nBlog: http://www.simplicidade.org/notes/\nXMPP ID: melo@simplicidade.org\nUse XMPP!\n"},{"id":"64476","messageId":"7vd4shi31o.fsf@gitster.siamese.dyndns.org","threadId":"11463","inReplyTo":"2CC98B8C-CBB1-4C26-8C94-B152A4D02DDC@simplicidade.org","subject":"Re: git-walkthrough-add script","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-01-04T23:28:19Z","receivedAt":"2008-01-04T23:28:19Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Pedro Melo <melo@simplicidade.org> writes:\n\n> Maybe I'm doing something wrong, but comparing git-add -p with your\n> script, git-add -p is more darcs'ish. With git-add, if I have several\n> changes in the same file, I get to choose per hunk.\n\nHeh, thanks from somebody who did \"add -i\" who admits he used\ndarcs for a few months ;-).\n"},{"id":"64477","messageId":"1199491057-sup-5588@south","threadId":"11463","inReplyTo":"2CC98B8C-CBB1-4C26-8C94-B152A4D02DDC@simplicidade.org","subject":"Re: git-walkthrough-add script","fromName":"William Morgan","fromEmail":"wmorgan-git@masanjin.net","sentAt":"2008-01-05T00:02:43Z","receivedAt":"2008-01-05T00:02:43Z","isPatch":false,"sender":{"key":"wmorgan-git@masanjin.net","avatar":null},"body":"Excerpts from Pedro Melo's message of Fri Jan 04 15:26:41 -0800 2008:\n> You script asks me to add all the changes in the same file at once.\n\nIt shouldn't. The whole point is to walk through and allow selection on\na per-hunk basis.\n\nMaybe I'm parsing the output of git diff incorrectly and not picking up\nhunk boundaries? Would you mind sending the output of a git diff that\nresults in this behavior?\n\n-- \nWilliam <wmorgan-git@masanjin.net>\n"},{"id":"64478","messageId":"8666B7CA-D47F-40A0-88A2-3756C0663296@simplicidade.org","threadId":"11463","inReplyTo":"1199491057-sup-5588@south","subject":"Re: git-walkthrough-add script","fromName":"Pedro Melo","fromEmail":"melo@simplicidade.org","sentAt":"2008-01-05T00:17:49Z","receivedAt":"2008-01-05T00:17:49Z","isPatch":false,"sender":{"key":"melo@simplicidade.org","avatar":"https://gravatar.com/avatar/13ddbb01e300285a93aa1e3739653a81f9b1d3438bd03a4ac36b88e4ffeeafc3?d=mp&s=160"},"body":"Hi,\n\nOn Jan 5, 2008, at 12:02 AM, William Morgan wrote:\n> Excerpts from Pedro Melo's message of Fri Jan 04 15:26:41 -0800 2008:\n>> You script asks me to add all the changes in the same file at once.\n>\n> It shouldn't. The whole point is to walk through and allow  \n> selection on\n> a per-hunk basis.\n>\n> Maybe I'm parsing the output of git diff incorrectly and not  \n> picking up\n> hunk boundaries? Would you mind sending the output of a git diff that\n> results in this behavior?\n\nI used a new git repo, just to test your script.\n\nThe diff is:\n\n------ snip\ndiff --git a/a b/a\nindex b6b8cab..456bb2d 100644\n--- a/a\n+++ b/a\n@@ -1,4 +1,5 @@\n  asasas\n+****\n  assas\n  assas\n  asas\n@@ -37,6 +38,7 @@ asasas\n  assas\n  assas\n  asas\n+=fsdfsdfsadfasdfsad=\n\n  asasas\n  assas\n@@ -46,5 +48,6 @@ asas\n  asasas\n  assas\n  assas\n+asdasdasdasda=DASD=AS=DA=SD=\n  asas\n\n------ snip\n\nBest regards\n-- \nPedro Melo\nBlog: http://www.simplicidade.org/notes/\nXMPP ID: melo@simplicidade.org\nUse XMPP!\n"},{"id":"64483","messageId":"20080105010011.GV29972@genesis.frugalware.org","threadId":"11463","inReplyTo":"2CC98B8C-CBB1-4C26-8C94-B152A4D02DDC@simplicidade.org","subject":"Re: git-walkthrough-add script","fromName":"Miklos Vajna","fromEmail":"vmiklos@frugalware.org","sentAt":"2008-01-05T01:00:11Z","receivedAt":"2008-01-05T01:00:11Z","isPatch":false,"sender":{"key":"vmiklos@frugalware.org","avatar":"https://gravatar.com/avatar/401c1cbbb3a5d13e650c691a2c71d6fd0b80df1a01bc74d9f1972675dd58f2bd?d=mp&s=160"},"body":"On Fri, Jan 04, 2008 at 11:26:41PM +0000, Pedro Melo <melo@simplicidade.org> wrote:\n> Maybe I'm doing something wrong, but comparing git-add -p with your script, \n> git-add -p is more darcs'ish. With git-add, if I have several changes in \n> the same file, I get to choose per hunk.\n\nhm, if you want a darcs-like record interface.. darcs record asks you if\nyou want to include a newly added file in a commit or not,\ngit-walkthrough-add won't do so :s\n\nyou might want to have a look at dg record\n(http://git.frugalware.org/repos/pacman-tools/darcs-git.py) which does\nthis for you.\n\n- VMiklos\n"},{"id":"64491","messageId":"1199500441-sup-4067@south","threadId":"11463","inReplyTo":"20080104210751.GB26248@coredump.intra.peff.net","subject":"Re: git-walkthrough-add script","fromName":"William Morgan","fromEmail":"wmorgan-git@masanjin.net","sentAt":"2008-01-05T02:37:34Z","receivedAt":"2008-01-05T02:37:34Z","isPatch":false,"sender":{"key":"wmorgan-git@masanjin.net","avatar":null},"body":"Excerpts from Jeff King's message of Fri Jan 04 13:07:51 -0800 2008:\n> But if you have interface improvement suggestions for \"git-add -i\" or\n> \"git-add -p\", I'm sure they would be well-received (post-1.5.4\n> release, of course).\n\nNot to show off my git newbness any more than necessary, but when I run\nboth git-add -i and git-add -p, I see exactly the same output and\ninterface. Are they meant to be different? This is with both master and\nnext branches of the git repo.\n\n  ~/devel/sup$ ~/devel/git/installed/bin/git-add -i\n             staged     unstaged path\n    1:    unchanged        +1/-0 doc/TODO\n    2:    unchanged        +1/-1 lib/sup/message.rb\n    3:    unchanged      +28/-43 lib/sup/thread.rb\n  \n  *** Commands ***\n    1: status       2: update       3: revert       4: add untracked\n    5: patch        6: diff         7: quit         8: help\n  What now> \n  Bye.\n  ~/devel/sup$ ~/devel/git/installed/bin/git-add -p\n             staged     unstaged path\n    1:    unchanged        +1/-0 doc/TODO\n    2:    unchanged        +1/-1 lib/sup/message.rb\n    3:    unchanged      +28/-43 lib/sup/thread.rb\n  \n  *** Commands ***\n    1: status       2: update       3: revert       4: add untracked\n    5: patch        6: diff         7: quit         8: help\n  What now> \n  Bye.\n\n-- \nWilliam <wmorgan-git@masanjin.net>\n"},{"id":"64492","messageId":"7vprwhf0kf.fsf@gitster.siamese.dyndns.org","threadId":"11463","inReplyTo":"1199500441-sup-4067@south","subject":"Re: git-walkthrough-add script","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-01-05T02:50:08Z","receivedAt":"2008-01-05T02:50:08Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"William Morgan <wmorgan-git@masanjin.net> writes:\n\n> Excerpts from Jeff King's message of Fri Jan 04 13:07:51 -0800 2008:\n>> But if you have interface improvement suggestions for \"git-add -i\" or\n>> \"git-add -p\", I'm sure they would be well-received (post-1.5.4\n>> release, of course).\n>\n> Not to show off my git newbness any more than necessary, but when I run\n> both git-add -i and git-add -p, I see exactly the same output and\n> interface. Are they meant to be different?\n\nThey are meant to be different.\n\n    $ git reset --hard\n    $ echo >>Makefile\n    $ echo >>psql/Makefile\n    $ git add -p\n    diff --git a/Makefile b/Makefile\n    index a2177bc..eb250b0 100644\n    --- a/Makefile\n    +++ b/Makefile\n    @@ -54,3 +54,4 @@ snapdiff ::\n            latest=`ls -1dr $(_snap)/release-????-??-?? | head -n 1` &&\n            \\\n            diff -X dontdiff -ru \"$$latest\" .\n\n    +\n    Stage this hunk [y/n/a/d/?]? ^C\n\n    $ git add -i\n               staged     unstaged path\n      1:    unchanged        +1/-0 Makefile\n      2:    unchanged        +1/-0 psql/Makefile\n\n    *** Commands ***\n      1: [s]tatus     2: [u]pdate     3: [r]evert     4: [a]dd\n      untracked\n      5: [p]atch      6: [d]iff       7: [q]uit       8: [h]elp\n    What now> ^C\n\nThere may be something broken with your git installation.\n"},{"id":"64494","messageId":"1199500828-sup-502@south","threadId":"11463","inReplyTo":"20080105010011.GV29972@genesis.frugalware.org","subject":"Re: git-walkthrough-add script","fromName":"William Morgan","fromEmail":"wmorgan-git@masanjin.net","sentAt":"2008-01-05T02:54:02Z","receivedAt":"2008-01-05T02:54:02Z","isPatch":false,"sender":{"key":"wmorgan-git@masanjin.net","avatar":null},"body":"Excerpts from Miklos Vajna's message of Fri Jan 04 17:00:11 -0800 2008:\n> you might want to have a look at dg record\n> (http://git.frugalware.org/repos/pacman-tools/darcs-git.py) which does\n> this for you.\n\nThat's very similar. But I wasn't trying to mimick the darcs interface\nexactly, just steal the parts I liked. For example, I don't actually\nlike being forced to commit immediately after staging some changes;\noften I like to git diff --cached first.\n\nAlso, mine has color support. :)\n\n-- \nWilliam <wmorgan-git@masanjin.net>\n"},{"id":"64493","messageId":"7vlk75f0b6.fsf@gitster.siamese.dyndns.org","threadId":"11463","inReplyTo":"7vprwhf0kf.fsf@gitster.siamese.dyndns.org","subject":"Re: git-walkthrough-add script","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-01-05T02:55:41Z","receivedAt":"2008-01-05T02:55:41Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> William Morgan <wmorgan-git@masanjin.net> writes:\n>\n>> Not to show off my git newbness any more than necessary, but when I run\n>> both git-add -i and git-add -p, I see exactly the same output and\n>> interface. Are they meant to be different?\n>\n> They are meant to be different.\n> ...\n> There may be something broken with your git installation.\n\nA shot in the dark.  Do you have more than one installation of\ngit, one of which is ancient and whose git-add--interactive does\nnot even have --patch option?\n"},{"id":"64495","messageId":"1199502089-sup-447@south","threadId":"11463","inReplyTo":"7vlk75f0b6.fsf@gitster.siamese.dyndns.org","subject":"Re: git-walkthrough-add script","fromName":"William Morgan","fromEmail":"wmorgan-git@masanjin.net","sentAt":"2008-01-05T03:02:30Z","receivedAt":"2008-01-05T03:02:30Z","isPatch":false,"sender":{"key":"wmorgan-git@masanjin.net","avatar":null},"body":"Excerpts from Junio C Hamano's message of Fri Jan 04 18:55:41 -0800 2008:\n> A shot in the dark.  Do you have more than one installation of git,\n> one of which is ancient and whose git-add--interactive does not even\n> have --patch option?\n\nPrecisely. Now I finally see what you were talking about.\n\nWell, yup, this is pretty much what I had in mind. If only I had known.\nGuess I'll throw away my script now!\n\n-- \nWilliam <wmorgan-git@masanjin.net>\n"},{"id":"64497","messageId":"20080105034355.GA26892@coredump.intra.peff.net","threadId":"11463","inReplyTo":"1199500828-sup-502@south","subject":"Re: git-walkthrough-add script","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-01-05T03:43:55Z","receivedAt":"2008-01-05T03:43:55Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Jan 04, 2008 at 06:54:02PM -0800, William Morgan wrote:\n\n> Also, mine has color support. :)\n\nOn the current master, try:\n\n  git config color.interactive auto\n  git config color.diff auto\n  git add -i\n\n-Peff\n"},{"id":"64499","messageId":"0F790B89-2FFB-4C54-A109-E55E1FB57D3B@simplicidade.org","threadId":"11463","inReplyTo":"7vprwhf0kf.fsf@gitster.siamese.dyndns.org","subject":"Re: git-walkthrough-add script","fromName":"Pedro Melo","fromEmail":"melo@simplicidade.org","sentAt":"2008-01-05T04:08:50Z","receivedAt":"2008-01-05T04:08:50Z","isPatch":false,"sender":{"key":"melo@simplicidade.org","avatar":"https://gravatar.com/avatar/13ddbb01e300285a93aa1e3739653a81f9b1d3438bd03a4ac36b88e4ffeeafc3?d=mp&s=160"},"body":"\nOn Jan 5, 2008, at 2:50 AM, Junio C Hamano wrote:\n> They are meant to be different.\n>\n>     $ git reset --hard\n>     $ echo >>Makefile\n>     $ echo >>psql/Makefile\n>     $ git add -p\n>     diff --git a/Makefile b/Makefile\n>     index a2177bc..eb250b0 100644\n>     --- a/Makefile\n>     +++ b/Makefile\n>     @@ -54,3 +54,4 @@ snapdiff ::\n>             latest=`ls -1dr $(_snap)/release-????-??-?? | head -n  \n> 1` &&\n>             \\\n>             diff -X dontdiff -ru \"$$latest\" .\n>\n>     +\n>     Stage this hunk [y/n/a/d/?]? ^C\n\nBTW, I'm using 1.5.4rc2 and this prompt shows:\n\nStage this hunk [y/n/a/d/j/J/?]?\n\nbut the help (after you press ?) also mentions:\n\nk - leave this hunk undecided, see previous undecided hunk\nK - leave this hunk undecided, see previous hunk\ns - split the current hunk into smaller hunks\n\nbut those three options don't seem to work.\n\nBest regards,\n-- \nPedro Melo\nBlog: http://www.simplicidade.org/notes/\nXMPP ID: melo@simplicidade.org\nUse XMPP!\n"}]}