Thread (20 messages) flat view 20 messages, 7 authors, 2017-09-28

Re: [PATCH] git: add --no-optional-locks option

From: Kaartic Sivaraam <hidden>
Date: 2017-09-24 11:31:26

On Thursday 21 September 2017 10:02 AM, Jeff King wrote:
Some tools like IDEs or fancy editors may periodically run
commands like "git status" in the background to keep track
of the state of the repository.
I might be missing something, shouldn't the IDEs be encouraged to use
libgit2 instead? I thought it was meant for these use cases.

Note: I assume getting the status through libgit2 doesn't create an 
index.lock file.
   3. Ask "status" not to lock or write the index.

      This is easy to implement. The big downside is that any
      work done in refreshing the index for such a call is
      lost when the process exits. So a background process
      may end up re-hashing a changed file multiple times
      until the user runs a command that does an index
      refresh themselves.

This patch implements the option 3.
So, if I get that correctly "git status --no-optional-locks" is a way
to get the "current" status without updating the on disk index file?
+`GIT_OPTIONAL_LOCKS`::
+	If set to `0`, Git will avoid performing any operations which
+	require taking a lock and which are not required to complete the
+	requested operation.
The above sentence seems to be a little hard to interpret. How about,

    If set to `0`, Git will complete the requested operation without
    performing the optional sub-operations that require taking a lock.


---
Kaartic
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help