Automatically run `git debrebase make-patches` if needed

Hi! When following the dgit-maint-debrebase(7) workflow, it's not uncommon to push to the Git remote (Salsa) without pushing to the archive too (e.g. when you want to push a package to Salsa which needs a sponsor). In general, you would do something like this:

...hack on package...
git debrebase conclude # make the branch fast forward
git push # push the linear history to Salsa

Since patches with git-debrebase are managed into the debian/latest branch as plain git commits, the debian/patches/ directory doesn't exist when concluding a debrebase and pushing to Salsa. debian/patches/ gets only populated when running dgit sbuild or dgit push-source.

Would it be possible to automatically run git debrebase make-patches if such a case is detected? Something like this pseudo code:

if HEAD.commit_message contains "[git-debrebase pseudomerge: quick]"
    git debrebase make-patches

Thanks!

Edit: I'm not a git-debrebase expert, so I'm not sure that checking for that exact message is correct. Maybe a more lax check like “if the commit message contains "git-debrebase" and "debian/patches/" does not exist” would be better. But you should probably ask the git-debrebase maintainers to be sure (Ian Jackson and Sean Whitton)

Edited by Andrea Pappacoda