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

From:
Mark Jamsek <mark@jamsek.com>
Subject:
Re: tog: implement diff view 'p' keymap to write patch file
To:
Christian Weisgerber <naddy@mips.inka.de>
Cc:
gameoftrees@openbsd.org
Date:
Sun, 11 Aug 2024 16:52:17 +1000

Download raw body.

Thread
Christian Weisgerber <naddy@mips.inka.de> wrote:
> Mark Jamsek:
> 
> > As mentioned in the log view 'm' keymap thread, this is the next step to
> > facilitate code review workflows with a new 'p' keymap to write out the
> > currently viewed diff to a patch file.
> > 
> > We write to a file in /tmp and report the path to the status line.
> 
> That's a weird place.  As a user, I never really need to look into
> /tmp or grab files from there.
> 
> Home directory?  Or simply the current working directory?  Just
> about everything in the Unix world defaults to writing to the cwd.
> That is a bit at odds with invoking tog in a worktree, but is it a
> good idea to diverge from such a fundamental convention?  IIRC,
> git-format-patch also dumps its output into the cwd, so typically
> the worktree/repository, for whatever that is worth.

Bearing in mind tog could be invoked with tog diff -r repo from anywhere
in the filesystem (and indeed the log and thus diff view can be reached
from most other tog cmd invocations that only unveil the repository) in
which case the cwd may not be unveiled. So with this constraint in mind
my first thought was to write to the cwd if it is a worktree or
repository, otherwise write it to the repository directory as that's
guaranteed to be unveiled in all tog invocations.

But when stsp suggested /tmp, I realised this made more sense. I think
it's preferable to write it to a consistent location rather than switch
it up on the user.

I agree with you that the cwd is a de facto standard and if we could I'd
prefer that convention but in this case we could only do it sometimes
and that inconsistency isn't ideal.

That said, if you think the repository directory would be better or if
you prefer the cwd when we can and $REPODIR or $TMP when we can't, I'm
happy to change it.


-- 
Mark Jamsek <https://bsdbox.org>
GPG: F2FF 13DE 6A06 C471 CA80  E6E2 2930 DC66 86EE CF68