<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/refs, branch v2.22.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.22.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.22.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2019-04-16T10:28:11Z</updated>
<entry>
<title>Merge branch 'jk/refs-double-abort'</title>
<updated>2019-04-16T10:28:11Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-04-16T10:28:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2e08c892a7037ce2c7dfe30134eb54a2825bf0be'/>
<id>urn:sha1:2e08c892a7037ce2c7dfe30134eb54a2825bf0be</id>
<content type='text'>
A corner case bug in the refs API has been corrected.

* jk/refs-double-abort:
  refs/files-backend: don't look at an aborted transaction
  refs/files-backend: handle packed transaction prepare failure
</content>
</entry>
<entry>
<title>Merge branch 'nd/rewritten-ref-is-per-worktree'</title>
<updated>2019-04-09T17:14:23Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-04-09T17:14:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=917f2cd1c2396c694ae956a1a26d9c92bf50b847'/>
<id>urn:sha1:917f2cd1c2396c694ae956a1a26d9c92bf50b847</id>
<content type='text'>
"git rebase" uses the refs/rewritten/ hierarchy to store its
intermediate states, which inherently makes the hierarchy per
worktree, but it didn't quite work well.

* nd/rewritten-ref-is-per-worktree:
  Make sure refs/rewritten/ is per-worktree
  files-backend.c: reduce duplication in add_per_worktree_entries_to_dir()
  files-backend.c: factor out per-worktree code in loose_fill_ref_dir()
</content>
</entry>
<entry>
<title>refs/files-backend: don't look at an aborted transaction</title>
<updated>2019-03-22T06:52:54Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2019-03-21T09:28:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d3322eb28b142a893fbc03142724bb54e95990a6'/>
<id>urn:sha1:d3322eb28b142a893fbc03142724bb54e95990a6</id>
<content type='text'>
When deleting refs, we hold packed-refs.lock and prepare a packed
transaction to drop the refs from the packed-refs file. If it turns out
that we don't need to rewrite the packed refs (e.g., because none of the
deletions were present in the file), then we abort the transaction.

If that abort succeeds, then the transaction struct will have been
freed, and we set our local pointer to NULL so we don't look at it
again.

However, if it fails, then the struct will _still_ have been freed
(because ref_transaction_abort() always frees). But we don't clean up
the pointer, and will jump to our cleanup code, which will try to abort
it again, causing a use-after-free.

It's actually impossible for this to trigger in practice, since
packed_transaction_abort() will never return anything but success. But
let's fix it anyway, since that's more than we should assume about the
packed-refs code (after all, we are already bothering to check for an
error result which cannot be triggered).

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>refs/files-backend: handle packed transaction prepare failure</title>
<updated>2019-03-22T06:52:49Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2019-03-21T09:28:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=249e8dc73ea54aa09d828cf83f5a5de6bf5702f9'/>
<id>urn:sha1:249e8dc73ea54aa09d828cf83f5a5de6bf5702f9</id>
<content type='text'>
In files_transaction_prepare(), if we have to delete some refs, we use a
subordinate packed_transaction to do so. It's rare for that
sub-transaction's prepare step to fail, since we hold the packed-refs
lock. But if it does, we trigger a BUG() due to these steps:

  - we've attached the packed transaction to the files transaction as
    backend_data-&gt;packed_transaction

  - when the prepare step fails, the packed transaction cleans itself
    up, putting itself into the CLOSED state

  - the error value from preparing the packed transaction lets us know
    in files_transaction_prepare() that we should also clean up and
    return an error. We call files_transaction_cleanup(), which tries to
    abort backend_data-&gt;packed_transaction. Since it's already CLOSED,
    that triggers an assertion in ref_transaction_abort().

We can fix that by disconnecting the packed transaction from the outer
files transaction, and then free-ing (not aborting!) it ourselves.

A few other options/alternatives I considered:

  - we could just make it a noop to abort a CLOSED transaction. But that
    seems less safe, since clearly this code expects (and enforces) a
    particular set of state transitions.

  - we could have files_transaction_cleanup() selectively call abort()
    vs free() based on the state of the on the packed transaction.
    That's basically a more restricted version of the above, but also
    potentially unsafe.

  - instead of disconnecting backend_data-&gt;packed_transaction on error,
    we could wait to install it until we successfully prepare. That
    might make the flow a little simpler, but it introduces a hassle.
    Earlier parts of files_transaction_prepare() that encounter an error
    will jump to the cleanup label, and expect that cleaning up the
    outer transaction will clean up the packed transaction, too. We'd
    have to adjust those sites to clean up the packed transaction.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Make sure refs/rewritten/ is per-worktree</title>
