ref-filter: add --no-contains option to tag/branch/for-each-ref

Change the tag, branch & for-each-ref commands to have a --no-contains
option in addition to their longstanding --contains options.

This allows for finding the last-good rollout tag given a known-bad
<commit>. Given a hypothetically bad commit cf5c7253e0, the git
version to revert to can be found with this hacky two-liner:

    (git tag -l 'v[0-9]*'; git tag -l --contains cf5c7253e0 'v[0-9]*') |
        sort | uniq -c | grep -E '^ *1 ' | awk '{print $2}' | tail -n 10

With this new --no-contains option the same can be achieved with:

    git tag -l --no-contains cf5c7253e0 'v[0-9]*' | sort | tail -n 10

As the filtering machinery is shared between the tag, branch &
for-each-ref commands, implement this for those commands too. A
practical use for this with "branch" is e.g. finding branches which
were branched off between v2.8.0 and v2.10.0:

    git branch --contains v2.8.0 --no-contains v2.10.0

The "describe" command also has a --contains option, but its semantics
are unrelated to what tag/branch/for-each-ref use --contains for. A
--no-contains option for "describe" wouldn't make any sense, other
than being exactly equivalent to not supplying --contains at all,
which would be confusing at best.

Add a --without option to "tag" as an alias for --no-contains, for
consistency with --with and --contains.  The --with option is
undocumented, and possibly the only user of it is
Junio (<xmqqefy71iej.fsf@gitster.mtv.corp.google.com>). But it's
trivial to support, so let's do that.

The additions to the the test suite are inverse copies of the
corresponding --contains tests. With this change --no-contains for
tag, branch & for-each-ref is just as well tested as the existing
--contains option.

In addition to those tests, add a test for "tag" which asserts that
--no-contains won't find tree/blob tags, which is slightly
unintuitive, but consistent with how --contains works & is documented.

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

Git - fast, scalable, distributed revision control system

Git is a fast, scalable, distributed revision control system with an unusually rich command set that provides both high-level operations and full access to internals.

Git is an Open Source project covered by the GNU General Public License version 2 (some parts of it are under different licenses, compatible with the GPLv2). It was originally written by Linus Torvalds with help of a group of hackers around the net.

Please read the file INSTALL for installation instructions.

Many Git online resources are accessible from http://git-scm.com/ including full documentation and Git related tools.

See Documentation/gittutorial.txt to get started, then see Documentation/giteveryday.txt for a useful minimum set of commands, and Documentation/git-.txt for documentation of each command. If git has been correctly installed, then the tutorial can also be read with man gittutorial or git help tutorial, and the documentation of each command with man git-<commandname> or git help <commandname>.

CVS users may also want to read Documentation/gitcvs-migration.txt (man gitcvs-migration or git help cvs-migration if git is installed).

The user discussion and development of Git take place on the Git mailing list -- everyone is welcome to post bug reports, feature requests, comments and patches to git@vger.kernel.org (read Documentation/SubmittingPatches for instructions on patch submission). To subscribe to the list, send an email with just “subscribe git” in the body to majordomo@vger.kernel.org. The mailing list archives are available at https://public-inbox.org/git, http://marc.info/?l=git and other archival sites.

The maintainer frequently sends the “What's cooking” reports that list the current status of various development topics to the mailing list. The discussion following them give a good reference for project status, development direction and remaining tasks.

The name “git” was given by Linus Torvalds when he wrote the very first version. He described the tool as “the stupid content tracker” and the name as (depending on your mood):

  • random three-letter combination that is pronounceable, and not actually used by any common UNIX command. The fact that it is a mispronunciation of “get” may or may not be relevant.
  • stupid. contemptible and despicable. simple. Take your pick from the dictionary of slang.
  • “global information tracker”: you're in a good mood, and it actually works for you. Angels sing, and a light suddenly fills the room.
  • “goddamn idiotic truckload of sh*t”: when it breaks