git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: Jörg SommerNext: Jeff King
Message 2 of 5 in “git add -i doesn't update permissions”
  1. Jörg SommerMar 26, 2008
  2. Jeff KingMar 27, 2008
  3. Jeff KingMar 27, 2008
  4. Wincent ColaiutaMar 27, 2008
  5. Junio C HamanoMar 27, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.