Skip to content

Commit

Permalink
remove_dirs: do not swallow error when stat() failed
Browse files Browse the repository at this point in the history
Without an error message when stat() failed, e.g. `git clean` would
abort without an error message, leaving the user quite puzzled.

This fixes #521

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
  • Loading branch information
dscho committed Feb 23, 2016
1 parent 6f28b96 commit ddc66dd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion builtin/clean.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ static int remove_dirs(struct strbuf *path, const char *prefix, int force_flag,
strbuf_setlen(path, len);
strbuf_addstr(path, e->d_name);
if (lstat(path->buf, &st))
; /* fall thru */
warning("Could not stat path '%s': %s",
path->buf, strerror(errno));
else if (S_ISDIR(st.st_mode)) {
if (remove_dirs(path, prefix, force_flag, dry_run, quiet, &gone))
ret = 1;
Expand Down

0 comments on commit ddc66dd

Please sign in to comment.