Skip to content

Instantly share code, notes, and snippets.

@zmousm
zmousm / git_stale_branches.sh
Last active May 11, 2018 09:45
Notify committers about stale branches in a repository. This is mostly useful in environments where collaborators push to a shared repository.
#!/bin/bash
usage () {
cat >&2 <<EOF
Usage: $0 (-r /path/to/git/repo | -u scheme:///git/repo/to/clone) [OPTIONS]
Detect potentially stale branches in a git repository and notify committers
or a designated party.
Mandatory arguments to long options are mandatory for short options too.
@zmousm
zmousm / phabricator.sieve
Created April 25, 2019 07:44
phabricator mail address header normalization: To: -> differential reviewers or maniphest task owner, Cc: subscribers (up to 3)
require [ "regex", "editheader", "relational", "variables" ];
if header :is "X-Phabricator-Sent-This-Message" "Yes" {
# assumption: common mail domain
set "msfx" "@example.com";
# match up to 3 subscribers
if header :regex "X-Phabricator-Stamps" "subscriber\\([@#]([^\\)]+)\\)(.+subscriber\\([@#]([^\\)]+)\\))?(.+subscriber\\([@#]([^\\)]+)\\))?" {
set "psub" "${1}${msfx}";
if string :count "ne" "${3}" ["0"] {
set "psub" "${psub}, ${3}${msfx}";