<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/ref-filter.c, branch v2.13.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.13.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.13.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2017-06-05T00:03:13Z</updated>
<entry>
<title>Merge branch 'kn/ref-filter-branch-list' into maint</title>
<updated>2017-06-05T00:03:13Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-06-05T00:03:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=fd8567c99023c62ca206d930dfbf41a92648ea9a'/>
<id>urn:sha1:fd8567c99023c62ca206d930dfbf41a92648ea9a</id>
<content type='text'>
"git for-each-ref --format=..." with %(HEAD) in the format used to
resolve the HEAD symref as many times as it had processed refs,
which was wasteful, and "git branch" shared the same problem.

* kn/ref-filter-branch-list:
  ref-filter: resolve HEAD when parsing %(HEAD) atom
</content>
</entry>
<entry>
<title>C style: use standard style for "TRANSLATORS" comments</title>
<updated>2017-05-30T23:01:42Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2017-05-11T21:20:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=66f5f6dca95eda46bf02c8d06de8cb265995fd6e'/>
<id>urn:sha1:66f5f6dca95eda46bf02c8d06de8cb265995fd6e</id>
<content type='text'>
Change all the "TRANSLATORS: [...]" comments in the C code to use the
regular Git coding style, and amend the style guide so that the
example there uses that style.

This custom style was necessary back in 2010 when the gettext support
was initially added, and was subsequently documented in commit
cbcfd4e3ea ("i18n: mention "TRANSLATORS:" marker in
Documentation/CodingGuidelines", 2014-04-18).

GNU xgettext hasn't had the parsing limitation that necessitated this
exception for almost 3 years. Since its 0.19 release on 2014-06-02
it's been able to recognize TRANSLATOR comments in the standard Git
comment syntax[1].

Usually we'd like to keep compatibility with software that's that
young, but in this case literally the only person who needs to be
using a gettext newer than 3 years old is Jiang Xin (the only person
who runs &amp; commits "make pot" results), so I think in this case we can
make an exception.

This xgettext parsing feature was added after a thread on the Git
mailing list[2] which continued on the bug-gettext[3] list, but we
never subsequently changed our style &amp; styleguide, do so.

There are already longstanding changes in git that use the standard
comment style &amp; have their TRANSLATORS comments extracted properly
without getting the literal "*"'s mixed up in the text, as would
happen before xgettext 0.19.

Commit 7ff2683253 ("builtin-am: implement -i/--interactive",
2015-08-04) added one such comment, which in commit df0617bfa7 ("l10n:
git.pot: v2.6.0 round 1 (123 new, 41 removed)", 2015-09-05) got picked
up in the po/git.pot file with the right format, showing that Jiang
already runs a modern xgettext.

The xgettext parser does not handle the sort of non-standard comment
style that I'm amending here in sequencer.c, but that isn't standard
Git comment syntax anyway. With this change to sequencer.c &amp; "make
pot" the comment in the pot file is now correct:

     #. TRANSLATORS: %s will be "revert", "cherry-pick" or
    -#. * "rebase -i".
    +#. "rebase -i".

1. http://git.savannah.gnu.org/cgit/gettext.git/commit/?id=10af7fe6bd
2. &lt;2ce9ec406501d112e032c8208417f8100bed04c6.1397712142.git.worldhello.net@gmail.com&gt;
   (https://public-inbox.org/git/2ce9ec406501d112e032c8208417f8100bed04c6.1397712142.git.worldhello.net@gmail.com/)
3. https://lists.gnu.org/archive/html/bug-gettext/2014-04/msg00016.html

Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Acked-by: Jiang Xin &lt;worldhello.net@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>ref-filter: resolve HEAD when parsing %(HEAD) atom</title>
<updated>2017-05-20T09:18:45Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2017-05-19T06:12:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=613a0e52ea11c4496e3e154de192486a18eac2e4'/>
<id>urn:sha1:613a0e52ea11c4496e3e154de192486a18eac2e4</id>
<content type='text'>
If the user asks to display (or sort by) the %(HEAD) atom,
ref-filter has to compare each refname to the value of HEAD.
We do so by resolving HEAD fresh when calling populate_value()
on each ref. If there are a large number of refs, this can
have a measurable impact on runtime.

Instead, let's resolve HEAD once when we realize we need the
%(HEAD) atom, allowing us to do a simple string comparison
for each ref. On a repository with 3000 branches (high, but
an actual example found in the wild) this drops the
best-of-five time to run "git branch &gt;/dev/null" from 59ms
to 48ms (~20% savings).

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 'bc/object-id'</title>
<updated>2017-04-20T04:37:13Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-04-20T04:37:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b1081e4004091947b6c6a806625addd1cbba61b7'/>
<id>urn:sha1:b1081e4004091947b6c6a806625addd1cbba61b7</id>
<content type='text'>
Conversion from unsigned char [40] to struct object_id continues.

* bc/object-id:
  Documentation: update and rename api-sha1-array.txt
  Rename sha1_array to oid_array
  Convert sha1_array_for_each_unique and for_each_abbrev to object_id
  Convert sha1_array_lookup to take struct object_id
  Convert remaining callers of sha1_array_lookup to object_id
  Make sha1_array_append take a struct object_id *
  sha1-array: convert internal storage for struct sha1_array to object_id
  builtin/pull: convert to struct object_id
  submodule: convert check_for_new_submodule_commits to object_id
  sha1_name: convert disambiguate_hint_fn to take object_id
  sha1_name: convert struct disambiguate_state to object_id
  test-sha1-array: convert most code to struct object_id
  parse-options-cb: convert sha1_array_append caller to struct object_id
  fsck: convert init_skiplist to struct object_id
  builtin/receive-pack: convert portions to struct object_id
  builtin/pull: convert portions to struct object_id
  builtin/diff: convert to struct object_id
  Convert GIT_SHA1_RAWSZ used for allocation to GIT_MAX_RAWSZ
  Convert GIT_SHA1_HEXSZ used for allocation to GIT_MAX_HEXSZ
  Define new hash-size constants for allocating memory
</content>
</entry>
<entry>
<title>Merge branch 'ab/ref-filter-no-contains'</title>
<updated>2017-04-11T07:21:50Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-04-11T07:21:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d1d3d46146e1256efe8ad2a2bb0dd877a738c07d'/>
<id>urn:sha1:d1d3d46146e1256efe8ad2a2bb0dd877a738c07d</id>
<content type='text'>
"git tag/branch/for-each-ref" family of commands long allowed to
filter the refs by "--contains X" (show only the refs that are
descendants of X), "--merged X" (show only the refs that are
ancestors of X), "--no-merged X" (show only the refs that are not
ancestors of X).  One curious omission, "--no-contains X" (show
only the refs that are not descendants of X) has been added to
them.

* ab/ref-filter-no-contains:
  tag: add tests for --with and --without
  ref-filter: reflow recently changed branch/tag/for-each-ref docs
  ref-filter: add --no-contains option to tag/branch/for-each-ref
  tag: change --point-at to default to HEAD
  tag: implicitly supply --list given another list-like option
  tag: change misleading --list &lt;pattern&gt; documentation
  parse-options: add OPT_NONEG to the "contains" option
  tag: add more incompatibles mode tests
  for-each-ref: partly change &lt;object&gt; to &lt;commit&gt; in help
  tag tests: fix a typo in a test description
  tag: remove a TODO item from the test suite
  ref-filter: add test for --contains on a non-commit
  ref-filter: make combining --merged &amp; --no-merged an error
  tag doc: reword --[no-]merged to talk about commits, not tips
  tag doc: split up the --[no-]merged documentation
  tag doc: move the description of --[no-]merged earlier
</content>
</entry>
<entry>
<title>Rename sha1_array to oid_array</title>
<updated>2017-03-31T15:33:56Z</updated>
<author>
<name>brian m. carlson</name>
<email>sandals@crustytoothpaste.net</email>
</author>
<published>2017-03-31T01:40:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=910650d2f8755359ab7b1f0e2a2d576c06a68091'/>
<id>urn:sha1:910650d2f8755359ab7b1f0e2a2d576c06a68091</id>
<content type='text'>
Since this structure handles an array of object IDs, rename it to struct
oid_array.  Also rename the accessor functions and the initialization
constant.

This commit was produced mechanically by providing non-Documentation
files to the following Perl one-liners:

    perl -pi -E 's/struct sha1_array/struct oid_array/g'
    perl -pi -E 's/\bsha1_array_/oid_array_/g'
    perl -pi -E 's/SHA1_ARRAY_INIT/OID_ARRAY_INIT/g'

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>Convert sha1_array_lookup to take struct object_id</title>
<updated>2017-03-31T15:33:55Z</updated>
<author>
<name>brian m. carlson</name>
<email>sandals@crustytoothpaste.net</email>
</author>
<published>2017-03-31T01:39:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5d3206d5010423b3bbf479e32567d0fddc7095e0'/>
<id>urn:sha1:5d3206d5010423b3bbf479e32567d0fddc7095e0</id>
<content type='text'>
Convert this function by changing the declaration and definition and
applying the following semantic patch to update the callers:

@@
expression E1, E2;
@@
- sha1_array_lookup(E1, E2.hash)
+ sha1_array_lookup(E1, &amp;E2)

@@
expression E1, E2;
@@
- sha1_array_lookup(E1, E2-&gt;hash)
+ sha1_array_lookup(E1, E2)

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>Convert remaining callers of sha1_array_lookup to object_id</title>
<updated>2017-03-31T15:33:55Z</updated>
<author>
<name>brian m. carlson</name>
<email>sandals@crustytoothpaste.net</email>
</author>
<published>2017-03-31T01:39:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4ce3621a6dd3f98dab3c588b7f53f81b8404df32'/>
<id>urn:sha1:4ce3621a6dd3f98dab3c588b7f53f81b8404df32</id>
<content type='text'>
There are a very small number of callers which don't already use struct
object_id.  Convert them.

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>ref-filter: add --no-contains option to tag/branch/for-each-ref</title>
<updated>2017-03-24T19:15:26Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2017-03-24T18:40:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ac3f5a346860b824e083c5d305757c3260565475'/>
<id>urn:sha1:ac3f5a346860b824e083c5d305757c3260565475</id>
<content type='text'>
Change the tag, branch &amp; for-each-ref commands to have a --no-contains
option in addition to their longstanding --contains options.

This allows for finding the last-good rollout tag given a known-bad
&lt;commit&gt;. Given a hypothetically bad commit cf5c7253e0, the git
version to revert to can be found with this hacky two-liner:

    (git tag -l 'v[0-9]*'; git tag -l --contains cf5c7253e0 'v[0-9]*') |
        sort | uniq -c | grep -E '^ *1 ' | awk '{print $2}' | tail -n 10

With this new --no-contains option the same can be achieved with:

    git tag -l --no-contains cf5c7253e0 'v[0-9]*' | sort | tail -n 10

As the filtering machinery is shared between the tag, branch &amp;
for-each-ref commands, implement this for those commands too. A
practical use for this with "branch" is e.g. finding branches which
were branched off between v2.8.0 and v2.10.0:

    git branch --contains v2.8.0 --no-contains v2.10.0

The "describe" command also has a --contains option, but its semantics
are unrelated to what tag/branch/for-each-ref use --contains for. A
--no-contains option for "describe" wouldn't make any sense, other
than being exactly equivalent to not supplying --contains at all,
which would be confusing at best.

Add a --without option to "tag" as an alias for --no-contains, for
consistency with --with and --contains.  The --with option is
undocumented, and possibly the only user of it is
Junio (&lt;xmqqefy71iej.fsf@gitster.mtv.corp.google.com&gt;). But it's
trivial to support, so let's do that.

The additions to the the test suite are inverse copies of the
corresponding --contains tests. With this change --no-contains for
tag, branch &amp; for-each-ref is just as well tested as the existing
--contains option.

In addition to those tests, add a test for "tag" which asserts that
--no-contains won't find tree/blob tags, which is slightly
unintuitive, but consistent with how --contains works &amp; is documented.

Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>ref-filter: make combining --merged &amp; --no-merged an error</title>
<updated>2017-03-21T18:19:52Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2017-03-21T12:58:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=17d6c744dc0d5ed4cd0f228da14239ea2654f05b'/>
<id>urn:sha1:17d6c744dc0d5ed4cd0f228da14239ea2654f05b</id>
<content type='text'>
Change the behavior of specifying --merged &amp; --no-merged to be an
error, instead of silently picking the option that was provided last.

Subsequent changes of mine add a --no-contains option in addition to
the existing --contains. Providing both of those isn't an error, and
has actual meaning.

Making its cousins have different behavior in this regard would be
confusing to the user, especially since we'd be silently disregarding
some of their command-line input.

Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
