do_for_each_reflog(): return early on error
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
9f2fb4a373
commit
93c603fcb7
14
refs.c
14
refs.c
@ -2246,12 +2246,15 @@ static int do_for_each_reflog(const char *base, each_ref_fn fn, void *cb_data)
|
||||
{
|
||||
DIR *d = opendir(git_path("logs/%s", base));
|
||||
int retval = 0;
|
||||
|
||||
if (d) {
|
||||
struct dirent *de;
|
||||
int baselen = strlen(base);
|
||||
char *log = xmalloc(baselen + 257);
|
||||
int baselen;
|
||||
char *log;
|
||||
|
||||
if (!d)
|
||||
return *base ? errno : 0;
|
||||
|
||||
baselen = strlen(base);
|
||||
log = xmalloc(baselen + 257);
|
||||
memcpy(log, base, baselen);
|
||||
if (baselen && base[baselen-1] != '/')
|
||||
log[baselen++] = '/';
|
||||
@ -2284,9 +2287,6 @@ static int do_for_each_reflog(const char *base, each_ref_fn fn, void *cb_data)
|
||||
}
|
||||
free(log);
|
||||
closedir(d);
|
||||
}
|
||||
else if (*base)
|
||||
return errno;
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user