From d9e74d5745127a5d483788c264fe0d4332868d67 Mon Sep 17 00:00:00 2001 From: Jason Riedy Date: Mon, 15 Jan 2007 17:30:59 -0800 Subject: [PATCH] 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 Signed-off-by: Junio C Hamano --- refs.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/refs.c b/refs.c index 689ac50bae..7d858637c4 100644 --- a/refs.c +++ b/refs.c @@ -837,7 +837,12 @@ int rename_ref(const char *oldref, const char *newref, const char *logmsg) retry: if (log && rename(git_path("tmp-renamed-log"), git_path("logs/%s", newref))) { - if (errno==EISDIR) { + if (errno==EISDIR || errno==ENOTDIR) { + /* + * rename(a, b) when b is an existing + * directory ought to result in ISDIR, but + * Solaris 5.8 gives ENOTDIR. Sheesh. + */ if (remove_empty_directories(git_path("logs/%s", newref))) { error("Directory not empty: logs/%s", newref); goto rollback; -- GitLab