Commits

Junio C Hamano  committed 0907fed

ls-files --others --directory: give trailing slash

This adds a trailing slash to directory names in the output
when "--others --directory" option shows only untracked
directories and not their contents, to make them stand out.

Signed-off-by: Junio C Hamano <junkio@cox.net>

  • Participants
  • Parent commits 657907e

Comments (0)

Files changed (1)

 				/* fallthrough */
 			case DT_DIR:
 				memcpy(fullname + baselen + len, "/", 2);
+				len++;
 				if (show_other_directories &&
-				    !dir_exists(fullname, baselen + len + 1))
+				    !dir_exists(fullname, baselen + len))
 					break;
 				read_directory(fullname, fullname,
-					       baselen + len + 1);
+					       baselen + len);
 				continue;
 			case DT_REG:
 			case DT_LNK: