<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/ref-filter.c, branch v2.28.1</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://www.git.shady.money/git/atom?h=v2.28.1</id>
<link rel='self' href='https://www.git.shady.money/git/atom?h=v2.28.1'/>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/'/>
<updated>2020-07-07T05:09:15Z</updated>
<entry>
<title>Merge branch 'es/get-worktrees-unsort'</title>
<updated>2020-07-07T05:09:15Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-07-07T05:09:15Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=645f63111b9fc456cc48da9b320b86800fe5477c'/>
<id>urn:sha1:645f63111b9fc456cc48da9b320b86800fe5477c</id>
<content type='text'>
API cleanup for get_worktrees()

* es/get-worktrees-unsort:
  worktree: drop get_worktrees() unused 'flags' argument
  worktree: drop get_worktrees() special-purpose sorting option
</content>
</entry>
<entry>
<title>worktree: drop get_worktrees() unused 'flags' argument</title>
<updated>2020-06-22T17:31:15Z</updated>
<author>
<name>Eric Sunshine</name>
<email>sunshine@sunshineco.com</email>
</author>
<published>2020-06-19T23:35:44Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=03f2465bb1c1d9222181c493373e668c0ba7eb51'/>
<id>urn:sha1:03f2465bb1c1d9222181c493373e668c0ba7eb51</id>
<content type='text'>
get_worktrees() accepts a 'flags' argument, however, there are no
existing flags (the lone flag GWT_SORT_LINKED was recently retired) and
no behavior which can be tweaked. Therefore, drop the 'flags' argument.

Signed-off-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jk/for-each-ref-multi-key-sort-fix'</title>
<updated>2020-05-08T21:25:04Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-05-08T21:25:04Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=6de1630898838b62b97617323a07eb6fe9618a7e'/>
<id>urn:sha1:6de1630898838b62b97617323a07eb6fe9618a7e</id>
<content type='text'>
"git branch" and other "for-each-ref" variants accepted multiple
--sort=&lt;key&gt; options in the increasing order of precedence, but it
had a few breakages around "--ignore-case" handling, and tie-breaking
with the refname, which have been fixed.

* jk/for-each-ref-multi-key-sort-fix:
  ref-filter: apply fallback refname sort only after all user sorts
  ref-filter: apply --ignore-case to all sorting keys
</content>
</entry>
<entry>
<title>ref-filter: apply fallback refname sort only after all user sorts</title>
<updated>2020-05-04T20:44:46Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2020-05-03T09:13:09Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=7c5045fc180ed09ed4cb5065955acddc1dd50163'/>
<id>urn:sha1:7c5045fc180ed09ed4cb5065955acddc1dd50163</id>
<content type='text'>
Commit 9e468334b4 (ref-filter: fallback on alphabetical comparison,
2015-10-30) taught ref-filter's sort to fallback to comparing refnames.
But it did it at the wrong level, overriding the comparison result for a
single "--sort" key from the user, rather than after all sort keys have
been exhausted.

This worked correctly for a single "--sort" option, but not for multiple
ones. We'd break any ties in the first key with the refname and never
evaluate the second key at all.

To make matters even more interesting, we only applied this fallback
sometimes! For a field like "taggeremail" which requires a string
comparison, we'd truly return the result of strcmp(), even if it was 0.
But for numerical "value" fields like "taggerdate", we did apply the
fallback. And that's why our multiple-sort test missed this: it uses
taggeremail as the main comparison.

So let's start by adding a much more rigorous test. We'll have a set of
commits expressing every combination of two tagger emails, dates, and
refnames. Then we can confirm that our sort is applied with the correct
precedence, and we'll be hitting both the string and value comparators.

That does show the bug, and the fix is simple: moving the fallback to
the outer compare_refs() function, after all ref_sorting keys have been
exhausted.

Note that in the outer function we don't have an "ignore_case" flag, as
it's part of each individual ref_sorting element. It's debatable what
such a fallback should do, since we didn't use the user's keys to match.
But until now we have been trying to respect that flag, so the
least-invasive thing is to try to continue to do so. Since all callers
in the current code either set the flag for all keys or for none, we can
just pull the flag from the first key. In a hypothetical world where the
user really can flip the case-insensitivity of keys separately, we may
want to extend the code to distinguish that case from a blanket
"--ignore-case".

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>ref-filter: apply --ignore-case to all sorting keys</title>
<updated>2020-05-04T20:41:20Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2020-05-03T09:11:57Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=76f9e569adb540a1ca1a590c512d57fce4eea878'/>
<id>urn:sha1:76f9e569adb540a1ca1a590c512d57fce4eea878</id>
<content type='text'>
All of the ref-filter users (for-each-ref, branch, and tag) take an
--ignore-case option which makes filtering and sorting case-insensitive.
However, this option was applied only to the first element of the
ref_sorting list. So:

  git for-each-ref --ignore-case --sort=refname

would do what you expect, but:

  git for-each-ref --ignore-case --sort=refname --sort=taggername

