Share tags2

Supersedes #11351.
assignment inside if