theforeman/foreman — pull request #576 by eLobato (2013-05-03 14:34:12+00:00)
Title: Hostgroup add ancestors fix

Basically this pull request fixes the problem where:

an User is creating a new hostgroup
this user owns any of its ancestors
the Hostgroup creation will work, but shows an error "User is already in this Hostgroup", because indeed the User already owns that Hostgroup (that happens in line 61) and you are trying to add the User to this Hostgroup twice.