diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2020-07-15 21:29:56 +0100 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2020-08-03 11:53:20 +0100 |
commit | cd2f74d27e59c23fc9c0efc6e7a147e350a28b2a (patch) | |
tree | 221fbead2984ff36cb81d104432eeed3e8315f64 | |
parent | 471ed794d8bc8ce783964eda180c21234b2fe591 (diff) | |
download | libgit2-cd2f74d27e59c23fc9c0efc6e7a147e350a28b2a.tar.gz |
clone: don't assume the default branch name
We derive the branch name, even in our code, we shouldn't assume that
the branch will be "master".
-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 9214fa970..a662a7652 100644 --- a/src/clone.c +++ b/src/clone.c @@ -172,7 +172,7 @@ static int update_head_to_remote( git_refspec *refspec; const git_remote_head *remote_head, **refs; const git_oid *remote_head_id; - git_buf remote_master_name = GIT_BUF_INIT; + git_buf remote_branch_name = GIT_BUF_INIT; git_buf branch = GIT_BUF_INIT; if ((error = git_remote_ls(&refs, &refs_len, remote)) < 0) @@ -203,9 +203,9 @@ static int update_head_to_remote( goto cleanup; } - /* Determine the remote tracking reference name from the local master */ + /* Determine the remote tracking ref name from the local branch */ if ((error = git_refspec_transform( - &remote_master_name, + &remote_branch_name, refspec, git_buf_cstr(&branch))) < 0) goto cleanup; @@ -217,7 +217,7 @@ static int update_head_to_remote( reflog_message); cleanup: - git_buf_dispose(&remote_master_name); + git_buf_dispose(&remote_branch_name); git_buf_dispose(&branch); return error; |