<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/sequencer.c, branch v2.0.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.0.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.0.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2014-06-13T19:09:38Z</updated>
<entry>
<title>commit: record buffer length in cache</title>
<updated>2014-06-13T19:09:38Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2014-06-10T21:44:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8597ea3afea067b39ba7d4adae7ec6c1ee0e7c91'/>
<id>urn:sha1:8597ea3afea067b39ba7d4adae7ec6c1ee0e7c91</id>
<content type='text'>
Most callsites which use the commit buffer try to use the
cached version attached to the commit, rather than
re-reading from disk. Unfortunately, that interface provides
only a pointer to the NUL-terminated buffer, with no
indication of the original length.

For the most part, this doesn't matter. People do not put
NULs in their commit messages, and the log code is happy to
treat it all as a NUL-terminated string. However, some code
paths do care. For example, when checking signatures, we
want to be very careful that we verify all the bytes to
avoid malicious trickery.

This patch just adds an optional "size" out-pointer to
get_commit_buffer and friends. The existing callers all pass
NULL (there did not seem to be any obvious sites where we
could avoid an immediate strlen() call, though perhaps with
some further refactoring we could).

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>use get_commit_buffer everywhere</title>
<updated>2014-06-13T19:08:17Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2014-06-10T21:41:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=bc6b8fc1300ef79c4b4c3c2a79bb3c1e2e032963'/>
<id>urn:sha1:bc6b8fc1300ef79c4b4c3c2a79bb3c1e2e032963</id>
<content type='text'>
Each of these sites assumes that commit-&gt;buffer is valid.
Since they would segfault if this was not the case, they are
likely to be correct in practice. However, we can
future-proof them by using get_commit_buffer.

And as a side effect, we abstract away the final bare uses
of commit-&gt;buffer.

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>convert logmsg_reencode to get_commit_buffer</title>
<updated>2014-06-13T19:08:17Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2014-06-10T21:41:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b66103c3baa593a39b8b0751213b9fce60e94de4'/>
<id>urn:sha1:b66103c3baa593a39b8b0751213b9fce60e94de4</id>
<content type='text'>
Like the callsites in the previous commit, logmsg_reencode
already falls back to read_sha1_file when necessary.
However, I split its conversion out into its own commit
because it's a bit more complex.

We return either:

  1. The original commit-&gt;buffer

  2. A newly allocated buffer from read_sha1_file

  3. A reencoded buffer (based on either 1 or 2 above).

while trying to do as few extra reads/allocations as
possible. Callers currently free the result with
logmsg_free, but we can simplify this by pointing them
straight to unuse_commit_buffer. This is a slight layering
violation, in that we may be passing a buffer from (3).
However, since the end result is to free() anything except
(1), which is unlikely to change, and because this makes the
interface much simpler, it's a reasonable bending of the
rules.

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>sequencer: use logmsg_reencode in get_message</title>
<updated>2014-06-12T17:29:43Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2014-06-10T21:39:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d74a4e57d2703e841deed994752b948a768f31ec'/>
<id>urn:sha1:d74a4e57d2703e841deed994752b948a768f31ec</id>
<content type='text'>
This simplifies the code, as logmsg_reencode handles the
reencoding for us in a single call. It also means we learn
logmsg_reencode's trick of pulling the buffer from disk when
commit-&gt;buffer is NULL (we currently just silently return!).
It is doubtful this matters in practice, though, as
sequencer operations would not generally turn off
save_commit_buffer.

Note that we may be fixing a bug here. The existing code
does:

  if (same_encoding(to, from))
	  reencode_string(buf, to, from);

That probably should have been "!same_encoding".

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>cherry-pick, revert: add the --gpg-sign option</title>
<updated>2014-01-27T23:15:52Z</updated>
<author>
<name>Nicolas Vigier</name>
<email>boklm@mars-attacks.org</email>
</author>
<published>2014-01-24T00:50:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3253553e12d40da3bca818528f49a63c95f43aa3'/>
<id>urn:sha1:3253553e12d40da3bca818528f49a63c95f43aa3</id>
<content type='text'>
Signed-off-by: Nicolas Vigier &lt;boklm@mars-attacks.org&gt;
Signed-off-by: brian m. carlson &lt;sandals@crustytoothpaste.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>replace {pre,suf}fixcmp() with {starts,ends}_with()</title>
<updated>2013-12-05T22:13:21Z</updated>
<author>
<name>Christian Couder</name>
<email>chriscool@tuxfamily.org</email>
</author>
<published>2013-11-30T20:55:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=59556548230e617b837343c2c07e357e688e2ca4'/>
<id>urn:sha1:59556548230e617b837343c2c07e357e688e2ca4</id>
<content type='text'>
Leaving only the function definitions and declarations so that any
new topic in flight can still make use of the old functions, replace
existing uses of the prefixcmp() and suffixcmp() with new API
functions.

