Download raw body.
Bug in got log commit modifier handling?
On Wed, Sep 24 2025, Stefan Sperling wrote: > On Tue, Sep 23, 2025 at 10:47:11PM +0300, Timo Myyrä wrote: >> Hi, >> >> I was trying to get got to list previous and next commits when given >> commit id to it but it does not seem to work correctly. >> >> I'm using it on OpenBSD ports tree checkout and looking at the >> editors/emacs/Makefile history. Here's an snippet of full "got log" >> output of "got log Makefile": >> ... >> 2017-09-16 a2cb393 Update to emacs-25.3, which rolls in the fixes for CVE-2017-14482 >> 2017-09-11 491dc20 Bump, missed in previous. >> 2017-05-01 bbdf152 emacs-25.2 >> 2017-02-10 4f532da Open ports tree patches in diff-mode by default. >> 2017-02-10 2ee96d3 Don't use ld -Z on arm. >> ... >> >> I wanted to get the next and prev commits from commit "bbdf152". >> The command to get previous commit worked as expected: >> >> > $ got log -s -c bbdf152:- -l 1 Makefile >> > 2017-02-10 4f532da Open ports tree patches in diff-mode by default. >> > $ >> >> Then I tried the similar command list the next commit: >> > $ got log -s -c bbdf152:+ -l 1 Makefile >> > 2017-05-01 bbdf152 emacs-25.2 >> > $ >> >> Which seems that the log traversal is ignoring the modifier to start the >> iteration from one commit after the bbdf152 commit. I was expecting the >> above command to return: >> > 2017-09-11 491dc20 Bump, missed in previous. >> >> Is this a bug or am I using the got log incorrectly here? > > It might be cause for confusion in this case, but by design the specified > path acts like a filter which applies after commits to display have already > been selected. > > A :+1 modifier selects the next commit as seen from the repository's > root directory. > > Consider that there were months worth of commits to ports.git in-between > those two revisions of editors/emacs/Makefile. > > In your example, bbdf152:+ selects d0004fdd39fa79e6a3d072e9675dadeddde3ce6b > which modified editors/tea/Makefile and editors/teaqt/Makefile. > > The next change to editors/emacs at a2cb393 was made many, many commits later. Ah, good explanation but I had to run few more iterations with got log to get hang of it. So the command "got log -s -c bbdf152:+ -l 1 Makefile" starts the iteration one commit before bbdf152, and filters the commits by the path. What commits are left in these is finally limited to first match by the "-l 1" option. Not sure is there a way for "got log" to efficiently get the next/previous commit to given file based on a commit. Currently it seems only option is to query the full history with "got log -s editors/emacs/Makefile" and then filtering the full set of commits by the id to get the previous and next commits by file. Timo
Bug in got log commit modifier handling?