<updated>2019-03-08T02:57:47Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2019-03-07T12:29:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b9317d55a37f93c47d48f12a7b3e45a71434d0e7'/>
<id>urn:sha1:b9317d55a37f93c47d48f12a7b3e45a71434d0e7</id>
<content type='text'>
a9be29c981 (sequencer: make refs generated by the `label` command
worktree-local, 2018-04-25) adds refs/rewritten/ as per-worktree
reference space. Unfortunately (my bad) there are a couple places that
need update to make sure it's really per-worktree.

 - add_per_worktree_entries_to_dir() is updated to make sure ref listing
   look at per-worktree refs/rewritten/ instead of per-repo one [1]

 - common_list[] is updated so that git_path() returns the correct
   location. This includes "rev-parse --git-path".

This mess is created by me. I started trying to fix it with the
introduction of refs/worktree, where all refs will be per-worktree
without special treatments. Unfortunate refs/rewritten came before
refs/worktree so this is all we can do.

This also fixes logs/refs/worktree not being per-worktree.

[1] note that ref listing still works sometimes. For example, if you
    have .git/worktrees/foo/refs/rewritten/bar AND the directory
    .git/worktrees/refs/rewritten, refs/rewritten/bar will show up.
    add_per_worktree_entries_to_dir() is only needed when the directory
    .git/worktrees/refs/rewritten is missing.

Reported-by: Phillip Wood &lt;phillip.wood123@gmail.com&gt;
Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>files-backend.c: reduce duplication in add_per_worktree_entries_to_dir()</title>
<updated>2019-03-08T02:57:47Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2019-03-07T12:29:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=90d31ff5d470286a8480311384429ebee8bbc939'/>
<id>urn:sha1:90d31ff5d470286a8480311384429ebee8bbc939</id>
<content type='text'>
This function is duplicated to handle refs/bisect/ and refs/worktree/
and a third prefix is coming. Time to clean up.

This also fixes incorrect "refs/worktrees/" length in this code. The
correct length is 14 not 11. The test in the next patch will also cover
this.

Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>files-backend.c: factor out per-worktree code in loose_fill_ref_dir()</title>
<updated>2019-03-08T02:57:47Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2019-03-07T12:29:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=09e65645e3b092e4d93bb8513b14474c68df23d8'/>
<id>urn:sha1:09e65645e3b092e4d93bb8513b14474c68df23d8</id>
<content type='text'>
This is the first step for further cleaning up and extending this
function.

Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>files-backend: drop refs parameter from split_symref_update()</title>
<updated>2019-02-14T23:26:15Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2019-02-14T05:50:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=10dee40ed3f6f091be271b45191a40aa560f33bf'/>
<id>urn:sha1:10dee40ed3f6f091be271b45191a40aa560f33bf</id>
<content type='text'>
This parameter was added in fcc42ea0c9 (split_symref_update(): add a
files_ref_store argument, 2016-09-04) without comment, but never used.
The splitting is purely mechanical, and doesn't depend on the particular
ref-store. Let's drop this parameter in the name of simplicity.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'nd/per-worktree-ref-iteration'</title>
<updated>2018-11-26T14:13:43Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-11-26T14:13:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a1598010f775d82b5adf12c29d0f5bc9b41434c6'/>
<id>urn:sha1:a1598010f775d82b5adf12c29d0f5bc9b41434c6</id>
<content type='text'>
Build fix.

* nd/per-worktree-ref-iteration:
  files-backend.c: fix build error on Solaris
</content>
</entry>
<entry>
<title>files-backend.c: fix build error on Solaris</title>
<updated>2018-11-26T06:22:58Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2018-11-25T04:58:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=46c0eb58433c5bef578bdd8cf2f57631619e5b75'/>
<id>urn:sha1:46c0eb58433c5bef578bdd8cf2f57631619e5b75</id>
<content type='text'>
This function files_reflog_path returns void, which usually means
"return;" not returning "void value" from another function.

Reported-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
