From: Stefan Sperling Subject: Re: got log and subdirectories? To: Christian Weisgerber , gameoftrees@openbsd.org Date: Sat, 22 Feb 2020 17:49:05 +0100 On Sat, Feb 22, 2020 at 05:19:48PM +0100, Stefan Sperling wrote: > On Sat, Feb 22, 2020 at 04:29:47PM +0100, Christian Weisgerber wrote: > > However, when you specify an explicit path > > argument, it gets appended to the subdirectory: > > > > $ got log tog > > got: tog/tog: no such entry found in tree > > > > Clearly, something isn't quite right, but I don't know what the > > "correct" behavior should be. > As a workaround, this works in any subdirectory: got log . So this may not be a bug after all. Since your above 'got log tog' is run inside the tog/ subdir in a worktree, logging the path 'tog/tog' is an expected result. It just logs a path that does not exist. Note that this logs the history of tog/tog.c: cd tog/; got log tog.c The thing to keep in mind is that you can use tab-completion to get the log of any file or directory, if you are in a work tree. Commands such as this do work: cd tog/; got log ../got/got.c I think what we need to do here is expand the documentation as follows: diff f70ffbb53218e6d26d9ef6babd8c106b105db18b /home/stsp/src/got blob - 709b28475adcddd7a3952eb8c6d2cfcc50a08386 file + got/got.1 --- got/got.1 +++ got/got.1 @@ -330,6 +330,11 @@ Display history of a repository. If a .Ar path is specified, show only commits which modified this path. +If invoked in a work tree, the +.Ar path +is interpreted relative to the current working directory, +and the work tree's path prefix is implicitly prepended. +Otherwise, the path is interpreted relative to the repository root. .Pp The options for .Cm got log blob - dc2613f1948e568e578c8d9c6b54e1296b91ca7d file + tog/tog.1 --- tog/tog.1 +++ tog/tog.1 @@ -81,6 +81,11 @@ Display history of a repository. If a .Ar path is specified, show only commits which modified this path. +If invoked in a work tree, the +.Ar path +is interpreted relative to the current working directory, +and the work tree's path prefix is implicitly prepended. +Otherwise, the path is interpreted relative to the repository root. .Pp This command is also executed if no explicit command is specified. .Pp