Refactor notes code to concatenate multiple notes annotating the same object

Currently, having multiple notes referring to the same commit from various
locations in the notes tree is strongly discouraged, since only one of those
notes will be parsed and shown.

This patch teaches the notes code to _concatenate_ multiple notes that
annotate the same commit. Notes are concatenated by creating a new blob
object containing the concatenation of the notes in question, and
replacing them with the concatenated note in the internal notes tree
structure.

Getting the concatenation right requires being more proactive in unpacking
subtree entries in the internal notes tree structure, so that we don't return
a note prematurely (i.e. before having found all other notes that annotate
the same object). As such, this patch may incur a small performance penalty.

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