xutils: Fix hashing an incomplete line with whitespaces at the end

Upon seeing a whitespace, xdl_hash_record_with_whitespace() first skipped
the run of whitespaces (excluding LF) that begins there, ensuring that the
pointer points at the last whitespace character in the run, and assumed
that the next character must be LF at the end of the line.  This does not
work when hashing an incomplete line, which lacks the LF at the end.

Introduce "at_eol" variable that is true when either we are at the end of
line (looking at LF) or at the end of an incomplete line, and use that
instead throughout the code.

Noticed by Thell Fowler.

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