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

Re: [PATCH 9/9] show_dirstat: simplify same-content check

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Aug 25, 2018, 08:20 UTC
Message-ID
<CAPig+cTBEWxJsqtAQW0=1-mPZMk4FPXuK0Zj2hdrFzrbjry3-g@mail.gmail.com>
In-Reply-To
<20180825081731.GI737@sigill.intra.peff.net>
On Sat, Aug 25, 2018 at 4:17 AM Jeff King <peff@peff.net> wrote:
> We two nested conditionals to store a content_changed
grammo...
Show 15 quoted lines
> variable, but only bother to look at the result once,
> directly after we set it. We can drop the variable entirely
> and just use a single "if".
>
> This needless complexity is the result of 2ff3a80334 (Teach
> --dirstat not to completely ignore rearranged lines within a
> file, 2011-04-11). Before that, we held onto the
> content_changed variable much longer.
>
> While we're touching the condition, we can swap out oidcmp()
> for !oideq(). Our coccinelle patches didn't previously find
> this case because of the intermediate variable, but now it's
> a simple boolean in a conditional.
>
> Signed-off-by: Jeff King <peff@peff.net>
Previous: Jeff KingNext: Jeff King
Message 15 of 30 in “introducing oideq()”
  1. 0/9 introducing oideq()Jeff King, Aug 25, 2018
  2. 1/9 coccinelle: use <...> for function exclusionJeff King, Aug 25, 2018
  3. 2/9 introduce hasheq() and oideq()Jeff King, Aug 25, 2018
  4. Andrei RybakAug 25, 2018
  5. 3/9 convert "oidcmp() == 0" to oideq()Jeff King, Aug 25, 2018
  6. Jeff KingAug 25, 2018
  7. Derrick StoleeAug 27, 2018
  8. Derrick StoleeAug 27, 2018
  9. 4/9 convert "hashcmp() == 0" to hasheq()Jeff King, Aug 25, 2018
  10. 5/9 convert "oidcmp() != 0" to "!oideq()"Jeff King, Aug 25, 2018
  11. 6/9 convert "hashcmp() != 0" to "!hasheq()"Jeff King, Aug 25, 2018
  12. 7/9 convert hashmap comparison functions to oideq()Jeff King, Aug 25, 2018
  13. 8/9 read-cache: use oideq() in ce_compare functionsJeff King, Aug 25, 2018
  14. 9/9 show_dirstat: simplify same-content checkJeff King, Aug 25, 2018
  15. Eric SunshineAug 25, 2018
  16. Jeff KingAug 25, 2018
  17. brian m. carlsonAug 26, 2018
  18. Derrick StoleeAug 27, 2018
  19. Jeff KingAug 28, 2018
  20. 1/9 coccinelle: use <...> for function exclusionJeff King, Aug 28, 2018
  21. 2/9 introduce hasheq() and oideq()Jeff King, Aug 28, 2018
  22. 3/9 convert "oidcmp() == 0" to oideq()Jeff King, Aug 28, 2018
  23. 4/9 convert "hashcmp() == 0" to hasheq()Jeff King, Aug 28, 2018
  24. 5/9 convert "oidcmp() != 0" to "!oideq()"Jeff King, Aug 28, 2018
  25. 6/9 convert "hashcmp() != 0" to "!hasheq()"Jeff King, Aug 28, 2018
  26. 7/9 convert hashmap comparison functions to oideq()Jeff King, Aug 28, 2018
  27. 8/9 read-cache: use oideq() in ce_compare functionsJeff King, Aug 28, 2018
  28. 9/9 show_dirstat: simplify same-content checkJeff King, Aug 28, 2018
  29. Derrick StoleeAug 28, 2018
  30. brian m. carlsonAug 29, 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.