From: Junio C Hamano Date: Tue, 26 Sep 2006 05:27:28 GMT Subject: Re: [PATCH] Remove empty ref directories that prevent creating a ref. Message-ID: <7vlko7rydb.fsf@assigned-by-dhcp.cox.net> In-Reply-To: <20060926072337.39dbb9f4.chriscool@tuxfamily.org> Christian Couder writes: > +LF=' > +' > + > +if [ -d "$GIT_DIR/refs/heads/$branchname" ] > +then > + OLD_IFS="$IFS" > + IFS="$LF" > + 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 > + IFS="$OLD_IFS" > +fi I was sort of expecting that you would do something like: for refdir in `cd "$GIT_DIR" && find "refs/heads/$branchname" -type d | sort -r` do rmdir "$GIT_DIR/$refdir" ... wihtout mucking with IFS ;-).