<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/refs.c, branch v2.18.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.18.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.18.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2018-05-30T12:51:28Z</updated>
<entry>
<title>Merge branch 'jk/snprintf-truncation'</title>
<updated>2018-05-30T12:51:28Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-05-30T12:51:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7c3d15fe3113cf48db60656eedd152c46f47bf6b'/>
<id>urn:sha1:7c3d15fe3113cf48db60656eedd152c46f47bf6b</id>
<content type='text'>
Avoid unchecked snprintf() to make future code auditing easier.

* jk/snprintf-truncation:
  fmt_with_err: add a comment that truncation is OK
  shorten_unambiguous_ref: use xsnprintf
  fsmonitor: use internal argv_array of struct child_process
  log_write_email_headers: use strbufs
  http: use strbufs instead of fixed buffers
</content>
</entry>
<entry>
<title>Merge branch 'ma/create-pseudoref-with-null-old-oid'</title>
<updated>2018-05-30T05:04:08Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-05-30T05:04:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=26597cb0cceb82b315c543f1cc02bbb72c537eaa'/>
<id>urn:sha1:26597cb0cceb82b315c543f1cc02bbb72c537eaa</id>
<content type='text'>
"git update-ref A B" is supposed to ensure that ref A does not yet
exist when B is a NULL OID, but this check was not done correctly
for pseudo-refs outside refs/ hierarchy, e.g. MERGE_HEAD.

* ma/create-pseudoref-with-null-old-oid:
  refs: handle zero oid for pseudorefs
  t1400: add tests around adding/deleting pseudorefs
  refs.c: refer to "object ID", not "sha1", in error messages
</content>
</entry>
<entry>
<title>Merge branch 'js/use-bug-macro'</title>
<updated>2018-05-30T05:04:07Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-05-30T05:04:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=50f08db5941755b69012378bfc86f6b8ee98edf4'/>
<id>urn:sha1:50f08db5941755b69012378bfc86f6b8ee98edf4</id>
<content type='text'>
Developer support update, by using BUG() macro instead of die() to
mark codepaths that should not happen more clearly.

* js/use-bug-macro:
  BUG_exit_code: fix sparse "symbol not declared" warning
  Convert remaining die*(BUG) messages
  Replace all die("BUG: ...") calls by BUG() ones
  run-command: use BUG() to report bugs, not die()
  test-tool: help verifying BUG() code paths
</content>
</entry>
<entry>
<title>Merge branch 'ma/lockfile-cleanup'</title>
<updated>2018-05-30T05:04:05Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-05-30T05:04:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2f76ebc93ca6bfc2aba1be330aabe391a7d093d2'/>
<id>urn:sha1:2f76ebc93ca6bfc2aba1be330aabe391a7d093d2</id>
<content type='text'>
Code clean-up to adjust to a more recent lockfile API convention that
allows lockfile instances kept on the stack.

* ma/lockfile-cleanup:
  lock_file: move static locks into functions
  lock_file: make function-local locks non-static
  refs.c: do not die if locking fails in `delete_pseudoref()`
  refs.c: do not die if locking fails in `write_pseudoref()`
  t/helper/test-write-cache: clean up lock-handling
</content>
</entry>
<entry>
<title>Merge branch 'js/rebase-recreate-merge'</title>
<updated>2018-05-23T05:38:20Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-05-23T05:38:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2c18e6ae2434a6caa5b3a7256608470948e73f66'/>
<id>urn:sha1:2c18e6ae2434a6caa5b3a7256608470948e73f66</id>
<content type='text'>
"git rebase" learned "--rebase-merges" to transplant the whole
topology of commit graph elsewhere.

* js/rebase-recreate-merge:
  rebase -i --rebase-merges: add a section to the man page
  rebase -i: introduce --rebase-merges=[no-]rebase-cousins
  pull: accept --rebase=merges to recreate the branch topology
  rebase --rebase-merges: avoid "empty merges"
  sequencer: handle post-rewrite for merge commands
  sequencer: make refs generated by the `label` command worktree-local
  rebase --rebase-merges: add test for --keep-empty
  rebase: introduce the --rebase-merges option
  rebase-helper --make-script: introduce a flag to rebase merges
  sequencer: fast-forward `merge` commands, if possible
  sequencer: introduce the `merge` command
  sequencer: introduce new commands to reset the revision
  git-rebase--interactive: clarify arguments
  sequencer: offer helpful advice when a command was rescheduled
  sequencer: refactor how original todo list lines are accessed
  sequencer: make rearrange_squash() a bit more obvious
  sequencer: avoid using errno clobbered by rollback_lock_file()
