Commit Diff


commit - c789dbac2f1f72c0eff66e7965cc55fc36113b39
commit + 0fd469ce93e6b6c5b88d97c22a7ed2a07b60451f
blob - 3d68a01374b6f19b2d40248fa60d15e894896183
blob + fead5a1bd80046b666ec3030d7dcc224043989f4
--- lib/reference.c
+++ lib/reference.c
@@ -18,6 +18,7 @@
 #include <sys/queue.h>
 #include <sys/stat.h>
 
+#include <errno.h>
 #include <ctype.h>
 #include <dirent.h>
 #include <sha1.h>
@@ -755,7 +756,7 @@ got_ref_write(struct got_reference *ref, struct got_re
 
 	/* XXX: check if old content matches our expectations? */
 
-	if (stat(path, &sb) != 0) {
+	if (stat(path, &sb) != 0 && errno != ENOENT) {
 		err = got_error_from_errno();
 		goto done;
 	}