diff options
author | Jeff King <peff@peff.net> | 2018-01-02 21:10:14 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-01-03 21:33:05 (GMT) |
commit | f9e377adc0b1ed06e35d2c77a6c9f2687c5b950b (patch) | |
tree | cb29b25bdd12900c391055777544d44134e82802 /exec_cmd.c | |
parent | 8486b84f0ea4d7f943fdbe81050553d69d198742 (diff) | |
download | git-f9e377adc0b1ed06e35d2c77a6c9f2687c5b950b.zip git-f9e377adc0b1ed06e35d2c77a6c9f2687c5b950b.tar.gz git-f9e377adc0b1ed06e35d2c77a6c9f2687c5b950b.tar.bz2 |
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 'exec_cmd.c')
0 files changed, 0 insertions, 0 deletions