<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/apply.c, branch v2.20.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.20.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.20.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2018-11-18T09:23:56Z</updated>
<entry>
<title>Merge branch 'js/apply-recount-allow-noop'</title>
<updated>2018-11-18T09:23:56Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-11-18T09:23:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=bda53f4185b8f7d2197176fe83afcb8d5f47368b'/>
<id>urn:sha1:bda53f4185b8f7d2197176fe83afcb8d5f47368b</id>
<content type='text'>
When editing a patch in a "git add -i" session, a hunk could be
made to no-op.  The "git apply" program used to reject a patch with
such a no-op hunk to catch user mistakes, but it is now updated to
explicitly allow a no-op hunk in an edited patch.

* js/apply-recount-allow-noop:
  apply --recount: allow "no-op hunks"
</content>
</entry>
<entry>
<title>apply --recount: allow "no-op hunks"</title>
<updated>2018-11-13T04:02:52Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2018-11-12T20:54:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=22cb3835b90f80b2de2bc8f5ff3a9e8eed5ff40a'/>
<id>urn:sha1:22cb3835b90f80b2de2bc8f5ff3a9e8eed5ff40a</id>
<content type='text'>
When editing patches e.g. in `git add -e`, it is quite common that a
hunk ends up having no -/+ lines, i.e. it is now supposed to do nothing.

This use case was broken by ad6e8ed37bc1 (apply: reject a hunk that does
not do anything, 2015-06-01) with the good intention of catching a very
real, different issue in hand-edited patches.

So let's use the `--recount` option as the tell-tale whether the user
would actually be okay with no-op hunks.

Add a test case to make sure that this use case does not regress again.

Signed-off-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Reviewed-by: Josh Steadmon &lt;steadmon@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>assert NOARG/NONEG behavior of parse-options callbacks</title>
<updated>2018-11-06T03:56:29Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2018-11-05T06:45:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=517fe807d6903c629a739b23fe0e75b892096998'/>
<id>urn:sha1:517fe807d6903c629a739b23fe0e75b892096998</id>
<content type='text'>
When we define a parse-options callback, the flags we put in the option
struct must match what the callback expects. For example, a callback
which does not handle the "unset" parameter should only be used with
PARSE_OPT_NONEG. But since the callback and the option struct are not
defined next to each other, it's easy to get this wrong (as earlier
patches in this series show).

Fortunately, the compiler can help us here: compiling with
-Wunused-parameters can show us which callbacks ignore their "unset"
parameters (and likewise, ones that ignore "arg" expect to be triggered
with PARSE_OPT_NOARG).

But after we've inspected a callback and determined that all of its
callers use the right flags, what do we do next? We'd like to silence
the compiler warning, but do so in a way that will catch any wrong calls
in the future.

We can do that by actually checking those variables and asserting that
they match our expectations. Because this is such a common pattern,
we'll introduce some helper macros. The resulting messages aren't
as descriptive as we could make them, but the file/line information from
BUG() is enough to identify the problem (and anyway, the point is that
these should never be seen).

Each of the annotated callbacks in this patch triggers
-Wunused-parameters, and was manually inspected to make sure all callers
use the correct options (so none of these BUGs should be triggerable).

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>apply: return -1 from option callback instead of calling exit(1)</title>
<updated>2018-11-06T03:55:36Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2018-11-05T06:43:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=735ca208c5463ebbb0991ed02f41b1e30f9dddc1'/>
<id>urn:sha1:735ca208c5463ebbb0991ed02f41b1e30f9dddc1</id>
<content type='text'>
The option callback for "apply --whitespace" exits with status "1" on
error. It makes more sense for it to just return an error to
parse-options. That code will exit, too, but it will use status "129"
that is customary for option errors.

