Deleting remote branches can result in `Argument list too long` error when many branches need deleting
Zendesk: https://gitlab.zendesk.com/agent/tickets/87826
In https://gitlab.com/gitlab-org/gitlab-ce/blob/0ea79ccfbae27b5734c75f02944aff4cd5a1fb43/lib/gitlab/git/gitlab_projects.rb#L152 (formerly in gitlab-shell
) we concatenate branch names to git push
to remove remote branches. In the customer's case the number of branches that need deleted resulted in overrunning the number of arguments allowed on the Linux command line (see image below for example of the error).
I'm not sure if the limit is static in Linux or based on some available memory. A solution I see suggested online is to pipe the list to the command so it is executed one by one. One by one may be a little egregious if there are a ton of branches to delete but maybe we could break it up into bunches of some arbitrary number (10, 25, 50?)
@rdavila @nick.thomas You've worked with this area of code at some point. What do you think?