Hi Vladimir,

Am Sa., 11. Jan. 2020 um 16:19 Uhr schrieb Vladimir D. Seleznev
<vsele...@altlinux.org>:
> The following patches implement strip value guessing option for GNU Patch.
> Please take a look at them.
>
> The idea is simple: it looks for the longest existent pathname to patch, and
> if it finds one, then it tries to patch the file.
>
> If the patches are deemed fine to be accepted, I'm ready to proceed with the
> copyright assignment.

In general, this rather seems like an option not to use. But let's see
if the idea can be salvaged.

When the first patch in the input creates a file in a sub-directory
(or removes a file and is applied in reverse), the guess will fail if
that sub-directory doesn't exist:

  --- /dev/null
  +++ a/dir/foo
  @@ -0,0 +1 @@
  +foo

I guess it would make sense for patch to refuse guessing in that case?

What should happen when patch finds multiple of the names in the patch
(pch_name)? Should the minimum strip level be used?

How does this interact with -R guessing as with the following patch
(apply in an empty directory with -p0)?

  --- /dev/null
  +++ bar
  @@ -1 +0,0 @@
  -bar

The "/dev/null" patch doesn't make sense to me.

If we want this kind of guessing, we should document how it works and
when it doesn't.

This needs to become a new long option; we can't cram it into -p.

Thanks,
Andreas

Reply via email to