From: Omar Polo Subject: Re: two small fixes for got patch To: Stefan Sperling Cc: gameoftrees@openbsd.org Date: Sat, 12 Mar 2022 14:32:18 +0100 Stefan Sperling wrote: > Have you taken a look at Subversion's patch.c: choose_target_filename()? I forgot to reply to this. I'm going a bit out of topic here but i wanted to explain this somewhere because it's an idea I followed when implementing the patch command that I haven't explained elsewhere. Larry' patch (and svn' patch.c too judging from the code, i never used subversion) make use of some heuristics to determine what is the "old file" and what is the "new" one (like choosing the path with the smaller number of components.) While this is perfectly fine for patch(1), i'd like (if possible) for got to not do this. One important advantage got patch has over patch(1) is that we _know_ which files are part of the repository and which don't. We don't have to guess. Or at least, I'd like if we can manage not to resort to guesses and heuristics :) (That's the idea behind the "check file status before applying patch" diff that i sent previously and that now i have to adjust.) It's not perfect yet, in particular this means that at the moment `got patch' fails on partial checkouts (i.e. `got co -p') and diff for relative paths (the one you generate with cvs in a subdirectory for instance), but I think we can fix these issues in a different way.