git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: Nathan Neulinger <nneul@neulinger.org>,
	Santiago Torres <santiago@nyu.edu>,
	git@vger.kernel.org,
	Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: Re: git status always modifies index?
Date: Wed, 22 Nov 2017 16:17:29 -0500	[thread overview]
Message-ID: <20171122211729.GA2854@sigill> (raw)
In-Reply-To: <20171122202720.GD11671@aiede.mtv.corp.google.com>

On Wed, Nov 22, 2017 at 12:27:20PM -0800, Jonathan Nieder wrote:

> Nathan Neulinger wrote[1]:
> 
> > I just got an answer to my stackoverflow question on this,
> > apparently it's already implemented:
> >
> > https://stackoverflow.com/questions/47436939/how-to-run-git-status-without-modifying-git-index-such-as-in-a-prompt-command
> >
> > There is a "--no-optional-locks" command in 2.15 that looks like it
> > does exactly what I need.
> 
> I was about to point to
> https://public-inbox.org/git/20170921043214.pyhdsrpy4omy54rm@sigill.intra.peff.net/
> about exactly this thing. :)
> 
> That said, I wonder if this use case is an illustration that a name
> like --no-lock-index (as was used in Git for Windows when this feature
> first appeared) or --no-refresh-on-disk-index (sorry, I am terrible at
> coming up with option names) would make the feature easier to
> discover.

Yeah, it's interesting that Nathan does not care about the simultaneous
locking here, but rather about the effect of writing to the repo for
what would otherwise be a read-only operation.

Under the original intent of --no-optional-locks I think if we could
somehow magically update the on-disk index without lock contention, it
would be OK to do so. But that would make it no longer work for this
particular case.

And I would also not be surprised if there are other cases where we
write in a lockless way that would best be avoided in a multi-user
setup. I'm thinking specifically of the way that some merge-y operations
may write out intermediate objects, even though they're only needed
inside the process. It _should_ be a read-only operation to ask "can
these two things be merged cleanly", and you should be able to ask that
without accidentally creating root-owned files in .git/objects.

So I actually think what Nathan wants is not exactly the same as
--no-optional-locks in the first place. But in practice, for a limited
set of operations and with the way that locks work in Git, it
accomplishes the same thing. Maybe that points to having a broader
option. Or maybe having two separate options that largely have the same
effect. Or maybe just living with the minor philosophical rough edges,
since it seems OK in practice.

-Peff

  reply	other threads:[~2017-11-22 21:17 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
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 [this message]
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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=20171122211729.GA2854@sigill \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=johannes.schindelin@gmx.de \
    --cc=jrnieder@gmail.com \
    --cc=nneul@neulinger.org \
    --cc=santiago@nyu.edu \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).