git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3 10/10] diff-merges: let "-m" imply "-p"

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Aug 5, 2021, 03:16 UTC
Message-ID
<YQtYEftByY8cNMml@google.com>
In-Reply-To
<20210520214703.27323-11-sorganov@gmail.com>
Hi Sergey,
Sergey Organov wrote:
> Fix long standing inconsistency between -c/--cc that do imply -p on
> one side, and -m that did not imply -p on the other side.
As I mentioned before, I quite like this change for interactive use.
But:
[...]
> It's also worth to be noticed that exact historical semantics of -m is
> still provided by --diff-merges=separate.

Is that true? When I try it locally, -m shows no diff by default, whereas --diff-merges=separate shows a diff for merges.

Anyway, the reason I write is that this ended up tripping up some scripts, namely Rust's bootstrap.py (https://github.com/rust-lang/rust/commit/df004df3a79b70b4af2b8c267457a5be76bb0d85):

	git log --author=bors --format=%H -n1 \
		-m --first-parent \
		-- src/llvm-project

It's not clear what that *meant* the -m to do --- perhaps they intended it as an abbreviation for --merges. That was fixed in Rust by https://github.com/rust-lang/rust/pull/87513; in the current code at https://github.com/rust-lang/rust/blob/master/src/bootstrap/bootstrap.py Rust now uses

	git log --author=bors --format=%H -n1 \
		--no-patch --first-parent \
		-- [etc]

There's also an open pull request at https://github.com/rust-lang/rust/pull/87532 to simplify it further, to

	git rev-list --author=bors@rust-lang.org -n1 \
		--merges --first-parent HEAD \
		-- [etc]

In any event, the code using -m was pretty clearly a typo, and people trying to build current Rust won't be affected since it's fixed already, so this might not be too worrisome.

What happens if someone wants to build an older version of Rust? bootstrap.py is "symlinked" from x.py at the toplevel of a Rust distribution; the README explains

	## Installing from Source
	The Rust build system uses a Python script called `x.py` to build the compiler,
	which manages the bootstrapping process. It lives in the root of the project.
	The `x.py` command can be run directly on most systems in the following format:
	```sh
	./x.py <subcommand> [flags]
	```

so this tool is fundamental to everything. The relevant code using 'git log -m' is used in the

	if self.downloading_llvm() and stage0:

case to find out how recently llvm changed, in order to check that we have downloaded that recent of a version of llvm. It has a not-too-complicated workaround: if you build LLVM from source using the src/llvm-project submodule then this logic does not get triggered.

In other words, I don't think this issue will be _too_ problematic for people working with the Rust project. Hudson or Taylor (cc-ed) may be able to correct me if that's wrong.

Still, it does feel a bit like we've pulled the rug from underneath script authors. "git log --format=%H" is generally a pretty stable tool, and here we've changed it when passing -m from not printing diffs to printing diffs. What do you think we should do?

Some possibilities:
 a. Revert 'diff-merges: let "-m" imply "-p"'.  This buys us time to
    make a more targeted change, make the change more gradually in a
    future release, or just stop encouraging use of "-m" in docs.
 b. Make "-m" imply "-p", except in some more 'script-ish'
    circumstances (e.g. when using log --format with a format string)
 c. Go ahead with the change and advertise it in release notes.

Searching for other examples using https://codesearch.debian.net/search?q=%5Cbgit%5Cb.*%5Cblog%5Cb.*-m%5Cb&literal=0, I find that almost all uses of "git log -m" also include "-p", so (c) is kind of tempting. What do you think?

Thanks, Jonathan