would sort the primary key (taggername) case-insensitively, but sort the
refname case-sensitively. We have two options here:

  - teach callers to set ignore_case on the whole list

  - replace the ref_sorting list with a struct that contains both the
    list of sorting keys, as well as options that apply to _all_
    keys

I went with the first one here, as it gives more flexibility if we later
want to let the users set the flag per-key (presumably through some
special syntax when defining the key; for now it's all or nothing
through --ignore-case).

The new test covers this by sorting on both tagger and subject
case-insensitively, which should compare "a" and "A" identically, but
still sort them before "b" and "B". We'll break ties by sorting on the
refname to give ourselves a stable output (this is actually supposed to
be done automatically, but there's another bug which will be fixed in
the next commit).

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>ref-filter: stop referring to "sha1 array"</title>
<updated>2020-03-30T17:59:08Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2020-03-30T14:04:11Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=c79eddf5baac055725ee65ae924654e2f36746b0'/>
<id>urn:sha1:c79eddf5baac055725ee65ae924654e2f36746b0</id>
<content type='text'>
A comment refers to the "sha1s in the given sha1 array". But this became
an oid_array along with everywhere else in 910650d2f8 (Rename sha1_array
to oid_array, 2017-03-31). Plus there's an extra line of leftover
editing cruft we can drop.

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 'dr/push-remote-ref-update'</title>
<updated>2020-03-11T17:58:16Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-03-11T17:58:16Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=5fa9169ced8f874910cf4cf289a650d65f52df22'/>
<id>urn:sha1:5fa9169ced8f874910cf4cf289a650d65f52df22</id>
<content type='text'>
Code clean-up.

* dr/push-remote-ref-update:
  remote: drop "explicit" parameter from remote_ref_for_branch()
</content>
</entry>
<entry>
<title>remote: drop "explicit" parameter from remote_ref_for_branch()</title>
<updated>2020-03-03T22:56:05Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2020-03-03T16:12:22Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=af8ccd8ade1e2dd1bf332067b98dd4459e29c1d3'/>
<id>urn:sha1:af8ccd8ade1e2dd1bf332067b98dd4459e29c1d3</id>
<content type='text'>
Commit 9700fae5ee (for-each-ref: let upstream/push report the remote
ref name, 2017-11-07) added a remote_ref_for_branch() helper, which
is modeled after remote_for_branch(). This includes providing an
"explicit" out-parameter that tells the caller whether the remote
was configured by the user, or whether we picked a default name like
"origin".

But unlike remote names, there is no default name when the user
didn't configure one.  The only way the "explicit" parameter is used
by the caller is to use the value returned from the helper when it
is set, and use an empty string otherwise, ignoring the returned
value from the helper.

Let's drop the "explicit" out-parameter, and return NULL when the
returned value from the helper should be ignored, to simplify the
function interface.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Damien Robert &lt;damien.olivier.robert+git@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>packed_object_info(): use object_id for returning delta base</title>
<updated>2020-02-24T20:55:53Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2020-02-24T04:36:56Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=b99b6bcc57faf5c989fc18c3b8d4d92df3407cec'/>
<id>urn:sha1:b99b6bcc57faf5c989fc18c3b8d4d92df3407cec</id>
<content type='text'>
If a caller sets the object_info.delta_base_sha1 to a non-NULL pointer,
we'll write the oid of the object's delta base to it. But we can
increase our type safety by switching this to a real object_id struct.
All of our callers are just pointing into the hash member of an
object_id anyway, so there's no inconvenience.

Note that we do still keep it as a pointer-to-struct, because the NULL
sentinel value tells us whether the caller is even interested in the
information.

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 'ew/hashmap'</title>
<updated>2019-10-15T04:48:02Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-10-15T04:48:01Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=5efabc7ed9e57bb73159d1ad7739c508167ef24a'/>
<id>urn:sha1:5efabc7ed9e57bb73159d1ad7739c508167ef24a</id>
<content type='text'>
Code clean-up of the hashmap API, both users and implementation.

* ew/hashmap:
  hashmap_entry: remove first member requirement from docs
  hashmap: remove type arg from hashmap_{get,put,remove}_entry
  OFFSETOF_VAR macro to simplify hashmap iterators
  hashmap: introduce hashmap_free_entries
  hashmap: hashmap_{put,remove} return hashmap_entry *
  hashmap: use *_entry APIs for iteration
  hashmap_cmp_fn takes hashmap_entry params
  hashmap_get{,_from_hash} return "struct hashmap_entry *"
  hashmap: use *_entry APIs to wrap container_of
  hashmap_get_next returns "struct hashmap_entry *"
  introduce container_of macro
  hashmap_put takes "struct hashmap_entry *"
  hashmap_remove takes "const struct hashmap_entry *"
  hashmap_get takes "const struct hashmap_entry *"
  hashmap_add takes "struct hashmap_entry *"
  hashmap_get_next takes "const struct hashmap_entry *"
  hashmap_entry_init takes "struct hashmap_entry *"
  packfile: use hashmap_entry in delta_base_cache_entry
  coccicheck: detect hashmap_entry.hash assignment
  diff: use hashmap_entry_init on moved_entry.ent
</content>
</entry>
</feed>
