Skip to content

Commit c07d020

Browse files
committed
Merge pull request libgit2#2977 from pks-t/submodule-sync-url-fix
Fix git_submodule_sync writing URL to wrong key.
2 parents d675982 + e6903ea commit c07d020

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/submodule.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,10 +1091,10 @@ int git_submodule_sync(git_submodule *sm)
10911091
/* return error from reading submodule config */;
10921092
else if ((error = lookup_head_remote_key(&remote_name, smrepo)) < 0) {
10931093
giterr_clear();
1094-
error = git_buf_sets(&key, "branch.origin.remote");
1094+
error = git_buf_sets(&key, "remote.origin.url");
10951095
} else {
10961096
error = git_buf_join3(
1097-
&key, '.', "branch", remote_name.ptr, "remote");
1097+
&key, '.', "remote", remote_name.ptr, "url");
10981098
git_buf_free(&remote_name);
10991099
}
11001100

tests/submodule/modify.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,11 @@ void test_submodule_modify__sync(void)
118118

119119
/* check that submodule config is updated */
120120
assert_submodule_url_is_synced(
121-
sm1, "submodule."SM1".url", "branch.origin.remote");
121+
sm1, "submodule."SM1".url", "remote.origin.url");
122122
assert_submodule_url_is_synced(
123-
sm2, "submodule."SM2".url", "branch.origin.remote");
123+
sm2, "submodule."SM2".url", "remote.origin.url");
124124
assert_submodule_url_is_synced(
125-
sm3, "submodule."SM3".url", "branch.origin.remote");
125+
sm3, "submodule."SM3".url", "remote.origin.url");
126126

127127
git_submodule_free(sm1);
128128
git_submodule_free(sm2);

0 commit comments

Comments
 (0)