Skip to content
  • Javier Martinez Canillas's avatar
    dim: Check that patches have git-format-patch default prefixes · 132510ea
    Javier Martinez Canillas authored and Daniel Vetter's avatar Daniel Vetter committed
    
    
    By default the git-format-patch command generates patches with prefixes
    for the source and destination (-p1), and is also what git-am uses as a
    default. The command strips the first leading path component when patch
    is applied (unless a different -p<num> argument is used).
    
    But the patch generating behaviour can be changed with git-format-patch
    --no-prefix argument (or setting 'diff.noprefix = true' in .gitconfig).
    
    Patches with no source and destination prefixes can confuse the git-am
    3-way merge logic, since stripping the first path component will lead
    to wrong paths for newly added files.
    
    To avoid this, check that patches to apply are using git-format-patch's
    defaults prefixes to make sure that git-am defaults are safe to use too.
    
    Since there are developers that generate patches without using git, make
    this an error but allow to still continue when using the dim -f option.
    
    Signed-off-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
    Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
    132510ea