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 <[email protected]>
  • Loading branch information
dscho authored and Git for Windows Build Agent committed Jul 23, 2019
1 parent ad84b3e commit 6a27765
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 @@ -194,7 +194,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 6a27765

Please sign in to comment.