Tweak to make it clearer what to do if your working space is dirty
authorYves Orton <demerphq@gmail.com>
Mon, 16 Apr 2012 18:23:32 +0000 (20:23 +0200)
committerNicholas Clark <nick@ccl4.org>
Tue, 28 May 2013 07:19:28 +0000 (09:19 +0200)
If you try to biect in a directory with .gitignore'd files in it
bisect will refuse to run. Since these files arent shown by status
this can cause some head scratching.

This patch makes it more obvious what is wrong by showing the listed
files and suggesting git clean as a solution. I deliberately did not
document the command to clean up untracked files, so people wouldn't
knee jerk paste it somewhere and lose something important. And by people
I mean me. :-) Thus it just shows the command to wipe ignored files,
which I figure is safe.

Porting/bisect.pl

index c52c740..f5c401b 100755 (executable)
@@ -82,9 +82,13 @@ foreach ($start, $end) {
     chomp;
 }
 
-my $modified = () = `git ls-files --modified --deleted --others`;
+my $modified = my @modified = `git ls-files --modified --deleted --others`;
 
-die "This checkout is not clean - $modified modified or untracked file(s)"
+die "This checkout is not clean, found file(s):\n",
+    join("\t","",@modified),
+    "$modified modified, untracked, or other file(s)\n",
+    "These files may not show in git status as they may be ignored.\n",
+    "You can use 'git clean -Xdf' to cleanup the ignored files.\n"
     if $modified;
 
 sub validate {