Skip to content

Commit

Permalink
Solaris 5.8 returns ENOTDIR for inappropriate renames.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jason Riedy authored and Junio C Hamano committed Jan 16, 2007
1 parent 2aad957 commit d9e74d5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion refs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d9e74d5

Please sign in to comment.