Skip to content

Commit cd2f74d

Browse files
committed
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".
1 parent 471ed79 commit cd2f74d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/clone.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ static int update_head_to_remote(
172172
git_refspec *refspec;
173173
const git_remote_head *remote_head, **refs;
174174
const git_oid *remote_head_id;
175-
git_buf remote_master_name = GIT_BUF_INIT;
175+
git_buf remote_branch_name = GIT_BUF_INIT;
176176
git_buf branch = GIT_BUF_INIT;
177177

178178
if ((error = git_remote_ls(&refs, &refs_len, remote)) < 0)
@@ -203,9 +203,9 @@ static int update_head_to_remote(
203203
goto cleanup;
204204
}
205205

206-
/* Determine the remote tracking reference name from the local master */
206+
/* Determine the remote tracking ref name from the local branch */
207207
if ((error = git_refspec_transform(
208-
&remote_master_name,
208+
&remote_branch_name,
209209
refspec,
210210
git_buf_cstr(&branch))) < 0)
211211
goto cleanup;
@@ -217,7 +217,7 @@ static int update_head_to_remote(
217217
reflog_message);
218218

219219
cleanup:
220-
git_buf_dispose(&remote_master_name);
220+
git_buf_dispose(&remote_branch_name);
221221
git_buf_dispose(&branch);
222222

223223
return error;

0 commit comments

Comments
 (0)