The exit() dates back to aaf6c447aa (builtin/apply: make
parse_whitespace_option() return -1 instead of die()ing, 2016-08-08).
That commit gives no reason why we'd prefer the current exit status (it
looks like it was just bumping the "die" up a level in the callstack,
but did not go as far as it could have).

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>apply: mark include/exclude options as NONEG</title>
<updated>2018-11-06T03:55:35Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2018-11-05T06:38:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d5d202537f2cfec41304b559624b4cc0a2d8c9fe'/>
<id>urn:sha1:d5d202537f2cfec41304b559624b4cc0a2d8c9fe</id>
<content type='text'>
The options callback for "git apply --no-include" is not ready to handle
the "unset" parameter, and as a result will segfault when it adds a NULL
argument to the include list (likewise for "--no-exclude").

In theory this might be used to clear the list, but since both
"--include" and "--exclude" add to the same list, it's not immediately
obvious what the semantics should be. Let's punt on that for now and
just disallow the broken options.

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/hash-transition-part-15'</title>
<updated>2018-10-30T06:43:42Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-10-30T06:43:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d829d491eebddc2eefcaa9279ac4b67c7eefbd52'/>
<id>urn:sha1:d829d491eebddc2eefcaa9279ac4b67c7eefbd52</id>
<content type='text'>
More codepaths are moving away from hardcoded hash sizes.

* bc/hash-transition-part-15:
  rerere: convert to use the_hash_algo
  submodule: make zero-oid comparison hash function agnostic
  apply: rename new_sha1_prefix and old_sha1_prefix
  apply: replace hard-coded constants
  tag: express constant in terms of the_hash_algo
  transport: use parse_oid_hex instead of a constant
  upload-pack: express constants in terms of the_hash_algo
  refs/packed-backend: express constants using the_hash_algo
  packfile: express constants in terms of the_hash_algo
  pack-revindex: express constants in terms of the_hash_algo
  builtin/fetch-pack: remove constants with parse_oid_hex
  builtin/mktree: remove hard-coded constant
  builtin/repack: replace hard-coded constants
  pack-bitmap-write: use GIT_MAX_RAWSZ for allocation
  object_id.cocci: match only expressions of type 'struct object_id'
</content>
</entry>
<entry>
<title>apply: rename new_sha1_prefix and old_sha1_prefix</title>
<updated>2018-10-15T03:53:16Z</updated>
<author>
<name>brian m. carlson</name>
<email>sandals@crustytoothpaste.net</email>
</author>
<published>2018-10-15T00:02:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=eccb5a5f3d8d49ec9b4645aac94bffb7e504f10f'/>
<id>urn:sha1:eccb5a5f3d8d49ec9b4645aac94bffb7e504f10f</id>
<content type='text'>
Rename these structure members to "new_oid_prefix" and "old_oid_prefix".

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>apply: replace hard-coded constants</title>
<updated>2018-10-15T03:53:16Z</updated>
<author>
<name>brian m. carlson</name>
<email>sandals@crustytoothpaste.net</email>
</author>
<published>2018-10-15T00:01:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=93eb00f719a2d36d31a4ba7b6eeae9f6302314e9'/>
<id>urn:sha1:93eb00f719a2d36d31a4ba7b6eeae9f6302314e9</id>
<content type='text'>
Replace several 40-based constants with references to GIT_MAX_HEXSZ or
the_hash_algo, as appropriate.

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>ws.c: remove implicit dependency on the_index</title>
<updated>2018-09-21T16:51:18Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2018-09-21T15:57:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=26d024ecf0e2e5bd697714b95930bb6008d85f3f'/>
<id>urn:sha1:26d024ecf0e2e5bd697714b95930bb6008d85f3f</id>
<content type='text'>
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>rerere.c: remove implicit dependency on the_index</title>
<updated>2018-09-21T16:48:11Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2018-09-21T15:57:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=35843b1123e2772c5db6d7db5abf279c3253ae57'/>
<id>urn:sha1:35843b1123e2772c5db6d7db5abf279c3253ae57</id>
<content type='text'>
The reason rerere(), rerere_forget() and rerere_remaining() take a
struct repository instead of struct index_state is not obvious from
the patch:

Deep in update_paths() and find_conflict(), hold_locked_index() and
read_index() are called. These functions assumes the index path at
$GIT_DIR/index which is not always true when you take an arbitrary
index state. Taking a repository will allow us to point to the right
index path later when we replace them with repo_ versions.

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>
