fast-export: don't handle uninteresting refs

They have been marked as UNINTERESTING for a reason, lets respect
that.  Currently the first ref is handled properly, but not the
rest.  Assuming that all the refs point at the same commit in the
following example:

  % git fast-export master ^uninteresting ^foo ^bar
  reset refs/heads/bar
  from :0

  reset refs/heads/foo
  from :0

  reset refs/heads/uninteresting
  from :0

  % git fast-export ^uninteresting ^foo ^bar master
  reset refs/heads/master
  from :0

  reset refs/heads/bar
  from :0

  reset refs/heads/foo
  from :0

Clearly this is wrong; the negative refs should be ignored.

After this patch:

  % git fast-export ^uninteresting ^foo ^bar master
  # nothing
  % git fast-export master ^uninteresting ^foo ^bar
  # nothing

And even more, it would only happen if the ref is pointing to exactly
the same commit, but not otherwise:

 % git fast-export ^next next
 reset refs/heads/next
 from :0

 % git fast-export ^next next^{commit}
 # nothing
 % git fast-export ^next next~0
 # nothing
 % git fast-export ^next next~1
 # nothing
 % git fast-export ^next next~2
 # nothing

The reason this happens is that before traversing the commits,
fast-export checks if any of the refs point to the same object, and any
duplicated ref gets added to a list in order to issue 'reset' commands
after the traversing. Unfortunately, it's not even checking if the
commit is flagged as UNINTERESTING. The fix of course, is to check it.

However, in order to do it properly we need to get the UNINTERESTING
flag from the command line, not from the commit object, because
"^foo bar" will mark the commit 'bar' uninteresting if foo and bar
points at the same commit.  rev_cmdline_info, which was introduced
exactly to handle this situation, contains all the information we
need for get_tags_and_duplicates(), plus the ref flag. This way the
rest of the positive refs will remain untouched; it's only the
negative ones that change in behavior.

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