<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/read-cache.c, branch v2.12.3</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://www.git.shady.money/git/atom?h=v2.12.3</id>
<link rel='self' href='https://www.git.shady.money/git/atom?h=v2.12.3'/>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/'/>
<updated>2017-01-31T21:14:59Z</updated>
<entry>
<title>Merge branch 'sb/in-core-index-doc'</title>
<updated>2017-01-31T21:14:59Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-01-31T21:14:59Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=feaad0eec78b8f23e2cf0566c5ddcd0a459ab325'/>
<id>urn:sha1:feaad0eec78b8f23e2cf0566c5ddcd0a459ab325</id>
<content type='text'>
Documentation and in-code comments updates.

* sb/in-core-index-doc:
  documentation: retire unfinished documentation
  cache.h: document add_[file_]to_index
  cache.h: document remove_index_entry_at
  cache.h: document index_name_pos
</content>
</entry>
<entry>
<title>cache.h: document remove_index_entry_at</title>
<updated>2017-01-19T20:17:57Z</updated>
<author>
<name>Stefan Beller</name>
<email>sbeller@google.com</email>
</author>
<published>2017-01-19T03:18:52Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=3bd72adff1f4435898508f5c74227aaa2561c182'/>
<id>urn:sha1:3bd72adff1f4435898508f5c74227aaa2561c182</id>
<content type='text'>
Do this by moving the existing documentation from
read-cache.c to cache.h.

Signed-off-by: Stefan Beller &lt;sbeller@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>index: improve constness for reading blob data</title>
<updated>2017-01-11T21:35:13Z</updated>
<author>
<name>Brandon Williams</name>
<email>bmwill@google.com</email>
</author>
<published>2017-01-10T20:06:10Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=875425080df13933baf484b35988d3a2dc04629e'/>
<id>urn:sha1:875425080df13933baf484b35988d3a2dc04629e</id>
<content type='text'>
Improve constness of the index_state parameter to the
'read_blob_data_from_index' function.

Signed-off-by: Brandon Williams &lt;bmwill@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jc/git-open-cloexec'</title>
<updated>2017-01-10T23:24:26Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-01-10T23:24:26Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=02d0457eb4b9bf656965c5dbb613b8bfaef3316f'/>
<id>urn:sha1:02d0457eb4b9bf656965c5dbb613b8bfaef3316f</id>
<content type='text'>
The codeflow of setting NOATIME and CLOEXEC on file descriptors Git
opens has been simplified.
We may want to drop the tip one, but we'll see.

* jc/git-open-cloexec:
  sha1_file: stop opening files with O_NOATIME
  git_open_cloexec(): use fcntl(2) w/ FD_CLOEXEC fallback
  git_open(): untangle possible NOATIME and CLOEXEC interactions
</content>
</entry>
<entry>
<title>hold_locked_index(): align error handling with hold_lockfile_for_update()</title>
<updated>2016-12-07T19:31:59Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-12-07T18:33:54Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=b3e83cc752e905e063d0930c682a06de5034074f'/>
<id>urn:sha1:b3e83cc752e905e063d0930c682a06de5034074f</id>
<content type='text'>
Callers of the hold_locked_index() function pass 0 when they want to
prepare to write a new version of the index file without wishing to
die or emit an error message when the request fails (e.g. somebody
else already held the lock), and pass 1 when they want the call to
die upon failure.

This option is called LOCK_DIE_ON_ERROR by the underlying lockfile
API, and the hold_locked_index() function translates the paramter to
LOCK_DIE_ON_ERROR when calling the hold_lock_file_for_update().

Replace these hardcoded '1' with LOCK_DIE_ON_ERROR and stop
translating.  Callers other than the ones that are replaced with
this change pass '0' to the function; no behaviour change is
intended with this patch.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
---

Among the callers of hold_locked_index() that passes 0:

 - diff.c::refresh_index_quietly() at the end of "git diff" is an
   opportunistic update; it leaks the lockfile structure but it is
   just before the program exits and nobody should care.

 - builtin/describe.c::cmd_describe(),
   builtin/commit.c::cmd_status(),
   sequencer.c::read_and_refresh_cache() are all opportunistic
   updates and they are OK.

 - builtin/update-index.c::cmd_update_index() takes a lock upfront
   but we may end up not needing to update the index (i.e. the
   entries may be fully up-to-date), in which case we do not need to
   issue an error upon failure to acquire the lock.  We do diagnose
   and die if we indeed need to update, so it is OK.

 - wt-status.c::require_clean_work_tree() IS BUGGY.  It asks
   silence, does not check the returned value.  Compare with
   callsites like cmd_describe() and cmd_status() to notice that it
   is wrong to call update_index_if_able() unconditionally.
</content>
</entry>
<entry>
<title>git_open(): untangle possible NOATIME and CLOEXEC interactions</title>
<updated>2016-10-28T13:23:07Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-10-28T13:23:07Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=1b8ac5ead520146802debd52cb38e5c27b3483a2'/>
<id>urn:sha1:1b8ac5ead520146802debd52cb38e5c27b3483a2</id>
<content type='text'>
The way we structured the fallback/retry mechanism for opening with
O_NOATIME and O_CLOEXEC meant that if we failed due to lack of
support to open the file with O_NOATIME option (i.e. EINVAL), we
would still try to drop O_CLOEXEC first and retry, and then drop
O_NOATIME.  A platform on which O_NOATIME is defined in the header
without support from the kernel wouldn't have a chance to open with
O_CLOEXEC option due to this code structure.

