<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/read-cache.c, branch v2.2.0</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.2.0</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.2.0'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2014-10-01T20:56:14Z</updated>
<entry>
<title>lockfile.h: extract new header file for the functions in lockfile.c</title>
<updated>2014-10-01T20:56:14Z</updated>
<author>
<name>Michael Haggerty</name>
<email>mhagger@alum.mit.edu</email>
</author>
<published>2014-10-01T10:28:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=697cc8efd944a32ca472337cd6640004c474b788'/>
<id>urn:sha1:697cc8efd944a32ca472337cd6640004c474b788</id>
<content type='text'>
Move the interface declaration for the functions in lockfile.c from
cache.h to a new file, lockfile.h. Add #includes where necessary (and
remove some redundant includes of cache.h by files that already
include builtin.h).

Move the documentation of the lock_file state diagram from lockfile.c
to the new header file.

Signed-off-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>hold_locked_index(): move from lockfile.c to read-cache.c</title>
<updated>2014-10-01T20:54:31Z</updated>
<author>
<name>Michael Haggerty</name>
<email>mhagger@alum.mit.edu</email>
</author>
<published>2014-10-01T10:28:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=216aab1e3d8eef088dc9785febce24a110e9f835'/>
<id>urn:sha1:216aab1e3d8eef088dc9785febce24a110e9f835</id>
<content type='text'>
lockfile.c contains the general API for locking any file. Code
specifically about the index file doesn't belong here.

Signed-off-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>commit_lock_file_to(): refactor a helper out of commit_lock_file()</title>
<updated>2014-10-01T20:52:06Z</updated>
<author>
<name>Michael Haggerty</name>
<email>mhagger@alum.mit.edu</email>
</author>
<published>2014-10-01T10:28:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=751bacedaa507b7b6d10b2c1f48e019a01a8fa6e'/>
<id>urn:sha1:751bacedaa507b7b6d10b2c1f48e019a01a8fa6e</id>
<content type='text'>
commit_locked_index(), when writing to an alternate index file,
duplicates (poorly) the code in commit_lock_file(). And anyway, it
shouldn't have to know so much about the internal workings of lockfile
objects. So extract a new function commit_lock_file_to() that does the
work common to the two functions, and call it from both
commit_lock_file() and commit_locked_index().

Signed-off-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>lockfile: change lock_file::filename into a strbuf</title>
<updated>2014-10-01T20:50:01Z</updated>
<author>
<name>Michael Haggerty</name>
<email>mhagger@alum.mit.edu</email>
</author>
<published>2014-10-01T10:28:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=cf6950d3bfe1447ac04867b1f5654a2fc9c5db96'/>
<id>urn:sha1:cf6950d3bfe1447ac04867b1f5654a2fc9c5db96</id>
<content type='text'>
For now, we still make sure to allocate at least PATH_MAX characters
for the strbuf because resolve_symlink() doesn't know how to expand
the space for its return value.  (That will be fixed in a moment.)

Another alternative would be to just use a strbuf as scratch space in
lock_file() but then store a pointer to the naked string in struct
lock_file.  But lock_file objects are often reused.  By reusing the
same strbuf, we can avoid having to reallocate the string most times
when a lock_file object is reused.

Helped-by: Torsten Bögershausen &lt;tboegi@web.de&gt;
Signed-off-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>lockfile: avoid transitory invalid states</title>
<updated>2014-10-01T20:48:59Z</updated>
<author>
<name>Michael Haggerty</name>
<email>mhagger@alum.mit.edu</email>
</author>
<published>2014-10-01T10:28:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=707103fdfd0c03511fa547d9b80638d8160f1a88'/>
<id>urn:sha1:707103fdfd0c03511fa547d9b80638d8160f1a88</id>
<content type='text'>
Because remove_lock_file() can be called any time by the signal
handler, it is important that any lock_file objects that are in the
lock_file_list are always in a valid state.  And since lock_file
objects are often reused (but are never removed from lock_file_list),
that means we have to be careful whenever mutating a lock_file object
to always keep it in a well-defined state.

This was formerly not the case, because part of the state was encoded
by setting lk-&gt;filename to the empty string vs. a valid filename.  It
is wrong to assume that this string can be updated atomically; for
example, even

    strcpy(lk-&gt;filename, value)

is unsafe.  But the old code was even more reckless; for example,

    strcpy(lk-&gt;filename, path);
    if (!(flags &amp; LOCK_NODEREF))
            resolve_symlink(lk-&gt;filename, max_path_len);
    strcat(lk-&gt;filename, ".lock");

