git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Santiago Torres <santiago@nyu.edu>
To: Nathan Neulinger <nneul@neulinger.org>
Cc: git@vger.kernel.org
Subject: Re: git status always modifies index?
Date: Wed, 22 Nov 2017 11:10:16 -0500	[thread overview]
Message-ID: <20171122161014.djkdygmclk227xmq@LykOS.localdomain> (raw)
In-Reply-To: <5050d779-2981-6f06-49f7-0ecb4efb25b8@neulinger.org>

[-- Attachment #1: Type: text/plain, Size: 1380 bytes --]

On Wed, Nov 22, 2017 at 09:37:09AM -0600, Nathan Neulinger wrote:
> What I'm meaning is - why does it need to write the index back out to disk?
> 
> From looking at the code in builtin/commit.c it looks like it takes a lock
> on the index, collects the status, and then unconditionally rewrites the
> index file.
>
Hmm, I just took a look at those lines and I see what you mean. From
what I understand, this is to cache the result of the index computation
for ensuing git calls.

> I'm proposing that the update_index_if_able call not actually be issued if
> it would result in a ownership change on the underlying file - such as a
> simple case of root user or other privileged account issuing 'git status' in
> a directory.

I don't think this would be a desire-able default behavior. I'd wager
that running git status using different accounts is not a great idea ---
specially interacting with a user repository as root.

> I understand completely that it would be expected to be altered if the
> privileged user did a commit/add or any other operation that was inherently
> a 'write' operation, but doesn't seem like status should be one of those
> cases.

I think it's because of the reasons above. That being said, I don't know
what the rest of the community would think of something akin to a
--no-update-index type flag.

Cheers!
-Santiago.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2017-11-22 16:08 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-22 15:19 git status always modifies index? Nathan Neulinger
2017-11-22 15:30 ` Santiago Torres
2017-11-22 15:37   ` Nathan Neulinger
2017-11-22 16:10     ` Santiago Torres [this message]
2017-11-22 16:20       ` Nathan Neulinger
2017-11-22 16:24         ` Santiago Torres
2017-11-22 20:27         ` Jonathan Nieder
2017-11-22 21:17           ` Jeff King
2017-11-22 21:56             ` Jonathan Nieder
2017-11-22 22:06               ` Jeff King
2017-11-25 21:55                 ` Johannes Schindelin
2017-11-26 19:25                   ` Jeff King
2017-11-26 21:55                     ` Johannes Schindelin
2017-11-27  5:24                       ` Jeff King
2017-11-27  6:03                         ` Junio C Hamano
2017-11-27 20:50                           ` Johannes Schindelin
2017-11-27  6:04                         ` [PATCH] git-status.txt: mention --no-optional-locks Jeff King
2017-11-27  6:07                           ` Junio C Hamano
2017-11-27 10:22                             ` Kaartic Sivaraam
2017-11-27 20:54                               ` Johannes Schindelin
2017-11-27 20:44                         ` git status always modifies index? Johannes Schindelin
2017-11-27 20:49                           ` Jonathan Nieder
2017-11-26  3:32                 ` Junio C Hamano
2017-11-26  9:35                   ` Junio C Hamano
2017-11-27  4:43                     ` Jeff King
2017-11-27  4:56                       ` Junio C Hamano
2017-11-27  5:00                         ` Jeff King
2017-11-27 20:57                       ` Jonathan Nieder
2017-11-27 22:50                         ` Jeff King
2017-12-03  0:37                         ` Junio C Hamano
2017-11-26 19:27                   ` Jeff King
2017-11-27  0:47                     ` Junio C Hamano
2017-11-27  6:12                       ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171122161014.djkdygmclk227xmq@LykOS.localdomain \
    --to=santiago@nyu.edu \
    --cc=git@vger.kernel.org \
    --cc=nneul@neulinger.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).