{"thread":{"id":"729","subject":"[PATCH] check_file_directory_conflict path fix","startedAt":"2005-05-27T02:59:10Z","lastAt":"2005-05-27T02:59:10Z","messageCount":1,"participants":["David Meybohm"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"4025","messageId":"20050527025910.GA4836@localhost","threadId":"729","inReplyTo":null,"subject":"[PATCH] check_file_directory_conflict path fix","fromName":"David Meybohm","fromEmail":"dmeybohmlkml@bellsouth.net","sentAt":"2005-05-27T02:59:10Z","receivedAt":"2005-05-27T02:59:10Z","isPatch":true,"sender":{"key":"dmeybohmlkml@bellsouth.net","avatar":null},"body":"check_file_directory_conflict can give the wrong answers. This is\nbecause the wrong length is passed to cache_name_pos. The length\npassed should be the length of the whole path from the root, not\nthe length of each path subcomponent.\n\n\t$ git-init-db\n\tdefaulting to local storage area\n\t$ mkdir path && touch path/file\n\t$ git-update-cache --add path/file\n\t$ rm path/file\n\t$ mkdir path/file && touch path/file/f\n\t$ git-update-cache --add path/file/f  <-- Conflict ignored\n\t$\n\nSigned-off-by: David Meybohm <dmeybohmlkml@bellsouth.net>\n---\nIndex: read-cache.c\n===================================================================\n--- ca5fef50fb68a3afbb35e1a48ac622f7a964f021/read-cache.c  (mode:100644)\n+++ uncommitted/read-cache.c  (mode:100644)\n@@ -172,11 +172,13 @@\n \tcp = pathbuf;\n \twhile (1) {\n \t\tchar *ep = strchr(cp, '/');\n+\t\tint len;\n \t\tif (!ep)\n \t\t\tbreak;\n \t\t*ep = 0;    /* first cut it at slash */\n+\t\tlen = ep - pathbuf;\n \t\tpos = cache_name_pos(pathbuf,\n-\t\t\t\t     htons(create_ce_flags(ep-cp, stage)));\n+\t\t\t\t     htons(create_ce_flags(len, stage)));\n \t\tif (0 <= pos) {\n \t\t\t/* Our leading path component is registered as a file,\n \t\t\t * and we are trying to make it a directory.  This is\n"}]}