{"thread":{"id":"3983","subject":"RE: fatal: git-write-tree: not able to write tree","startedAt":"2006-04-28T08:43:00Z","lastAt":"2006-04-28T09:01:55Z","messageCount":2,"participants":["Brown, Len","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"19220","messageId":"CFF307C98FEABE47A452B27C06B85BB64A432C@hdsmsx411.amr.corp.intel.com","threadId":"3983","inReplyTo":null,"subject":"RE: fatal: git-write-tree: not able to write tree","fromName":"Brown, Len","fromEmail":"len.brown@intel.com","sentAt":"2006-04-28T08:43:00Z","receivedAt":"2006-04-28T08:43:00Z","isPatch":false,"sender":{"key":"len.brown@intel.com","avatar":"https://gravatar.com/avatar/a091f34f66caadb51d85a8a496800c6ccae73737e2f45762373e6b8c55fa5dd6?d=mp&s=160"},"body":" \n>> git am --3way --interactive --signoff --utf8 --resolved\n\n>Please say \"--resolved\" after you have actually resolved them,\n>eh, meaning, (1) edit the working tree file into a desired\n>shape, and (2) git-update-index drivers/acpi/thermal.c.\n\nThanks Junio, once again, for your help, we're up and running!\n\nI'm okay with git being conservative and not doing the update-index\nfor me.  Perhaps the thing to do here is to make the failure message\nmore useful?\n\n\"fatal: git-write-tree: not able to write tree\"\n\neverything after \"fatal\" here is effectively a string\nof random characters to the hapless user.\n\nthanks,\n-Len\n"},{"id":"19221","messageId":"7v7j5adqf0.fsf@assigned-by-dhcp.cox.net","threadId":"3983","inReplyTo":"CFF307C98FEABE47A452B27C06B85BB64A432C@hdsmsx411.amr.corp.intel.com","subject":"Re: fatal: git-write-tree: not able to write tree","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-04-28T09:01:55Z","receivedAt":"2006-04-28T09:01:55Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Brown, Len\" <len.brown@intel.com> writes about the command \"git\nam -3 --resolved\", after hand merging _but_ without update-index\nto actually mark the paths that have been resolved, results in\n\"write-tree\" failure.\n\n> I'm okay with git being conservative and not doing the update-index\n> for me.  Perhaps the thing to do here is to make the failure message\n> more useful?\n>\n> \"fatal: git-write-tree: not able to write tree\"\n>\n> everything after \"fatal\" here is effectively a string\n> of random characters to the hapless user.\n\nThat's very true.  Perhaps something like this?\n\n-- >8 --\ngit-am --resolved: more usable error message.\n\nAfter doing the hard work of hand resolving the conflicts in the\nworking tree, if the user forgets to run update-index to mark\nthe paths that have been resolved, the command gave an\nunfriendly \"fatal: git-write-tree: not able to write tree\" error\nmessage.  Catch the situation early and give more meaningful\nmessage and suggestion.\n\nNoticed and suggested by Len Brown.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\ndiff --git a/git-am.sh b/git-am.sh\nindex eab4aa8..872145b 100755\n--- a/git-am.sh\n+++ b/git-am.sh\n@@ -376,6 +376,13 @@ do\n \t\t\techo \"No changes - did you forget update-index?\"\n \t\t\tstop_here $this\n \t\tfi\n+\t\tunmerged=$(git-ls-files -u)\n+\t\tif test -n \"$unmerged\"\n+\t\tthen\n+\t\t\techo \"You still have unmerged paths in your index\"\n+\t\t\techo \"did you forget update-index?\"\n+\t\t\tstop_here $this\n+\t\tfi\n \t\tapply_status=0\n \t\t;;\n \tesac\n"}]}