Patch Set 2:

When I see your new commit message I come to the idea: is there a use-case for an extra parameter telling "ignore the working-dir" ... or is it always like that we use the incore on bare repos and the non-incore on non-bare?
Then we could even get rid of the "incore" parameter and use "isbare()" instead.