diff options
| author | Vicent Marti <tanoku@gmail.com> | 2013-05-30 03:47:10 +0200 |
|---|---|---|
| committer | Vicent Marti <tanoku@gmail.com> | 2013-05-30 03:47:10 +0200 |
| commit | 4e6e2ff26f5a04a4628aa0d81e5d5d73acf28ec4 (patch) | |
| tree | 9a6d20bb0d7e8b390bbb0a5b0a67a493ea778fd6 /src/branch.c | |
| parent | ec24e542969f9d49e41e4c2cb3eac2259b1818c2 (diff) | |
| download | libgit2-4e6e2ff26f5a04a4628aa0d81e5d5d73acf28ec4.tar.gz | |
...Aaaand this works
Diffstat (limited to 'src/branch.c')
| -rw-r--r-- | src/branch.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/branch.c b/src/branch.c index 84efadae1..de38e3355 100644 --- a/src/branch.c +++ b/src/branch.c @@ -182,18 +182,21 @@ int git_branch_move( if (!git_reference_is_branch(branch)) return not_a_local_branch(git_reference_name(branch)); - if ((error = git_buf_joinpath(&new_reference_name, GIT_REFS_HEADS_DIR, new_branch_name)) < 0 || - (error = git_buf_printf(&old_config_section, "branch.%s", git_reference_name(branch) + strlen(GIT_REFS_HEADS_DIR))) < 0 || - (error = git_buf_printf(&new_config_section, "branch.%s", new_branch_name)) < 0) + error = git_buf_joinpath(&new_reference_name, GIT_REFS_HEADS_DIR, new_branch_name); + if (error < 0) goto done; + git_buf_printf(&old_config_section, + "branch.%s", git_reference_name(branch) + strlen(GIT_REFS_HEADS_DIR)); + + git_buf_printf(&new_config_section, "branch.%s", new_branch_name); + if ((error = git_config_rename_section(git_reference_owner(branch), git_buf_cstr(&old_config_section), git_buf_cstr(&new_config_section))) < 0) goto done; - if ((error = git_reference_rename(out, branch, git_buf_cstr(&new_reference_name), force)) < 0) - goto done; + error = git_reference_rename(out, branch, git_buf_cstr(&new_reference_name), force); done: git_buf_free(&new_reference_name); |
