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

Re: Broken adding of cache entries

From
Petr Baudis <pasky@ucw.cz>
Date
May 8, 2005, 16:59 UTC
Message-ID
<20050508165915.GW9495@pasky.ji.cz>
In-Reply-To
<7vll6q70mg.fsf@assigned-by-dhcp.cox.net>

Dear diary, on Sun, May 08, 2005 at 07:22:31AM CEST, I got a letter where Junio C Hamano <junkio@cox.net> told me that...

Show 8 quoted lines
> >>>>> "JCH" == Junio C Hamano <junkio@cox.net> writes:
> 
> JCH> I am not quite sure the semantics is quite right, so I am
> JCH> holding it off from putting it in git-jc repository for now, but
> JCH> please review it, give it a try and tell me what you think.
> 
> Ok, I have two updates pushed out at git-jc archive at
> http://members.cox.net/junkio/git-jc.git/

I wanted to merge with you, but I'd like to make some (mostly minor) nitpicks first.

Sorry for totally garbled whitespace and everything, this is just gpm.
--- e19665d8d42877246ac7e98a7c671d11adbe8b56/read-cache.c  (mode:100644)
+++ uncommitted/read-cache.c  (mode:100644)
+               char *ep = strchr(cp, '/');
+               if (ep == 0)
Please use NULL.
+static struct alternate_object_database
+{
+       char *base;
+       char *name;
+} *alt_odb;

The commonly accepted style is to have the { bracket on the same line as the struct identifier.

Sticking a brief explanation to prepare_alt_odb(), like "pass 0 allocates the array and pass 1 fills it" couldn't hurt, it took me a while of staring at it to figure out. There's also unused @buf variable. But I personally think all this alt_odb code is quite creepy. ;-)

--- e19665d8d42877246ac7e98a7c671d11adbe8b56/write-tree.c  (mode:100644)
+++ uncommitted/write-tree.c  (mode:100644)
-                       if (++unmerged > 10) {
+                       if (10 < ++funny) {

Do those changes make any sense? The former version is certainly much easier to read for me. I can live with it in the new code, but changing old code to it...

With the current update-cache protections, how can you legally achieve a cache with duplicate entries, so that you need to check for that in write-tree?

Thanks,
-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
Previous: Junio C HamanoNext: Junio C Hamano
Message 8 of 13 in “Broken adding of cache entries”
  1. Petr BaudisMay 7, 2005
  2. Junio C HamanoMay 7, 2005
  3. Junio C HamanoMay 7, 2005
  4. Petr BaudisMay 7, 2005
  5. Junio C HamanoMay 8, 2005
  6. Junio C HamanoMay 8, 2005
  7. Junio C HamanoMay 8, 2005
  8. Petr BaudisMay 8, 2005
  9. Junio C HamanoMay 8, 2005
  10. Petr BaudisMay 8, 2005
  11. Junio C HamanoMay 8, 2005
  12. Junio C HamanoMay 8, 2005
  13. Junio C HamanoMay 8, 2005

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.