Arguably, O_CLOEXEC is more important than O_NOATIME, as the latter
is mostly about performance, while the former can affect correctness.

Instead use O_CLOEXEC to open the file, and then use fcntl(2) to set
O_NOATIME on the resulting file descriptor.  open(2) itself does not
cause atime to be updated according to Linus [*1*].

The helper to do the former can be usable in the codepath in
ce_compare_data() that was recently added to open a file descriptor
with O_CLOEXEC; use it while we are at it.

*1* &lt;CA+55aFw83E+zOd+z5h-CA-3NhrLjVr-anL6pubrSWttYx3zu8g@mail.gmail.com&gt;

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>read-cache: make sure file handles are not inherited by child processes</title>
<updated>2016-10-25T18:10:18Z</updated>
<author>
<name>Lars Schneider</name>
<email>larsxschneider@gmail.com</email>
</author>
<published>2016-10-24T18:03:00Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=a0a6cb96625cebe8590841c469bfbb461a132ae3'/>
<id>urn:sha1:a0a6cb96625cebe8590841c469bfbb461a132ae3</id>
<content type='text'>
This fixes "convert: add filter.&lt;driver&gt;.process option" (edcc8581) on
Windows.

Consider the case of a file that requires filtering and is present in
branch A but not in branch B. If A is the current HEAD and we checkout B
then the following happens:

1. ce_compare_data() opens the file
2.   index_fd() detects that the file requires to run a clean filter and
     calls index_stream_convert_blob()
4.     index_stream_convert_blob() calls convert_to_git_filter_fd()
5.       convert_to_git_filter_fd() calls apply_filter() which creates a
         new long running filter process (in case it is the first file
         of this kind to be filtered)
6.       The new filter process inherits all file handles. This is the
         default on Linux/OSX and is explicitly defined in the
         `CreateProcessW` call in `mingw.c` on Windows.
7. ce_compare_data() closes the file
8. Git unlinks the file as it is not present in B

The unlink operation does not work on Windows because the filter process
has still an open handle to the file. On Linux/OSX the unlink operation
succeeds but the file descriptors still leak into the child process.

Fix this problem by opening files in read-cache with the O_CLOEXEC flag
to ensure that the file descriptor does not remain open in a newly
spawned process similar to 05d1ed6148 ("mingw: ensure temporary file
handles are not inherited by child processes", 2016-08-22).

Signed-off-by: Lars Schneider &lt;larsxschneider@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'tg/add-chmod+x-fix'</title>
<updated>2016-09-26T23:09:20Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-09-26T23:09:20Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=ebc63580a1287325eef85e96c436de494406fd0a'/>
<id>urn:sha1:ebc63580a1287325eef85e96c436de494406fd0a</id>
<content type='text'>
"git add --chmod=+x &lt;pathspec&gt;" added recently only toggled the
executable bit for paths that are either new or modified. This has
been corrected to flip the executable bit for all paths that match
the given pathspec.

* tg/add-chmod+x-fix:
  t3700-add: do not check working tree file mode without POSIXPERM
  t3700-add: create subdirectory gently
  add: modify already added files when --chmod is given
  read-cache: introduce chmod_index_entry
  update-index: add test for chmod flags
</content>
</entry>
<entry>
<title>add: modify already added files when --chmod is given</title>
<updated>2016-09-15T19:13:54Z</updated>
<author>
<name>Thomas Gummerer</name>
<email>t.gummerer@gmail.com</email>
</author>
<published>2016-09-14T21:07:47Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=610d55af0f082f6b866dc858e144c03d8ed4424c'/>
<id>urn:sha1:610d55af0f082f6b866dc858e144c03d8ed4424c</id>
<content type='text'>
When the chmod option was added to git add, it was hooked up to the diff
machinery, meaning that it only works when the version in the index
differs from the version on disk.

As the option was supposed to mirror the chmod option in update-index,
which always changes the mode in the index, regardless of the status of
the file, make sure the option behaves the same way in git add.

Signed-off-by: Thomas Gummerer &lt;t.gummerer@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>read-cache: introduce chmod_index_entry</title>
<updated>2016-09-15T19:13:54Z</updated>
<author>
<name>Thomas Gummerer</name>
<email>t.gummerer@gmail.com</email>
</author>
<published>2016-09-14T21:07:46Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=d9d7096662122f6b82ad6e4c08397b75906da78d'/>
<id>urn:sha1:d9d7096662122f6b82ad6e4c08397b75906da78d</id>
<content type='text'>
As there are chmod options for both add and update-index, introduce a
new chmod_index_entry function to do the work.  Use it in update-index,
while it will be used in add in the next patch.

Signed-off-by: Thomas Gummerer &lt;t.gummerer@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
