Re: [PATCH 2/2] Let deny.currentBranch=updateInstead ignore submodules
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Nov 13, 2014, 10:29 UTC
- Message-ID
- <alpine.DEB.1.00.1411131123330.13845@s15462909.onlinehome-server.info>
- In-Reply-To
- <xmqqzjbw47vr.fsf@gitster.dls.corp.google.com>
Hi Junio,
On Wed, 12 Nov 2014, Junio C Hamano wrote:
> Instead of running "update-index --refresh; read-tree -m -u", using > "reset --keep" may be a better implementation of what you are trying to > do here.
I do not think that `reset --keep` is what I want. I really want to update only if the working directory is clean. So I guess I will have to bite the bullet and test the output of `update-index --refresh`, `diff-index --quiet --cached HEAD --`.
In my case, the lacking test whether there are staged changes did not matter, just because I pretty much never leave staged changes around.
What did matter, however, was to make sure that I did not update the working directory carelessly. In one case, that `update-index --refresh` test really helped me out because I was about to push into a working directory with uncommitted changes inside some web space. That push would have broken the web application because of the local changes, so I was really, really happy that I decided to be quite strict in the implementation of `updateInstead`.
Due to that experience, the documentation also states pretty clearly that `updateInstead` succeeds only in updating the current branch if the working directory is clean.
Ciao, Johannes