author | Junio C Hamano <gitster@pobox.com> | |
Tue, 31 May 2011 17:06:44 +0000 (10:06 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 31 May 2011 18:24:12 +0000 (11:24 -0700) | ||
commit | b4194828dc00e97dcd07ecb4bb4f87650a6fca1d | |
tree | 9baeefb8b2ce7e5815a2d812dc109fd4dc55f64e | tree | snapshot |
parent | 2d11f21c365821ccba1e093f22b99ad71b955f21 | commit | diff |
diff-index --quiet: learn the "stop feeding the backend early" logic
A negative return from the unpack callback function usually means unpack
failed for the entry and signals the unpack_trees() machinery to fail the
entire merge operation, immediately and there is no other way for the
callback to tell the machinery to exit early without reporting an error.
This is what we usually want to make a merge all-or-nothing operation, but
the machinery is also used for diff-index codepath by using a custom
unpack callback function. And we do sometimes want to exit early without
failing, namely when we are under --quiet and can short-cut the diff upon
finding the first difference.
Add "exiting_early" field to unpack_trees_options structure, to signal the
unpack_trees() machinery that the negative return value is not signaling
an error but an early return from the unpack_trees() machinery. As this by
definition hasn't unpacked everything, discard the resulting index just
like the failure codepath.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
A negative return from the unpack callback function usually means unpack
failed for the entry and signals the unpack_trees() machinery to fail the
entire merge operation, immediately and there is no other way for the
callback to tell the machinery to exit early without reporting an error.
This is what we usually want to make a merge all-or-nothing operation, but
the machinery is also used for diff-index codepath by using a custom
unpack callback function. And we do sometimes want to exit early without
failing, namely when we are under --quiet and can short-cut the diff upon
finding the first difference.
Add "exiting_early" field to unpack_trees_options structure, to signal the
unpack_trees() machinery that the negative return value is not signaling
an error but an early return from the unpack_trees() machinery. As this by
definition hasn't unpacked everything, discard the resulting index just
like the failure codepath.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff-lib.c | diff | blob | history | |
unpack-trees.c | diff | blob | history | |
unpack-trees.h | diff | blob | history |