X-Git-Url: https://git.distorted.org.uk/~mdw/stgit/blobdiff_plain/b839b1cf42be33947adb87d6a2ae2164aad2371e..99c529152847b7e20e48dc477925e315918eed5d:/stgit/commands/common.py diff --git a/stgit/commands/common.py b/stgit/commands/common.py index d986711..4e802bc 100644 --- a/stgit/commands/common.py +++ b/stgit/commands/common.py @@ -294,14 +294,15 @@ def patch_name_from_msg(msg): subject_line = msg[:30].lstrip().split('\n', 1)[0].lower() return re.sub('[\W]+', '-', subject_line).strip('-') -def make_patch_name(msg, unacceptable, default_name = 'patch'): +def make_patch_name(msg, unacceptable, default_name = 'patch', + alternative = True): """Return a patch name generated from the given commit message, guaranteed to make unacceptable(name) be false. If the commit message is empty, base the name on default_name instead.""" patchname = patch_name_from_msg(msg) if not patchname: - patchname = 'patch' - if unacceptable(patchname): + patchname = default_name + if alternative and unacceptable(patchname): suffix = 0 while unacceptable('%s-%d' % (patchname, suffix)): suffix += 1