tg-export: add subject [...] handling modes
commit8ebb33e272ca3fd9ec01ed7c20fd4aca112fc859
authorKyle J. McKay <mackyle@gmail.com>
Thu, 22 Jun 2017 06:06:38 +0000 (21 23:06 -0700)
committerKyle J. McKay <mackyle@gmail.com>
Thu, 22 Jun 2017 06:06:38 +0000 (21 23:06 -0700)
tree0cb2cd47beee2871a58f63f6141478d48c560f56
parentc6c5694757c9737930af152a965fa03400079fc0
tg-export: add subject [...] handling modes

The --collapse and --linearize modes of tg export remove the
leading [PATCH] (as they should) when creating the pristine
collapsed commits.

This was being done as a side-effect of using git mailinfo.

Unfortunately (or fortunately depending on your perspective)
much more was being stripped than just the initial [PATCH] tag.

TopGit is aware of four different initial tags, [PATCH], [BASE],
[ROOT] and (even though this one must be created manually) [STAGE].

Introduce a new `-s <mode>` option to control handling of the
subject during commit collapsing.  The default (quelle surprise)
is the "topgit" mode which will only strip the first tag and then
only if it's one of the four it knows about.  It does recognize
PATCH tags with extra stuff after them but only for PATCH.  It
will recognize those four tags with the `topgit.subjectPrefix` too.

Additional modes are provided (see the help) to get full mailinfo
stripping, no stripping, whitespace trimming only or just the
first [PATCH].  Additionally the default can be changed by setting
the `topgit.subjectMode` config item.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
README
t/t8200-export-subject.sh
tg-export.sh