From: Junio C Hamano Date: Sun, 24 Sep 2006 20:46:09 GMT Subject: Re: [PATCH] Remove empty ref directories that prevent creating a ref. Message-ID: <7vy7s96lim.fsf@assigned-by-dhcp.cox.net> In-Reply-To: <20060924223317.caf467a3.chriscool@tuxfamily.org> Christian Couder writes: > +if [ -d "$GIT_DIR/refs/heads/$branchname" ] > +then > + for refdir in `find "$GIT_DIR/refs/heads/$branchname" -type d | sort -r` > + do > + rmdir "$refdir" || \ > + die "Could not delete '$refdir', " \ > + "there may still be a ref there." > + done > +fi I do not think this loop is safe when $GIT_DIR contains any $IFS character.