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

Re: [ANNOUNCE] Git v2.19.0-rc0

From
Jeff King <peff@peff.net>
Date
Aug 24, 2018, 02:59 UTC
Message-ID
<20180824025955.GA24535@sigill.intra.peff.net>
In-Reply-To
<CA+P7+xpm-gsjCpPOZ=2z03Peb1Jb6axKo2nTp=UUpAFgWNureg@mail.gmail.com>
On Thu, Aug 23, 2018 at 07:48:42PM -0700, Jacob Keller wrote:
Show 7 quoted lines
> Odd...
> 
> What about..
> 
> - if (oidcmp(a,b))
> + if(!oideq(a,b))
>   { ... }
Nope, it doesn't like that syntactically.
Show 6 quoted lines
> Or maybe you need to use something like
> 
>   <...
> - if (oidcmp(a,b))
> + if (!oideq(a,b))
>   ...>

Nor that (I also tried finding documentation on what exactly the angle brackets mean, but couldn't).

> Hmm. Yea, semantic patches are a bit confusing overall sometimes.
> 
> But it looks like you got something which works?

Actually, what I showed earlier does seem to have some weirdness with else-if. But I finally stumbled on something even better:

  - oidcmp(a, b) != 0
  + !oideq(a, b)

Because of the isomorphisms that coccinelle knows about, that catches everything we want. Obvious ones like:

diff --git a/bisect.c b/bisect.c
index 41c56a665e..7c1d8f1a6d 100644
--- a/bisect.c
+++ b/bisect.c
@@ -595,7 +595,7 @@ static struct commit_list *skip_away(struct commit_list *list, int count)
 
        for (i = 0; cur; cur = cur->next, i++) {
                if (i == index) {
-                       if (oidcmp(&cur->item->object.oid, current_bad_oid))
+                       if (!oideq(&cur->item->object.oid, current_bad_oid))
                                return cur;
                        if (previous)
                                return previous;

and compound conditionals like:

diff --git a/blame.c b/blame.c
index 10d72e36dd..538d0ab1aa 100644
--- a/blame.c
+++ b/blame.c
@@ -1834,7 +1834,7 @@ void setup_scoreboard(struct blame_scoreboard *sb,

                sb->revs->children.name = "children";
                while (c->parents &&
-                      oidcmp(&c->object.oid, &sb->final->object.oid)) {
+                      !oideq(&c->object.oid, &sb->final->object.oid)) {
                        struct commit_list *l = xcalloc(1, sizeof(*l));

                        l->item = c;

and even non-if contexts, like:

diff --git a/sha1-file.c b/sha1-file.c
index 631f6b9dc2..d85f4e93e1 100644
--- a/sha1-file.c
+++ b/sha1-file.c
@@ -825,7 +825,7 @@ int check_object_signature(const struct object_id *oid, void *map,
 
        if (map) {
                hash_object_file(map, size, type, &real_oid);
-               return oidcmp(oid, &real_oid) ? -1 : 0;
+               return !oideq(oid, &real_oid) ? -1 : 0;
        }

So I think we have a winner. I'll polish that up into patches and send
it out later tonight.

-Peff
Previous: Jacob KellerNext: Jeff King
Message 48 of 58 in “[ANNOUNCE] Git v2.19.0-rc0”
  1. Junio C HamanoAug 20, 2018
  2. Stefan BellerAug 20, 2018
  3. Jonathan NiederAug 20, 2018
  4. Jonathan NiederAug 21, 2018
  5. Stefan BellerAug 21, 2018
  6. Derrick StoleeAug 21, 2018
  7. Jeff KingAug 21, 2018
  8. brian m. carlsonAug 22, 2018
  9. Jeff KingAug 22, 2018
  10. Jeff KingAug 22, 2018
  11. Derrick StoleeAug 22, 2018
  12. brian m. carlsonAug 22, 2018
  13. Jeff KingAug 22, 2018
  14. Ævar Arnfjörð BjarmasonAug 22, 2018
  15. Derrick StoleeAug 22, 2018
  16. Jeff KingAug 22, 2018
  17. Duy NguyenAug 22, 2018
  18. Duy NguyenAug 22, 2018
  19. Jeff KingAug 22, 2018
  20. Derrick StoleeAug 22, 2018
  21. Duy NguyenAug 22, 2018
  22. Derrick StoleeAug 22, 2018
  23. Jeff KingAug 22, 2018
  24. Junio C HamanoAug 22, 2018
  25. Jeff KingAug 22, 2018
  26. Derrick StoleeAug 22, 2018
  27. Jeff KingAug 22, 2018
  28. Paul SmithAug 22, 2018
  29. Jeff KingAug 22, 2018
  30. Jonathan NiederAug 23, 2018
  31. Jeff KingAug 23, 2018
  32. Jonathan NiederAug 23, 2018
  33. Jeff KingAug 23, 2018
  34. brian m. carlsonAug 23, 2018
  35. Jonathan NiederAug 23, 2018
  36. Junio C HamanoAug 23, 2018
  37. wide t/perf output, was Re: [ANNOUNCE] Git v2.19.0-rc0Jeff King, Aug 23, 2018
  38. brian m. carlsonAug 23, 2018
  39. Jeff KingAug 23, 2018
  40. Derrick StoleeAug 23, 2018
  41. Junio C HamanoAug 23, 2018
  42. Jeff KingAug 23, 2018
  43. Jacob KellerAug 23, 2018
  44. Jeff KingAug 23, 2018
  45. Jeff KingAug 24, 2018
  46. Jeff KingAug 24, 2018
  47. Jacob KellerAug 24, 2018
  48. Jeff KingAug 24, 2018
  49. Jeff KingAug 24, 2018
  50. Derrick StoleeAug 24, 2018
  51. Junio C HamanoAug 27, 2018
  52. Jeff KingAug 23, 2018
  53. Derrick StoleeAug 23, 2018
  54. Jeff KingAug 24, 2018
  55. Ævar Arnfjörð BjarmasonAug 24, 2018
  56. Derrick StoleeAug 24, 2018
  57. Jeff KingAug 25, 2018
  58. Kaartic SivaraamSep 2, 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.