git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 2/3] add -p: allow line selection to be inverted

From
PWPhillip Wood <phillip.wood@talktalk.net>
Date
Mar 14, 2018, 11:02 UTC
Message-ID
<59492efe-f455-1214-86e4-7a48bbe8f556@talktalk.net>
In-Reply-To
<xmqqsh942ayf.fsf@gitster-ct.c.googlers.com>
On 13/03/18 16:32, Junio C Hamano wrote:
Show 49 quoted lines
> Phillip Wood <phillip.wood@talktalk.net> writes:
> 
>> On 08/03/18 17:53, Junio C Hamano wrote:
>>> Phillip Wood <phillip.wood@talktalk.net> writes:
>>>
>>>> and use a leading '-' for inversion. I'm tempted to keep supporting 'n-'
>>>> to mean everything from 'n' to the last line though.
>>>
>>> Thanks for double checking.  It would be a better endgame to follow
>>> up with an update to existing "range selection" code to also support
>>> "n-", if you go that route.
>>>
>> I'm afraid I'm not sure exactly what you're suggesting. At the moment
>> the range selection code is in the first patch and supports incomplete
>> ranges. Are you suggesting that support for incomplete ranges should be
>> in a separate patch or have I misunderstood?
> 
> My observation of the situation behind my reasoning is:
> 
>  - There is an existing UI that uses "-X" to mean "exclude what
>    matches X" and that was the reason why you decided to follow suit
>    instead of using "^X" for inversion of X.
> 
>  - Such an existing UI would not have used "-X" to mean "the first
>    possible choice thru X".  You will lose that from your new thing
>    and you accepted that.
> 
>  - It is likely (I did not check, though) that the existing UI would
>    not have used "Y-" to mean "starting from Y all the possible
>    choices thru to the end", but that is merely for symmetry with
>    the lack (inability to use) of "-X".  There is no fundamental
>    reason why "Y-" cannot mean that, and you are tempted to allow do
>    so in your new thing for the same reason.
> 
> So if we are going to have "N-" to mean "everything from N to the
> last line", then the same "Starting at N to the end of the all the
> possible choices" should be allowed in the existing UI (i.e. the one
> that forced you to give up "^X" for the sake of consistency) for the
> same consistency reasons, no?
> 
> For that, if you want to keep the "n-" you did in your first patch,
> the most logical thing is to have a preparatory enhancement to teach
> "N-" to list_and_choose(), and then build your series on top.  Or
> you can do without such a change to list_and_choose() in your series,
> in which case, you drop "n-" support and then at the very end after
> the series settles, add "n-" support to the new code in this series
> and to list_and_choose() at the same time in a follow-up patch.
> 
> 

Thanks for taking the time to clarify that, I hadn't twigged you were talking about changing list_and_choose() before. I think it would make sense for that and 'git clean' to match the line selection with "n-". I just opened it up my editor to do that and was pleasantly surprised to discover that "n-" is already implemented for both list_and_choose() and 'git clean' so there's nothing that needs doing on that front. I'll reroll this series with the other changes and send it later this week or next week

Best Wishes
Phillip
Previous: Junio C HamanoNext: Igor Djordjevic
Message 13 of 53 in “add -p: select individual hunk lines”
  1. 0/3 add -p: select individual hunk linesPhillip Wood, Feb 19, 2018
  2. 1/3 add -p: select individual hunk linesPhillip Wood, Feb 19, 2018
  3. 2/3 add -p: allow line selection to be invertedPhillip Wood, Feb 19, 2018
  4. 3/3 add -p: optimize line selection for short hunksPhillip Wood, Feb 19, 2018
  5. Gustavo LeiteFeb 19, 2018
  6. 0/3 add -p: select individual hunk linesPhillip Wood, Mar 6, 2018
  7. 2/3 add -p: allow line selection to be invertedPhillip Wood, Mar 6, 2018
  8. Junio C HamanoMar 6, 2018
  9. Phillip WoodMar 8, 2018
  10. Junio C HamanoMar 8, 2018
  11. Phillip WoodMar 13, 2018
  12. Junio C HamanoMar 13, 2018
  13. Phillip WoodMar 14, 2018
  14. Igor DjordjevicMar 6, 2018
  15. 1/3 add -p: select individual hunk linesPhillip Wood, Mar 6, 2018
  16. Igor DjordjevicMar 6, 2018
  17. Igor DjordjevicMar 6, 2018
  18. 3/3 add -p: optimize line selection for short hunksPhillip Wood, Mar 6, 2018
  19. Igor DjordjevicMar 6, 2018
  20. Igor DjordjevicMar 6, 2018
  21. Junio C HamanoMar 6, 2018
  22. Igor DjordjevicMar 6, 2018
  23. 0/3 add -p: select individual hunk linesPhillip Wood, Mar 16, 2018
  24. 1/3 add -p: select individual hunk linesPhillip Wood, Mar 16, 2018
  25. 2/3 add -p: allow line selection to be invertedPhillip Wood, Mar 16, 2018
  26. 3/3 add -p: optimize line selection for short hunksPhillip Wood, Mar 16, 2018
  27. Junio C HamanoMar 29, 2018
  28. Phillip WoodMar 30, 2018
  29. Ævar Arnfjörð BjarmasonMar 31, 2018
  30. Phillip WoodApr 2, 2018
  31. Ævar Arnfjörð BjarmasonApr 2, 2018
  32. 0/4 add -p: select individual hunk linesPhillip Wood, Jul 26, 2018
  33. 1/4 add -p: select individual hunk linesPhillip Wood, Jul 26, 2018
  34. 4/4 add -p: optimize line selection for short hunksPhillip Wood, Jul 26, 2018
  35. 3/4 add -p: allow line selection to be invertedPhillip Wood, Jul 26, 2018
  36. 2/4 add -p: select modified lines correctlyPhillip Wood, Jul 26, 2018
  37. 0/4 add -p: select individual hunk linesPhillip Wood, Jul 26, 2018
  38. 1/4 add -p: select individual hunk linesPhillip Wood, Jul 26, 2018
  39. Junio C HamanoJul 26, 2018
  40. Phillip WoodJul 27, 2018
  41. Junio C HamanoJul 27, 2018
  42. 2/4 add -p: select modified lines correctlyPhillip Wood, Jul 26, 2018
  43. Junio C HamanoJul 26, 2018
  44. Phillip WoodJul 27, 2018
  45. Junio C HamanoJul 27, 2018
  46. 3/4 add -p: allow line selection to be invertedPhillip Wood, Jul 26, 2018
  47. 4/4 add -p: optimize line selection for short hunksPhillip Wood, Jul 26, 2018
  48. Ævar Arnfjörð BjarmasonJul 27, 2018
  49. Phillip WoodJul 28, 2018
  50. Ævar Arnfjörð BjarmasonJul 28, 2018
  51. Phillip WoodAug 3, 2018
  52. Junio C HamanoAug 3, 2018
  53. Ævar Arnfjörð BjarmasonAug 3, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.