Avoid importing invalid and duplicate patch names
commit0e569fd4bfc661f922f48bb65b2579d98f5e8ef3
authorPeter Grayson <pete@jpgrayson.net>
Mon, 1 Feb 2021 22:38:19 +0000 (1 17:38 -0500)
committerPeter Grayson <pete@jpgrayson.net>
Sun, 7 Feb 2021 03:57:05 +0000 (6 22:57 -0500)
tree23e70ae3d7f74f7c1ce607b21d52fc1967e23d73
parent6e94acc91106fda79a5edbc57225b953d35090cc
Avoid importing invalid and duplicate patch names

This aims to be a comprehensive repair of issues with `stg import` allowing
invalid and duplicate patch names.

The new Patches.make_name() method creates a unique and valid patch name
based on its knowledge of existing patch names. Since StGit patch names are
used as Git refs, make_name() also attempts to enforce Git's rules for ref
naming. Generated patch names are checked with `git check-ref-format`
before being returned.

Repairs #64

Signed-off-by: Peter Grayson <pete@jpgrayson.net>
stgit/commands/imprt.py
stgit/config.py
stgit/lib/stack.py
stgit/utils.py
t/t1800-import.sh
t/t1801-import-email.sh
t/t1801/email-mbox-same-subject [new file with mode: 0644]