diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/branch.c | 9 | ||||
-rw-r--r-- | src/refs.c | 4 |
2 files changed, 6 insertions, 7 deletions
diff --git a/src/branch.c b/src/branch.c index 6d497b055..d0bd1c45b 100644 --- a/src/branch.c +++ b/src/branch.c @@ -77,12 +77,11 @@ int git_branch_create( if (git_buf_joinpath(&canonical_branch_name, GIT_REFS_HEADS_DIR, branch_name) < 0) goto cleanup; - if (git_reference_create_oid(&branch, repository, - git_buf_cstr(&canonical_branch_name), git_object_id(commit), force) < 0) - goto cleanup; + error = git_reference_create_oid(&branch, repository, + git_buf_cstr(&canonical_branch_name), git_object_id(commit), force); - *ref_out = branch; - error = 0; + if (!error) + *ref_out = branch; cleanup: git_object_free(commit); diff --git a/src/refs.c b/src/refs.c index 9dc422e1b..1d73b2677 100644 --- a/src/refs.c +++ b/src/refs.c @@ -1357,8 +1357,8 @@ int git_reference_rename(git_reference *ref, const char *new_name, int force) normalization_flags) < 0) return -1; - if (reference_can_write(ref->owner, normalized, ref->name, force) < 0) - return -1; + if ((result = reference_can_write(ref->owner, normalized, ref->name, force)) < 0) + return result; /* Initialize path now so we won't get an allocation failure once * we actually start removing things. */ |