</content>
</entry>
<entry>
<title>Merge branch 'sb/oid-object-info'</title>
<updated>2018-05-23T05:38:16Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-05-23T05:38:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=fcb6df325468a7ae12949ab80dcd37772b9b1fbf'/>
<id>urn:sha1:fcb6df325468a7ae12949ab80dcd37772b9b1fbf</id>
<content type='text'>
The codepath around object-info API has been taught to take the
repository object (which in turn tells the API which object store
the objects are to be located).

* sb/oid-object-info:
  cache.h: allow oid_object_info to handle arbitrary repositories
  packfile: add repository argument to cache_or_unpack_entry
  packfile: add repository argument to unpack_entry
  packfile: add repository argument to read_object
  packfile: add repository argument to packed_object_info
  packfile: add repository argument to packed_to_object_type
  packfile: add repository argument to retry_bad_packed_offset
  cache.h: add repository argument to oid_object_info
  cache.h: add repository argument to oid_object_info_extended
</content>
</entry>
<entry>
<title>Merge branch 'sb/object-store-replace'</title>
<updated>2018-05-23T05:38:09Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-05-23T05:38:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a2cec42213c55dd3ff9febb51612e3f1cab37b12'/>
<id>urn:sha1:a2cec42213c55dd3ff9febb51612e3f1cab37b12</id>
<content type='text'>
Hotfix.

* sb/object-store-replace:
  get_main_ref_store: BUG() when outside a repository
  object.c: clear replace map before freeing it
  replace-object.c: remove the_repository from prepare_replace_object
  object.c: free replace map in raw_object_store_clear
</content>
</entry>
<entry>
<title>shorten_unambiguous_ref: use xsnprintf</title>
<updated>2018-05-21T00:59:03Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2018-05-19T01:58:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=bf4baf1fed7916ed10f2759a6f30a38990a83cae'/>
<id>urn:sha1:bf4baf1fed7916ed10f2759a6f30a38990a83cae</id>
<content type='text'>
We convert the ref_rev_parse_rules array into scanf formats
on the fly, and use snprintf() to write into each string. We
should have enough memory to hold everything because of the
earlier total_len computation. Let's use xsnprintf() to
give runtime confirmation that this is the case, and to make
it easy for people auditing the code to know there's no
truncation bug.

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>get_main_ref_store: BUG() when outside a repository</title>
<updated>2018-05-21T00:45:23Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2018-05-18T22:25:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2dc417ab1fa87cbab99eaf8a293380fa763dcd2b'/>
<id>urn:sha1:2dc417ab1fa87cbab99eaf8a293380fa763dcd2b</id>
<content type='text'>
If we don't have a repository, then we can't initialize the
ref store.  Prior to 64a741619d (refs: store the main ref
store inside the repository struct, 2018-04-11), we'd try to
access get_git_dir(), and outside a repository that would
trigger a BUG(). After that commit, though, we directly use
the_repository-&gt;git_dir; if it's NULL we'll just segfault.

Let's catch this case and restore the BUG() behavior.
Obviously we don't ever want to hit this code, but a BUG()
is a lot more helpful than a segfault if we do.

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: handle zero oid for pseudorefs</title>
<updated>2018-05-13T01:36:11Z</updated>
<author>
<name>Martin Ågren</name>
<email>martin.agren@gmail.com</email>
</author>
<published>2018-05-10T19:29:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=db0210d445963e5d85f98e48d6a93b971779d449'/>
<id>urn:sha1:db0210d445963e5d85f98e48d6a93b971779d449</id>
<content type='text'>
According to the documentation, it is possible to "specify 40 '0' or an
empty string as &lt;oldvalue&gt; to make sure that the ref you are creating
does not exist." But in the code for pseudorefs, we do not implement
this, as demonstrated by the failing tests added in the previous commit.
If we fail to read the old ref, we immediately die. But a failure to
read would actually be a good thing if we have been given the zero oid.

With the zero oid, allow -- and even require -- the ref-reading to fail.
This implements the "make sure that the ref ... does not exist" part of
the documentation and fixes both failing tests from the previous commit.

Since we have a `strbuf err` for collecting errors, let's use it and
signal an error to the caller instead of dying hard.

Reported-by: Rafael Ascensão &lt;rafa.almas@gmail.com&gt;
Helped-by: Rafael Ascensão &lt;rafa.almas@gmail.com&gt;
Signed-off-by: Martin Ågren &lt;martin.agren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