During the call to resolve_symlink(), lk-&gt;filename contained the name
of the file that was being locked, not the name of the lockfile.  If a
signal were raised during that interval, then the signal handler would
have deleted the valuable file!

We could probably continue to use the filename field to encode the
state by being careful to write characters 1..N-1 of the filename
first, and then overwrite the NUL at filename[0] with the first
character of the filename, but that would be awkward and error-prone.

So, instead of using the filename field to determine whether the
lock_file object is active, add a new field "lock_file::active" for
this purpose.  Be careful to set this field only when filename really
contains the name of a file that should be deleted on cleanup.

Helped-by: Johannes Sixt &lt;j6t@kdbg.org&gt;
Signed-off-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>close_lock_file(): exit (successfully) if file is already closed</title>
<updated>2014-10-01T20:38:39Z</updated>
<author>
<name>Michael Haggerty</name>
<email>mhagger@alum.mit.edu</email>
</author>
<published>2014-10-01T10:28:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=419f0c0f681b76d720699977abe03d29e22db554'/>
<id>urn:sha1:419f0c0f681b76d720699977abe03d29e22db554</id>
<content type='text'>
Suggested-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
Signed-off-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jp/index-with-corrupt-stages'</title>
<updated>2014-09-19T18:38:34Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-09-19T18:38:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=04631848c4bd66bf802983482b7b99021da85c9f'/>
<id>urn:sha1:04631848c4bd66bf802983482b7b99021da85c9f</id>
<content type='text'>
A broken reimplementation of Git could write an invalid index that
records both stage #0 and higher stage entries for the same path.
Notice and reject such an index, as there is no sensible fallback
(we do not know if the broken tool wanted to resolve and forgot to
remove higher stage entries, or if it wanted to unresolve and
forgot to remove the stage#0 entry).

* jp/index-with-corrupt-stages:
  read_index_unmerged(): remove unnecessary loop index adjustment
  read_index_from(): catch out of order entries when reading an index file
</content>
</entry>
<entry>
<title>Merge branch 'ta/config-set-2'</title>
<updated>2014-09-11T17:33:26Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-09-11T17:33:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=554913daf43f744f7d6bd8bd2cd008d96d19cbd9'/>
<id>urn:sha1:554913daf43f744f7d6bd8bd2cd008d96d19cbd9</id>
<content type='text'>
Update git_config() users with callback functions for a very narrow
scope with calls to config-set API that lets us query a single
variable.

* ta/config-set-2:
  builtin/apply.c: replace `git_config()` with `git_config_get_string_const()`
  merge-recursive.c: replace `git_config()` with `git_config_get_int()`
  ll-merge.c: refactor `read_merge_config()` to use `git_config_string()`
  fast-import.c: replace `git_config()` with `git_config_get_*()` family
  branch.c: replace `git_config()` with `git_config_get_string()
  alias.c: replace `git_config()` with `git_config_get_string()`
  imap-send.c: replace `git_config()` with `git_config_get_*()` family
  pager.c: replace `git_config()` with `git_config_get_value()`
  builtin/gc.c: replace `git_config()` with `git_config_get_*()` family
  rerere.c: replace `git_config()` with `git_config_get_*()` family
  fetchpack.c: replace `git_config()` with `git_config_get_*()` family
  archive.c: replace `git_config()` with `git_config_get_bool()` family
  read-cache.c: replace `git_config()` with `git_config_get_*()` family
  http-backend.c: replace `git_config()` with `git_config_get_bool()` family
  daemon.c: replace `git_config()` with `git_config_get_bool()` family
</content>
</entry>
<entry>
<title>Merge branch 'rs/refresh-beyond-symlink'</title>
<updated>2014-09-09T19:54:01Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-09-09T19:54:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a75e759e595bf79d69841e6822784164da54ac23'/>
<id>urn:sha1:a75e759e595bf79d69841e6822784164da54ac23</id>
<content type='text'>
"git add x" where x that used to be a directory has become a
symbolic link to a directory misbehaved.

* rs/refresh-beyond-symlink:
  read-cache: check for leading symlinks when refreshing index
</content>
</entry>
<entry>
<title>read_index_unmerged(): remove unnecessary loop index adjustment</title>
<updated>2014-08-29T17:05:53Z</updated>
<author>
<name>Jaime Soriano Pastor</name>
<email>jsorianopastor@gmail.com</email>
</author>
<published>2014-08-27T19:48:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0344d93ced82a5e492d0e2a555047346445d2495'/>
<id>urn:sha1:0344d93ced82a5e492d0e2a555047346445d2495</id>
<content type='text'>
Signed-off-by: Jaime Soriano Pastor &lt;jsorianopastor@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
