Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> writes: > I.e. I was trying to avoid printing out the "error: pathspec 'master' > did not match any file(s) known to git." error altogether. That's still > arguably a good direction, since we *know* "master" would have otherwise > matched a remote branch, so that's probably a more informative message > than falling back to checking out pathspecs and failing, and complaining > about there being no such pathspec. That ideal behaviour makes sense. > But it was a pain to handle the various edge cases, e.g.: > > $ ./git --exec-path=$PWD checkout x y z > error: pathspec 'x' did not match any file(s) known to git. > error: pathspec 'y' did not match any file(s) known to git. > error: pathspec 'z' did not match any file(s) known to git. Let's take a detour to a tangent, as this example does not have anything to do with the remote-tracking auto-dwimming. Ideally what do we want to say in this case? What's allowed for 'x' (2 possibilities) is different from whats allowed for 'y' and 'z' (only 1 possibility)---do we want to complain that 'x' is not a rev noris a file (we do not say 'x' could be a misspelt rev name right now), and then 'y' and 'z' are not files (which is what we do now)? That might be an improvement. I dunno. In any case, that is a tangent that we do not have to address with these patches. In contrast, the command line without y and z gives three possibilities to 'x'. 'x' is not a rev, is not a remote-tracking branch name that only a single remote has, and is not a file. Now, if we are going to mention that we failed to interpret it as the latter two, perhaps we should also mention that it was not a rev (which could have been misspelt)? > So I decided just to let checkout_paths() to its thing and then print > out an error about dwim branches if applicable if it failed. Yeah, I think I get it now. If you want to silence the "error" from report_path_error() and replace it with something else, you would need to change checout_paths(), as this function is sort-of used as the last ditch effort after all else failed, and right now it is not aware of what exactly all these other failed efforts were. Thanks. I'm looking at v6 reroll for queuing.