Re: git add -i doesn't update permissions
Jeff King <peff@peff.net> writes:
> Now, if you are interested in adding the mode change of a file but _not_
> its content, I think that is a reasonable thing to ask for. And it's
> something that is not possible with "add -i" right now, I don't think.
It's worse than that. It _theoretically_ is possible that this limitation becomes problematic if you are in this situation:
1. Notice a problem in the gostak script that it should distim doshes but
it doesn't. 2. Start working to change the gostak script.
3. Notice that the gistak script itself needs the +x bit but it doesn't.
4. Being a very disciplined person, you want to make sequence of commits
that record each separate logical change as a separate commit. You
would want to record "Add executable bit to the gostak script" first,
and then work further on the contents of the script to make "Enhance
the gostak script to distim doshes" as two logically separate steps.
This is not something you can do with "git add" in general, although I do
not see how this can be an issue in real life.Two already available solutions are:
(1) git reset HEAD -- gostak ;# undo staged content changes
git update-index --chmod=+x gostak
git commit -m "Add executable bit to the gostak script"
edit gostak ;# work more
git add gostak
git commit -m "Enhance the gostak script to distim doshes" (2) git stash ;# undo changes
chmod +x gostak
git add gostak
git commit -m "Add executable bit to the gostak script"
git stash pop ;# take the wip changes back
edit gostak ;# work more
git add gostak
git commit -m "Enhance the gostak script to distim doshes"