Previous: Sergey OrganovNext: Jonathan Nieder
Message 110 of 129 in “Why doesn't `git log -m` imply `-p`?”
  1. Alex HenrieApr 29, 2021
  2. Junio C HamanoApr 29, 2021
  3. Sergey OrganovApr 29, 2021
  4. Alex HenrieApr 29, 2021
  5. Sergey OrganovApr 29, 2021
  6. Alex HenrieApr 29, 2021
  7. Sergey OrganovApr 29, 2021
  8. Felipe ContrerasMay 4, 2021
  9. Sergey OrganovMay 4, 2021
  10. Junio C HamanoApr 29, 2021
  11. Junio C HamanoApr 30, 2021
  12. Sergey OrganovApr 30, 2021
  13. Junio C HamanoMay 1, 2021
  14. Sergey OrganovMay 3, 2021
  15. Junio C HamanoMay 4, 2021
  16. Sergey OrganovMay 4, 2021
  17. Junio C HamanoMay 4, 2021
  18. Sergey OrganovMay 4, 2021
  19. Junio C HamanoMay 5, 2021
  20. Sergey OrganovMay 5, 2021
  21. Junio C HamanoMay 6, 2021
  22. Sergey OrganovMay 6, 2021
  23. Junio C HamanoMay 6, 2021
  24. Sergey OrganovMay 6, 2021
  25. Alex HenrieMay 7, 2021
  26. Sergey OrganovMay 10, 2021
  27. Alex HenrieMay 10, 2021
  28. 0/6 diff-merges: let -m imply -pSergey Organov, May 10, 2021
  29. 1/6 t4013: add test for "git diff-index -m"Sergey Organov, May 10, 2021
  30. 2/6 diff-merges: move specific diff-index "-m" handling to diff-indexSergey Organov, May 10, 2021
  31. Junio C HamanoMay 11, 2021
  32. Junio C HamanoMay 11, 2021
  33. Junio C HamanoMay 11, 2021
  34. Sergey OrganovMay 11, 2021
  35. 3/6 git-svn: stop passing "-m" to "git rev-list"Sergey Organov, May 10, 2021
  36. 4/6 stash list: stop passing "-m" to "git list"Sergey Organov, May 10, 2021
  37. 5/6 diff-merges: rename "combined_imply_patch" to "merges_imply_patch"Sergey Organov, May 10, 2021
  38. 6/6 diff-merges: let -m imply -pSergey Organov, May 10, 2021
  39. Junio C HamanoMay 11, 2021
  40. Junio C HamanoMay 11, 2021
  41. Sergey OrganovMay 11, 2021
  42. Alex HenrieMay 11, 2021
  43. Sergey OrganovMay 11, 2021
  44. Alex HenrieMay 11, 2021
  45. Sergey OrganovMay 11, 2021
  46. Felipe ContrerasMay 12, 2021
  47. Elijah NewrenMay 11, 2021
  48. Sergey OrganovMay 11, 2021
  49. Elijah NewrenMay 11, 2021
  50. Sergey OrganovMay 11, 2021
  51. Junio C HamanoMay 11, 2021
  52. Sergey OrganovMay 11, 2021
  53. Junio C HamanoMay 11, 2021
  54. Jonathan NiederMay 19, 2021
  55. Sergey OrganovMay 20, 2021
  56. Felipe ContrerasMay 21, 2021
  57. Sergey OrganovMay 11, 2021
  58. Sergey OrganovMay 17, 2021
  59. Sergey OrganovMay 11, 2021
  60. Jonathan NiederMay 19, 2021
  61. Sergey OrganovMay 19, 2021
  62. Junio C HamanoMay 19, 2021
  63. Sergey OrganovMay 20, 2021
  64. Jonathan NiederMay 20, 2021
  65. Sergey OrganovMay 20, 2021
  66. 0/9 diff-merges: let -m imply -pSergey Organov, May 17, 2021
  67. 1/9 t4013: test that "-m" alone has no effect in "git log"Sergey Organov, May 17, 2021
  68. 4/9 t4013: test "git diff-index -m"Sergey Organov, May 17, 2021
  69. 3/9 t4013: test "git -m --stat"Sergey Organov, May 17, 2021
  70. 2/9 t4013: test "git -m --raw"Sergey Organov, May 17, 2021
  71. Bagas SanjayaMay 18, 2021
  72. Sergey OrganovMay 18, 2021
  73. 6/9 git-svn: stop passing "-m" to "git rev-list"Sergey Organov, May 17, 2021
  74. 8/9 diff-merges: rename "combined_imply_patch" to "merges_imply_patch"Sergey Organov, May 17, 2021
  75. 5/9 diff-merges: move specific diff-index "-m" handling to diff-indexSergey Organov, May 17, 2021
  76. Junio C HamanoMay 17, 2021
  77. Sergey OrganovMay 17, 2021
  78. Junio C HamanoMay 17, 2021
  79. Sergey OrganovMay 17, 2021
  80. 9/9 diff-merges: let "-m" imply "-p"Sergey Organov, May 17, 2021
  81. 7/9 stash list: stop passing "-m" to "git list"Sergey Organov, May 17, 2021
  82. Junio C HamanoMay 17, 2021
  83. Sergey OrganovMay 17, 2021
  84. Bagas SanjayaMay 18, 2021
  85. Sergey OrganovMay 18, 2021
  86. Sergey OrganovMay 18, 2021
  87. Junio C HamanoMay 18, 2021
  88. Sergey OrganovMay 18, 2021
  89. 0/9 diff-merges: let -m imply -pSergey Organov, May 19, 2021
  90. 1/9 t4013: test that "-m" alone has no effect in "git log"Sergey Organov, May 19, 2021
  91. 2/9 t4013: test "git log -m --raw"Sergey Organov, May 19, 2021
  92. 3/9 t4013: test "git log -m --stat"Sergey Organov, May 19, 2021
  93. 4/9 t4013: test "git diff-index -m"Sergey Organov, May 19, 2021
  94. 5/9 diff-merges: move specific diff-index "-m" handling to diff-indexSergey Organov, May 19, 2021
  95. 6/9 git-svn: stop passing "-m" to "git rev-list"Sergey Organov, May 19, 2021
  96. 7/9 stash list: stop passing "-m" to "git log"Sergey Organov, May 19, 2021
  97. 8/9 diff-merges: rename "combined_imply_patch" to "merges_imply_patch"Sergey Organov, May 19, 2021
  98. 9/9 diff-merges: let "-m" imply "-p"Sergey Organov, May 19, 2021
  99. 00/10 diff-merges: let -m imply -pSergey Organov, May 20, 2021
  100. 02/10 t4013: test "git log -m --raw"Sergey Organov, May 20, 2021
  101. 01/10 t4013: test that "-m" alone has no effect in "git log"Sergey Organov, May 20, 2021
  102. 03/10 t4013: test "git log -m --stat"Sergey Organov, May 20, 2021
  103. 04/10 t4013: test "git diff-tree -m"Sergey Organov, May 20, 2021
  104. 05/10 t4013: test "git diff-index -m"Sergey Organov, May 20, 2021
  105. 06/10 diff-merges: move specific diff-index "-m" handling to diff-indexSergey Organov, May 20, 2021
  106. 07/10 git-svn: stop passing "-m" to "git rev-list"Sergey Organov, May 20, 2021
  107. 08/10 stash list: stop passing "-m" to "git log"Sergey Organov, May 20, 2021
  108. 09/10 diff-merges: rename "combined_imply_patch" to "merges_imply_patch"Sergey Organov, May 20, 2021
  109. 10/10 diff-merges: let "-m" imply "-p"Sergey Organov, May 20, 2021
  110. Jonathan NiederAug 5, 2021
  111. Revert 'diff-merges: let "-m" imply "-p"'Jonathan Nieder, Aug 6, 2021
  112. Junio C HamanoAug 6, 2021
  113. Junio C HamanoAug 6, 2021
  114. Jonathan NiederAug 6, 2021
  115. Junio C HamanoAug 8, 2021
  116. Sergey OrganovAug 17, 2021
  117. Junio C HamanoAug 17, 2021
  118. Sergey OrganovAug 18, 2021
  119. Junio C HamanoAug 19, 2021
  120. Junio C HamanoAug 19, 2021
  121. Sergey OrganovAug 20, 2021
  122. Jonathan NiederAug 7, 2021
  123. Johannes SixtAug 7, 2021
  124. Jonathan NiederAug 7, 2021
  125. Junio C HamanoAug 7, 2021
  126. Jonathan NiederAug 7, 2021
  127. Junio C HamanoAug 8, 2021
  128. Sergey OrganovAug 17, 2021
  129. Sergey OrganovAug 16, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.