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

Re: [PATCH 3/5] merge-recursive: test rename threshold option

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 21, 2016, 23:15 UTC
Message-ID
<xmqq37slac4x.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<CAPig+cQ5h4hjOwO6-xXii6QQP0J8B_bHYUwWniR6HdQN2dB_1A@mail.gmail.com>
Eric Sunshine <sunshine@sunshineco.com> writes:
Show 22 quoted lines
> On Sun, Feb 21, 2016 at 1:55 PM, Felipe Gonçalves Assis
> <felipeg.assis@gmail.com> wrote:
>> On 21 February 2016 at 14:52, Eric Sunshine <sunshine@sunshineco.com> wrote:
>>> On Sun, Feb 21, 2016 at 10:09 AM, Felipe Gonçalves Assis
>>> <felipeg.assis@gmail.com> wrote:
>>>> +test_expect_success 'rename threshold is truncated' '
>>>> +       git read-tree --reset -u HEAD &&
>>>> +       test_must_fail git merge-recursive --rename-threshold=200% HEAD^ -- HEAD master &&
>>>> +       check_find_renames_100
>>>> +'
>>>
>>> Is this truncation documented behavior or is it just a detail of the
>>> current implementation. (Genuine question; I haven't checked the
>>> documentation or source.) If just an implementation detail, then it
>>> might not be desirable to formalize it via a test.
>>
>> Not documented. I will remove this. If you prefer to have it
>> documented and the test added back later, I can do that.
>
> Looking at the code itself and its history, this seems to be a
> deliberate decision, so the test may be appropriate, however, I defer
> to Junio's judgment.

This is just us not caring enough about illogical input by crazy users who ignore the fact that the rename scores are supposed to be between 0 and max.

We could have added code to reject out-of-range values when we added support for input with '%', but we instead just made sure we clip the result within the range (probably because it was easier).

I personally do not think it would break too many people if we changed the parser to error out, but at the same time, I do not think it is worth the code churn to do so, and it probably is not worth to document the clipping either.

[Footnote]

*1* With the original "give us an integer, and we'll take it as a ratio of that number out of the next power of ten", there was no need to worry about out-of-range values.

Previous: Eric SunshineNext: Felipe Gonçalves Assis
Message 10 of 16 in “Tests and fixes for merge-recursive rename options”
  1. 0/5 Tests and fixes for merge-recursive rename optionsFelipe Gonçalves Assis, Feb 21, 2016
  2. 1/5 merge-recursive: find-renames resets thresholdFelipe Gonçalves Assis, Feb 21, 2016
  3. Eric SunshineFeb 21, 2016
  4. 2/5 merge-strategies.txt: fix typoFelipe Gonçalves Assis, Feb 21, 2016
  5. Eric SunshineFeb 21, 2016
  6. 3/5 merge-recursive: test rename threshold optionFelipe Gonçalves Assis, Feb 21, 2016
  7. Eric SunshineFeb 21, 2016
  8. Felipe Gonçalves AssisFeb 21, 2016
  9. Eric SunshineFeb 21, 2016
  10. Junio C HamanoFeb 21, 2016
  11. 4/5 merge-recursive: test option to disable renamesFelipe Gonçalves Assis, Feb 21, 2016
  12. Eric SunshineFeb 21, 2016
  13. 5/5 merge-recursive: test more consistent interfaceFelipe Gonçalves Assis, Feb 21, 2016
  14. Eric SunshineFeb 21, 2016
  15. Felipe Gonçalves AssisFeb 21, 2016
  16. Eric SunshineFeb 21, 2016

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.