diff options
author | Jeff King <peff@peff.net> | 2018-01-02 16:10:14 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-01-03 13:33:05 -0800 |
commit | f9e377adc0b1ed06e35d2c77a6c9f2687c5b950b (patch) | |
tree | cb29b25bdd12900c391055777544d44134e82802 /convert.h | |
parent | t5600: modernize style (diff) | |
download | tgif-f9e377adc0b1ed06e35d2c77a6c9f2687c5b950b.tar.xz |
clone: factor out dir_exists() helper
Two parts of git-clone's setup logic check whether a
directory exists, and they both call stat directly with the
same scratch "struct stat" buffer. Let's pull that into a
helper, which has a few advantages:
- it makes the purpose of the stat calls more obvious
- it makes it clear that we don't care about the
information in "buf" remaining valid
- if we later decide to make the check more robust (e.g.,
complaining about non-directories), we can do it in one
place
Note that we could just use file_exists() for this, which
has identical code. But we specifically care about
directories, so this future-proofs us against that function
later getting more picky about seeing actual files.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'convert.h')
0 files changed, 0 insertions, 0 deletions