refs.c: add a function to append a reflog entry to a fd