Skip to content

Write a script that deletes old merged Git branches

Our main Git repo already has 400+ branches, and it’s growing fast. Each branch results in a dedicated APT suite (that is, most of the time, empty). Keeping all those branches will also make the process of detecting active ones (form #6196 (closed)) slower.

We should detect, and delete, at least Git branches that were merged into a released tag. We already have code in auto/scripts/tails-custom-apt-sources, in the main Tails Git repository, to detect released tags. That could be reused somehow. An initial implementation might copy’n’paste the logic or the code, but in the end we should factor this out into a library or set of small utility scripts.

Once we have a script that can do that, we can run it once to start with, and then maybe periodically (e.g. at post-release time).

Regarding the implementation language: if the one who undertakes this mission qualifies as an expert at writing robust, secure and elegant POSIX shell, and they want to do it this way, fine. Else, better go directly for (Modern) Perl or Python. Ruby lovers can certainly pick their language of choice too, but they’d better be careful about compatibility with future Ruby versions… we spend too much time already updating our existing Ruby code to 1.9.

Sources of inspiration:

Feature Branch: feature/8617-delete-obsolete-Git-branches

Parent Task: #8617 (closed)

Related issues

Original created by @intrigeri on 7221 (Redmine)

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information