How does "receive.denyCurrentBranch = updateInstead" interact with the index?

The receive.denyCurrentBranch parameter determines what happens if you click on the repo branch, which is a check.

By default, it rejects it (which is why you usually only click on bare repositories that don't have validation branches).

It can be disabled using ignore or warn .

Another option is updateInstead .

What this means is that if HEAD and the working directory are the same, and the nested branch is HEAD , both the working directory and the / HEAD branch are updated at the same time.

If the working directory is different from HEAD , pressing is rejected.
This is useful, for example, for clicking on web servers.

My question is, does this option interact with Index ?

Is the index updated? What if HEAD and working directory are the same but not Index ?

+5
source share
1 answer

Is the index updated? What if HEAD and working directory are the same but not Index?

Commit 0855331 (git 2.4.0-rc0, December 2014) clearly states:

If the receive.denyCurrentBranch parameter receive.denyCurrentBranch set to updateInstead , click tries to update the branch that is currently checked, is accepted only when the index and working tree exactly match the checked commit, in which case the index and working tree are updated according to the pressed commit .
Otherwise, the click will be rejected.

Although the same commit introduced a push-to-checkout hook.

This hook can be used to configure this push-to-deploy logic.
The hook receives a commit, with which the tip of the current branch will be updated, and can decide which local changes are acceptable, and how to update the index and working tree in accordance with the updated end of the current branch .

This gives a bit of flexibility regarding the index.


Commit 1a51b52, git 2.4.0-rc2, April 2015 says again:

Setting receive.denyCurrentBranch to updateInstead and pressing the current branch when the working tree and index are really clean should reset the working tree and index to match the pressed commit tree .

+5
source

Source: https://habr.com/ru/post/1240246/


All Articles