read_sha1_file(): report correct name of packfile with a corrupt object

Clarify the error reporting logic by moving the normal codepath (i.e. we
read the object we wanted to read correctly) up and return early.

The logic to report the name of the packfile with a corrupt object,
introduced by e8b15e6 (sha1_file: Show the the type and path to corrupt
objects, 2010-06-10), was totally bogus.  The function that knows which
bad object came from what packfile is has_packed_and_bad(); make it report
which packfile the problem was found.

"Corrupt" is already an adjective, e.g. an object is "corrupt"; we do not
have to say "corrupted object".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 file changed
tree: 22a224dc90c5eae4684aaf363cc25a8ac616685a
  1. block-sha1/
  2. builtin/
  3. compat/
  4. contrib/
  5. Documentation/
  6. git-gui/
  7. git_remote_helpers/
  8. gitk-git/
  9. gitweb/
  10. perl/
  11. ppc/
  12. t/
  13. templates/
  14. vcs-svn/
  15. xdiff/
  16. .gitattributes
  17. .gitignore
  18. .mailmap
  19. abspath.c
  20. aclocal.m4
  21. advice.c
  22. advice.h
  23. alias.c
  24. alloc.c
  25. archive-tar.c
  26. archive-zip.c
  27. archive.c
  28. archive.h
  29. attr.c
  30. attr.h
  31. base85.c
  32. bisect.c
  33. bisect.h
  34. blob.c
  35. blob.h
  36. branch.c
  37. branch.h
  38. builtin.h
  39. bundle.c
  40. bundle.h
  41. cache-tree.c
  42. cache-tree.h
  43. cache.h
  44. check-builtins.sh
  45. check-racy.c
  46. check_bindir
  47. color.c
  48. color.h
  49. combine-diff.c
  50. command-list.txt
  51. commit.c
  52. commit.h
  53. config.c
  54. config.mak.in
  55. configure.ac
  56. connect.c
  57. convert.c
  58. copy.c
  59. COPYING
  60. csum-file.c
  61. csum-file.h
  62. ctype.c
  63. daemon.c
  64. date.c
  65. decorate.c
  66. decorate.h
  67. delta.h
  68. diff-delta.c
  69. diff-lib.c
  70. diff-no-index.c
  71. diff.c
  72. diff.h
  73. diffcore-break.c
  74. diffcore-delta.c
  75. diffcore-order.c
  76. diffcore-pickaxe.c
  77. diffcore-rename.c
  78. diffcore.h
  79. dir.c
  80. dir.h
  81. editor.c
  82. entry.c
  83. environment.c
  84. exec_cmd.c
  85. exec_cmd.h
  86. fast-import.c
  87. fetch-pack.h
  88. fixup-builtins
  89. fsck.c
  90. fsck.h
  91. generate-cmdlist.sh
  92. git-add--interactive.perl
  93. git-am.sh
  94. git-archimport.perl
  95. git-bisect.sh
  96. git-compat-util.h
  97. git-cvsexportcommit.perl
  98. git-cvsimport.perl
  99. git-cvsserver.perl
  100. git-difftool--helper.sh
  101. git-difftool.perl
  102. git-filter-branch.sh
  103. git-instaweb.sh
  104. git-lost-found.sh
  105. git-merge-octopus.sh
  106. git-merge-one-file.sh
  107. git-merge-resolve.sh
  108. git-mergetool--lib.sh
  109. git-mergetool.sh
  110. git-parse-remote.sh
  111. git-pull.sh
  112. git-quiltimport.sh
  113. git-rebase--interactive.sh
  114. git-rebase.sh
  115. git-relink.perl
  116. git-remote-testgit.py
  117. git-repack.sh
  118. git-request-pull.sh
  119. git-send-email.perl
  120. git-sh-setup.sh
  121. git-stash.sh
  122. git-submodule.sh
  123. git-svn.perl
  124. GIT-VERSION-GEN
  125. git-web--browse.sh
  126. git.c
  127. git.spec.in
  128. graph.c
  129. graph.h
  130. grep.c
  131. grep.h
  132. hash.c
  133. hash.h
  134. help.c
  135. help.h
  136. hex.c
  137. http-backend.c
  138. http-fetch.c
  139. http-push.c
  140. http-walker.c
  141. http.c
  142. http.h
  143. ident.c
  144. imap-send.c
  145. INSTALL
  146. levenshtein.c
  147. levenshtein.h
  148. list-objects.c
  149. list-objects.h
  150. ll-merge.c
  151. ll-merge.h
  152. lockfile.c
  153. log-tree.c
  154. log-tree.h
  155. mailmap.c
  156. mailmap.h
  157. Makefile
  158. match-trees.c
  159. merge-file.c
  160. merge-recursive.c
  161. merge-recursive.h
  162. name-hash.c
  163. notes-cache.c
  164. notes-cache.h
  165. notes.c
  166. notes.h
  167. object.c
  168. object.h
  169. pack-check.c
  170. pack-refs.c
  171. pack-refs.h
  172. pack-revindex.c
  173. pack-revindex.h
  174. pack-write.c
  175. pack.h
  176. pager.c
  177. parse-options.c
  178. parse-options.h
  179. patch-delta.c
  180. patch-ids.c
  181. patch-ids.h
  182. path.c
  183. pkt-line.c
  184. pkt-line.h
  185. preload-index.c
  186. pretty.c
  187. progress.c
  188. progress.h
  189. quote.c
  190. quote.h
  191. reachable.c
  192. reachable.h
  193. read-cache.c
  194. README
  195. reflog-walk.c
  196. reflog-walk.h
  197. refs.c
  198. refs.h
  199. remote-curl.c
  200. remote.c
  201. remote.h
  202. replace_object.c
  203. rerere.c
  204. rerere.h
  205. resolve-undo.c
  206. resolve-undo.h
  207. revision.c
  208. revision.h
  209. run-command.c
  210. run-command.h
  211. send-pack.h
  212. server-info.c
  213. setup.c
  214. sha1-lookup.c
  215. sha1-lookup.h
  216. sha1_file.c
  217. sha1_name.c
  218. shallow.c
  219. shell.c
  220. shortlog.h
  221. show-index.c
  222. sideband.c
  223. sideband.h
  224. sigchain.c
  225. sigchain.h
  226. strbuf.c
  227. strbuf.h
  228. string-list.c
  229. string-list.h
  230. submodule.c
  231. submodule.h
  232. symlinks.c
  233. tag.c
  234. tag.h
  235. tar.h
  236. test-chmtime.c
  237. test-ctype.c
  238. test-date.c
  239. test-delta.c
  240. test-dump-cache-tree.c
  241. test-genrandom.c
  242. test-index-version.c
  243. test-line-buffer.c
  244. test-match-trees.c
  245. test-obj-pool.c
  246. test-parse-options.c
  247. test-path-utils.c
  248. test-run-command.c
  249. test-sha1.c
  250. test-sha1.sh
  251. test-sigchain.c
  252. test-string-pool.c
  253. test-svn-fe.c
  254. test-treap.c
  255. thread-utils.c
  256. thread-utils.h
  257. trace.c
  258. transport-helper.c
  259. transport.c
  260. transport.h
  261. tree-diff.c
  262. tree-walk.c
  263. tree-walk.h
  264. tree.c
  265. tree.h
  266. unimplemented.sh
  267. unpack-trees.c
  268. unpack-trees.h
  269. upload-pack.c
  270. url.c
  271. url.h
  272. usage.c
  273. userdiff.c
  274. userdiff.h
  275. utf8.c
  276. utf8.h
  277. walker.c
  278. walker.h
  279. wrap-for-bin.sh
  280. wrapper.c
  281. write_or_die.c
  282. ws.c
  283. wt-status.c
  284. wt-status.h
  285. xdiff-interface.c
  286. xdiff-interface.h