@matheusbsbs / matheus-bagliano / commits / d9e74d5745
Fork 0

Solaris 5.8 returns ENOTDIR for inappropriate renames.

The reflog code clears empty directories when rename returns either EISDIR or ENOTDIR. Seems to be the only place. Signed-off-by: Jason Riedy <ejr@cs.berkeley.edu> Signed-off-by: Junio C Hamano <junkio@cox.net>

Jason Riedy committed Jan 15, 2007 at 17:30 UTC d9e74d5745127a5d483788c264fe0d4332868d67
1 file changed +6 -1
refs.c
+6 -1
@@ -837,7 +837,12 @@ int rename_ref(const char *oldref, const char *newref, const char *logmsg)
837
838 retry:
839 if (log && rename(git_path("tmp-renamed-log"), git_path("logs/%s", newref))) {
840 - if (errno==EISDIR) {
840 + if (errno==EISDIR || errno==ENOTDIR) {
841 + /*
842 + * rename(a, b) when b is an existing
843 + * directory ought to result in ISDIR, but
844 + * Solaris 5.8 gives ENOTDIR. Sheesh.
845 + */
846 if (remove_empty_directories(git_path("logs/%s", newref))) {
847 error("Directory not empty: logs/%s", newref);
848 goto rollback;