diff options
| author | nulltoken <emeric.fermas@gmail.com> | 2012-09-21 10:28:20 +0200 |
|---|---|---|
| committer | nulltoken <emeric.fermas@gmail.com> | 2012-10-07 12:04:19 +0200 |
| commit | 74a24005146d0f908b2660db5f7e198adad4ab64 (patch) | |
| tree | 71fb7eada7a75190073a00be84d27226ef6e6f4a /src/clone.c | |
| parent | acd1700630ea1159a55dc5e8cee12e4a725afe18 (diff) | |
| download | libgit2-74a24005146d0f908b2660db5f7e198adad4ab64.tar.gz | |
refs: use constants for well-known names
Diffstat (limited to 'src/clone.c')
| -rw-r--r-- | src/clone.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/clone.c b/src/clone.c index 80a13d0f2..9dfc22c59 100644 --- a/src/clone.c +++ b/src/clone.c @@ -50,7 +50,7 @@ static int create_tracking_branch(git_repository *repo, const git_oid *target, c git_buf merge_target = GIT_BUF_INIT; if (!git_buf_printf(&remote, "branch.%s.remote", name) && !git_buf_printf(&merge, "branch.%s.merge", name) && - !git_buf_printf(&merge_target, "refs/heads/%s", name) && + !git_buf_printf(&merge_target, GIT_REFS_HEADS_DIR "%s", name) && !git_config_set_string(cfg, git_buf_cstr(&remote), "origin") && !git_config_set_string(cfg, git_buf_cstr(&merge), git_buf_cstr(&merge_target))) { retcode = 0; @@ -77,7 +77,7 @@ static int reference_matches_remote_head(const char *head_name, void *payload) if (!git_reference_name_to_oid(&oid, head_info->repo, head_name) && !git_oid_cmp(&head_info->remote_head_oid, &oid)) { git_buf_puts(&head_info->branchname, - head_name+strlen("refs/remotes/origin/")); + head_name+strlen(GIT_REFS_REMOTES_DIR "origin/")); } return 0; } @@ -90,7 +90,7 @@ static int update_head_to_new_branch(git_repository *repo, const git_oid *target git_reference *head; if (!git_reference_lookup(&head, repo, GIT_HEAD_FILE)) { git_buf targetbuf = GIT_BUF_INIT; - if (!git_buf_printf(&targetbuf, "refs/heads/%s", name)) { + if (!git_buf_printf(&targetbuf, GIT_REFS_HEADS_DIR "%s", name)) { retcode = git_reference_set_target(head, git_buf_cstr(&targetbuf)); } git_buf_free(&targetbuf); @@ -115,7 +115,7 @@ static int update_head_to_remote(git_repository *repo, git_remote *remote) head_info.repo = repo; /* Check to see if "master" matches the remote head */ - if (!git_reference_name_to_oid(&oid, repo, "refs/remotes/origin/master") && + if (!git_reference_name_to_oid(&oid, repo, GIT_REFS_REMOTES_DIR "origin/master") && !git_oid_cmp(&remote_head->oid, &oid)) { retcode = update_head_to_new_branch(repo, &oid, "master"); } |
