Subject: Re: bug#79126: vc-switch-working-tree does not work if there is no matching file

From: Dmitry Gutov <[email-masked]>
Date: Thu, 7 Aug 2025 04:35:12 +0300

On 06/08/2025 19:06, Spencer Baugh wrote:
> (This is maybe overengineering, but: we could even make it take*either*
> a root file name or a project object, so that callers can pass whatever
> is most convenient for them.

Not sure there will be other callers for it. Or not many anyway.

> Then the code inside could use some new
> helper function which when passed a file name, returns (project-current
> nil file-name), and when passed anything else, returns that thing.  That
> might be simple enough, and this function would be fairly useful I
> think)

If the value needs to be passed through a helper, we could just pass it 
through 'project-root'. The project values must be available in the 
caller already, so let's just standardize on those.

(We're probably coming from different schools of design: you're thinking 
in ADTs where it's normal to have something like "Thing | String" as a 
parameter type, and I'm thinking more in OOP where you pass a type, or a 
supertype - like a general protocol - but rarely a union of disjoint 
types, and if that happens, they are usually all primitive types).