The change can be recreated by mechanically applying this:

    $ git grep -l -e prefixcmp -e suffixcmp -- \*.c |
      grep -v strbuf\\.c |
      xargs perl -pi -e '
        s|!prefixcmp\(|starts_with\(|g;
        s|prefixcmp\(|!starts_with\(|g;
        s|!suffixcmp\(|ends_with\(|g;
        s|suffixcmp\(|!ends_with\(|g;
      '

on the result of preparatory changes in this series.

Signed-off-by: Christian Couder &lt;chriscool@tuxfamily.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>refs: report ref type from lock_any_ref_for_update</title>
<updated>2013-08-30T21:57:28Z</updated>
<author>
<name>Brad King</name>
<email>brad.king@kitware.com</email>
</author>
<published>2013-08-30T18:12:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9bbb0fa1fdc6c413b1f35c26e090515e5d0096aa'/>
<id>urn:sha1:9bbb0fa1fdc6c413b1f35c26e090515e5d0096aa</id>
<content type='text'>
Expose lock_ref_sha1_basic's type_p argument to callers of
lock_any_ref_for_update.  Update all call sites to ignore it by passing
NULL for now.

Signed-off-by: Brad King &lt;brad.king@kitware.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Convert "struct cache_entry *" to "const ..." wherever possible</title>
<updated>2013-07-09T16:12:48Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2013-07-09T15:29:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9c5e6c802cde9881785b7f1b3278b97be4aabd82'/>
<id>urn:sha1:9c5e6c802cde9881785b7f1b3278b97be4aabd82</id>
<content type='text'>
I attempted to make index_state-&gt;cache[] a "const struct cache_entry **"
to find out how existing entries in index are modified and where. The
question I have is what do we do if we really need to keep track of on-disk
changes in the index. The result is

 - diff-lib.c: setting CE_UPTODATE

 - name-hash.c: setting CE_HASHED

 - preload-index.c, read-cache.c, unpack-trees.c and
   builtin/update-index: obvious

 - entry.c: write_entry() may refresh the checked out entry via
   fill_stat_cache_info(). This causes "non-const struct cache_entry
   *" in builtin/apply.c, builtin/checkout-index.c and
   builtin/checkout.c

 - builtin/ls-files.c: --with-tree changes stagemask and may set
   CE_UPDATE

Of these, write_entry() and its call sites are probably most
interesting because it modifies on-disk info. But this is stat info
and can be retrieved via refresh, at least for porcelain
commands. Other just uses ce_flags for local purposes.

So, keeping track of "dirty" entries is just a matter of setting a
flag in index modification functions exposed by read-cache.c. Except
unpack-trees, the rest of the code base does not do anything funny
behind read-cache's back.

The actual patch is less valueable than the summary above. But if
anyone wants to re-identify the above sites. Applying this patch, then
this:

    diff --git a/cache.h b/cache.h
    index 430d021..1692891 100644
    --- a/cache.h
    +++ b/cache.h
    @@ -267,7 +267,7 @@ static inline unsigned int canon_mode(unsigned int mode)
     #define cache_entry_size(len) (offsetof(struct cache_entry,name) + (len) + 1)

     struct index_state {
    -	struct cache_entry **cache;
    +	const struct cache_entry **cache;
     	unsigned int version;
     	unsigned int cache_nr, cache_alloc, cache_changed;
     	struct string_list *resolve_undo;

will help quickly identify them without bogus warnings.

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>Merge branch 'rr/cherry-pick-fast-forward-reflog-message'</title>
<updated>2013-06-27T21:30:00Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2013-06-27T21:29:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=644daa9428323ecdef08dfce589aa386bd2d97d4'/>
<id>urn:sha1:644daa9428323ecdef08dfce589aa386bd2d97d4</id>
<content type='text'>
The reflog message created when "git cherry-pick" fast-forwarded
did not say anything but "cherry-pick", but it now says
"cherry-pick: fast-forward".

* rr/cherry-pick-fast-forward-reflog-message:
  sequencer: write useful reflog message for fast-forward
</content>
</entry>
<entry>
<title>sequencer: write useful reflog message for fast-forward</title>
<updated>2013-06-19T18:03:22Z</updated>
<author>
<name>Ramkumar Ramachandra</name>
<email>artagnon@gmail.com</email>
</author>
<published>2013-06-19T07:37:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=eb4be1cbe2e50c9bfaa09839564723de257869fc'/>
<id>urn:sha1:eb4be1cbe2e50c9bfaa09839564723de257869fc</id>
<content type='text'>
The following command

  $ git cherry-pick --ff b8bb3f

writes the following uninformative message to the reflog

  cherry-pick

Improve it to

  cherry-pick: fast-forward

Avoid hard-coding "cherry-pick" in fast_forward_to(), so the sequencer
is generic enough to support future actions.

Signed-off-by: Ramkumar Ramachandra &lt;artagnon@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
