diff options
author | Jeff King <peff@peff.net> | 2017-10-09 13:50:05 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-10-10 09:03:07 +0900 |
commit | 7cbbf9d6a275eb23b889158edb753d651542d5a9 (patch) | |
tree | 8a144b423169453e54a49135991a0720d721bf2b /t/t5100/patch0013 | |
parent | write_entry: avoid reading blobs in CE_RETRY case (diff) | |
download | tgif-7cbbf9d6a275eb23b889158edb753d651542d5a9.tar.xz |
write_entry: untangle symlink and regular-file cases
The write_entry() function switches on the mode of the entry
we're going to write out. The cases for S_IFLNK and S_IFREG
are lumped together. In earlier versions of the code, this
made some sense. They have a shared preamble (which reads
the blob content), a short type-specific body, and a shared
conclusion (which writes out the file contents; always for
S_IFREG and only sometimes for S_IFLNK).
But over time this has grown to make less sense. The preamble
now has conditional bits for each type, and the S_IFREG body
has grown a lot more complicated. It's hard to follow the
logic of which code is running for which mode.
Let's give each mode its own case arm. We will still share
the conclusion code, which means we now jump to it with a
goto. Ideally we'd pull that shared code into its own
function, but it touches so much internal state in the
write_entry() function that the end result is actually
harder to follow than the goto.
While we're here, we'll touch up a few bits of whitespace to
make the beginning and endings of the cases easier to read.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5100/patch0013')
0 files changed, 0 insertions, 0 deletions