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

From:
Mark Jamsek <mark@jamsek.com>
Subject:
Re: tog unable to view history of renamed file
To:
Ted Bullock <tbullock@comlore.com>
Cc:
gameoftrees@openbsd.org
Date:
Thu, 30 Mar 2023 14:59:06 +1100

Download raw body.

Thread
On 23-03-29 08:25PM, Ted Bullock wrote:
> Hi,
> 
> I'm working back through the upstream libevent history and they renamed
> evbuffer.c to bufferevent.c in something like 2009.
> 
> I wanted to pull up the commit history on the old file using tog so I
> rewound the repository to the commit prior to the rename but tog doesn't
> seem to be able to see the file as part of the commit history despite it
> now existing there on the disk.
> 
> I'm seeing this:
> 
> spikard$ ls -l evbuffer.c
> -rw-r--r--  1 tbullock  tbullock  17734 Mar 29 20:15 evbuffer.c
> 
> spikard$ tog evbuffer.c
> tog: 'evbuffer.c' is no known command or path
> usage: tog [-hV] command [arg ...]
> lazy usage: tog path
> commands: log diff blame tree ref
> 
> Log also fails, also for presumably the same reason.
> 
> spikard$ tog log evbuffer.c
> tog: evbuffer.c: no such entry found in tree
> 
> Is this a bug or am I just not reading the manual correctly again.

Not a bug, but perhaps a misunderstanding of tog and indeed 'got log',
which will exhibit the same behaviour.

Invoking '{got,tog} log' will populate the log with commits beginning
from HEAD or, if invoked from a work tree, the _head_ of the work tree's
current branch. As such, only files in the corresponding tree exist.

To see files from previous versions, pass the desired version to the -c
option; for example:

  {got,tog} log -c 40a44b36bbc108a97e65517b98bc2bb65896ff07 evbuffer.c

> Ideally I would like to see the commit history in tog transcend the
> rename operation, but failing that I still would expect the tool to pull
> the history of the file when rewound to when it still exists at the old
> name.

I'm not sure if it would be more intuitive to start traversing history
from the checked-out commit if invoked in a work tree. It may be
somewhat surprising to see a bunch of missing commits. As it stands, to
achieve this behaviour, simply grab the work tree's base commit from
'got info' and pass it to '{got,tog} log -c'.

Perhaps this behaviour could be made clearer in the docs, although
I think it is already quite clear (a branch ref always points at the
head of the branch):

-c commit
     ...
     If this option is not specified, default to the work tree's current
     branch if invoked in a work tree, or to the repository's HEAD reference.

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