Fix the rename detection limit checking

This adds more proper rename detection limits. Instead of just checking
the limit against the number of potential rename destinations, we verify
that the rename matrix (which is what really matters) doesn't grow
ridiculously large, and we also make sure that we don't overflow when
doing the matrix size calculation.

This also changes the default limits from unlimited, to a rename matrix
that is limited to 100 entries on a side. You can raise it with the config
entry, or by using the "-l<n>" command line flag, but at least the default
is now a sane number that avoids spending lots of time (and memory) in
situations that likely don't merit it.

The choice of default value is of course very debatable. Limiting the
rename matrix to a 100x100 size will mean that even if you have just one
obvious rename, but you also create (or delete) 10,000 files, the rename
matrix will be so big that we disable the heuristics. Sounds reasonable to
me, but let's see if people hit this (and, perhaps more importantly,
actually *care*) in real life.

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