Re: git add -i doesn't update permissions
- From
Jeff King <peff@peff.net>
- Date
- Mar 27, 2008, 05:57 UTC
- Message-ID
- <20080327055746.GA8469@coredump.intra.peff.net>
- In-Reply-To
- <20080326102332.GA26842@alea.gnuu.de>
On Wed, Mar 26, 2008 at 11:23:32AM +0100, Jörg Sommer wrote:
Show 5 quoted lines
> +test_expect_success 'update file permissions' ' > + git reset --hard && > + chmod +x file && > + printf "p\n1\n" | git add -i > +'
I'm not sure this is really a bug (but rather a feature request, which I will explain below). add--interactive has two modes for moving changes to files into the index:
1. 'u' will 'update' the file in the index, adding the new content and
any mode changes 2. 'p' will show you each patch hunk from the file, which can then
either be added or not.You are using 'p' and expecting it to work with the file mode, when it is purely about picking content hunks.
So I think the test _should_ be
printf "u\n1\n" | git add -i
in which case it works fine.
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. You seemed to expect that 'p' would present the mode change and say "do you want to stage this?" which I think is a reasonable interface. Though in that case "[p]atch" should perhaps be "[p]artial update".
-Peff