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

Re: [PATCH 2/4] Remove silent clamp of renameLimit

From
Elijah Newren <newren@gmail.com>
Date
Nov 10, 2017, 18:36 UTC
Message-ID
<CABPp-BGwoduH_T7U4uN5A-h43wREfXdQgV8YCVWf8w5N09cYSw@mail.gmail.com>
In-Reply-To
<CAGZ79kbqxA9U7EsU6_i895vgrTUwmqv8f02NCoUqPS1_nD2PtA@mail.gmail.com>
Thanks for taking a look!

On Fri, Nov 10, 2017 at 10:26 AM, Stefan Beller <sbeller@google.com> wrote: <snip>

Show 12 quoted lines
>> -       if (rename_limit <= 0 || rename_limit > 32767)
>> -               rename_limit = 32767;
>>         if ((num_create <= rename_limit || num_src <= rename_limit) &&
>> -           (num_create * num_src <= rename_limit * rename_limit))
>> +           ((double)num_create * (double)num_src
>> +            <= (double)rename_limit * (double)rename_limit))
>>                 return 0;
>
> From a technical perspective, I would think that if
> (num_create <= rename_limit || num_src <= rename_limit)
> holds true, that the double-cast condition would also be always true?
> Could we just remove that last check?

Not necessarily. For example, if num_create = rename_limit-1 and num_src = rename_limit+2, then the first condition will be satisfied but the second won't. If it was && rather than ||, then the second condition would be superfluous.

> Or phrased differently, if we can cast to double and extend the check
> here, do we have to adapt code at other places as well?

Good point, and yes. Perhaps I should have re-ordered my patch series because I came back to it later and realized that the progress code was broken due to overflow/wraparound, and a patch 3 fixed that.

Further, the later patch used uint64_t instead of double. While double works, perhaps I should change the double here to uint64_t for consistency?

Previous: Stefan BellerNext: brian m. carlson
Message 4 of 15 in “Fix issues with rename detection limits”
  1. 0/4 Fix issues with rename detection limitsElijah Newren, Nov 10, 2017
  2. 2/4 Remove silent clamp of renameLimitElijah Newren, Nov 10, 2017
  3. Stefan BellerNov 10, 2017
  4. Elijah NewrenNov 10, 2017
  5. brian m. carlsonNov 10, 2017
  6. Elijah NewrenNov 11, 2017
  7. brian m. carlsonNov 11, 2017
  8. 3/4 progress: Fix progress meters when dealing with lots of workElijah Newren, Nov 10, 2017
  9. Junio C HamanoNov 13, 2017
  10. Elijah NewrenNov 13, 2017
  11. Junio C HamanoNov 14, 2017
  12. 1/4 sequencer: Warn when internal merge may be suboptimal due to renameLimitElijah Newren, Nov 10, 2017
  13. Junio C HamanoNov 13, 2017
  14. 4/4 sequencer: Show rename progress during cherry picksElijah Newren, Nov 10, 2017
  15. Junio C HamanoNov 13, 2017

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.