"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: got log and subdirectories?
To:
Christian Weisgerber <naddy@mips.inka.de>
Cc:
gameoftrees@openbsd.org
Date:
Sun, 23 Feb 2020 13:16:19 +0100

Download raw body.

Thread
On Sat, Feb 22, 2020 at 10:19:14PM +0100, Christian Weisgerber wrote:
> Stefan Sperling:
> 
> > It's great that you're pointing these inconsistencies out because they
> > do really need to be fixed. I don't actually care which way.
> > We just need to decide on a convention and apply it consistently.
> > Would you prefer an implicit dot to apply everywhere?
> 
> People coming from CVS or Subversion will expect an implicit dot.
> But if you say that Subversion's experience with this has been poor,
> then I'm happy to adapt.

Subversion's problems are not caused by the path question alone.
The first commit shown in the log is implicitly deduced as well!
See https://subversion.apache.org/faq.html#hidden-log
This quirk is still causing occasional questions in the #svn-user IRC
channel today.

Got knows no "revision" for directories, but does for files so it could
offer the same functionality. Still, I think it is best to let users
pass '-c' if they want to view a specific commit, and always start log
output with the latest commit by default.
The reason again is SVN's poor experience with implicit parameters
derived from working copy context. Most users just don't expect this.

> I'm unsure how to best document this.
> The fact that you even can specify "." as a path is not obvious.

I would documented it in EXAMPLES.

ok?

diff d042f94087b1d62c183ddd03197de328ffafa9c9 /home/stsp/src/got
blob - c95b502d374f3a2f0d652dc4109a4f8a071ed788
file + got/got.1
--- got/got.1
+++ got/got.1
@@ -1445,6 +1445,20 @@ via the repository's HEAD reference, respectively:
 .Pp
 .Dl $ got log -p -l 3
 .Pp
+In a work tree or a git repository directory, log the history of a subdirectory:
+.Pp
+.Dl $ got log sys/uvm
+.Pp
+While operating inside a work tree, paths are specified relative to the current
+working directory, so this command will log the subdirectory
+.Pa sys/uvm :
+.Pp
+.Dl $ cd sys/uvm && got log '.'
+.Pp
+And this command has the same effect:
+.Pp
+.Dl $ cd sys/dev/usb && got log ../../uvm
+.Pp
 Add new files and remove obsolete files in a work tree directory:
 .Pp
 .Dl $ got add sys/uvm/uvm_ubc.c