range-diff: also show the diff between patches

Just like tbdiff, we now show the diff between matching patches. This is
a "diff of two diffs", so it can be a bit daunting to read for the
beginner.

An alternative would be to display an interdiff, i.e. the hypothetical
diff which is the result of first reverting the old diff and then
applying the new diff.

Especially when rebasing frequently, an interdiff is often not feasible,
though: if the old diff cannot be applied in reverse (due to a moving
upstream), an interdiff can simply not be inferred.

This commit brings `range-diff` closer to feature parity with regard
to tbdiff.

To make `git range-diff` respect e.g. color.diff.* settings, we have
to adjust git_branch_config() accordingly.

Note: while we now parse diff options such as --color, the effect is not
yet the same as in tbdiff, where also the commit pairs would be colored.
This is left for a later commit.

Note also: while tbdiff accepts the `--no-patches` option to suppress
these diffs between patches, we prefer the `-s` (or `--no-patch`) option
that is automatically supported via our use of diff_opt_parse().

And finally note: to support diff options, we have to call
`parse_options()` such that it keeps unknown options, and then loop over
those and let `diff_opt_parse()` handle them. After that loop, we have
to call `parse_options()` again, to make sure that no unknown options
are left.

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

Issues which are security relevant should be disclosed privately to the Git Security mailing list git-security@googlegroups.com.

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