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

Re: [PATCH 1/4] sha1-lookup: add new "sha1_pos" function to efficiently lookup sha1

From
Jeff King <peff@peff.net>
Date
Apr 5, 2009, 14:41 UTC
Message-ID
<20090405144111.GB2076@sigill.intra.peff.net>
In-Reply-To
<fabb9a1e0904050317o1399118erb15ddf86d0fe6c3c@mail.gmail.com>
On Sun, Apr 05, 2009 at 12:17:32PM +0200, Sverre Rabbelier wrote:
Show 8 quoted lines
> On Sat, Apr 4, 2009 at 22:59, Christian Couder <chriscool@tuxfamily.org> wrote:
> > +                               if (lo <= mi && mi < hi)
> > +                                       break;
> > +                               die("oops");
> 
> That's going to be an official git error message? Why not make it "The
> fatal error oops has occured, press ctrl-c to lose all your work, or
> press any other key to do the same"?

From my cursory reading of the code, this is a "cannot happen" assertion (and there is one a few lines below, too):

+                               die("oops");
+                       }
+               }
+               if (18 <= ofs)
+                       die("cannot happen -- lo and hi are identical");
+       }

I don't think we have an established style for such assertions. In theory, users never see it, but the whole point of it being there is that they _might_. :) One could use the "assert" macro, though I think its output is just as cryptic to end users. I usually do

  die("BUG: <something that makes a little bit of sense to the user>");
some examples of which you can see via "git grep BUG:".
Of course, "binary search on fire?" would probably work, too.
-Peff
Previous: Sverre RabbelierNext: Sverre Rabbelier
Message 3 of 20 in “sha1-lookup: add new "sha1_pos" function to efficiently lookup sha1”
  1. 1/4 sha1-lookup: add new "sha1_pos" function to efficiently lookup sha1Christian Couder, Apr 4, 2009
  2. Sverre RabbelierApr 5, 2009
  3. Jeff KingApr 5, 2009
  4. Sverre RabbelierApr 5, 2009
  5. Junio C HamanoApr 5, 2009
  6. Sverre RabbelierApr 5, 2009
  7. Jeff KingApr 5, 2009
  8. Sverre RabbelierApr 5, 2009
  9. Felipe ContrerasApr 5, 2009
  10. Reece DunnApr 5, 2009
  11. Junio C HamanoApr 5, 2009
  12. Jeff KingApr 5, 2009
  13. Sverre RabbelierApr 5, 2009
  14. Gnus content transfer encoding (was: [PATCH 1/4] sha1-lookup: add new "sha1_pos" function to efficiently lookup sha1)Teemu Likonen, Apr 5, 2009
  15. Junio C HamanoApr 6, 2009
  16. Reece DunnApr 5, 2009
  17. Jeff KingApr 5, 2009
  18. Jay SoffianApr 5, 2009
  19. Johannes SchindelinApr 5, 2009
  20. Felipe ContrerasApr 5, 2009

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.