8000 Merge pull request #6981 from libgit2/ethomson/gitlink_newline · libgit2/libgit2@5350142 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5350142

Browse files
authored
Merge pull request #6981 from libgit2/ethomson/gitlink_newline
2 parents 5723964 + a844a6c commit 5350142

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

src/libgit2/repository.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2506,7 +2506,7 @@ static int repo_write_gitlink(
25062506
error = git_fs_path_make_relative(&path_to_repo, in_dir);
25072507

25082508
if (!error)
2509-
error = git_str_join(&buf, ' ', GIT_FILE_CONTENT_PREFIX, path_to_repo.ptr);
2509+
error = git_str_printf(&buf, "%s %s\n", GIT_FILE_CONTENT_PREFIX, path_to_repo.ptr);
25102510

25112511
if (!error)
25122512
error = repo_write_template(in_dir, true, DOT_GIT, 0666, true, buf.ptr);

tests/libgit2/repo/init.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ void test_repo_init__relative_gitdir(void)
489489

490490
/* Verify gitlink */
491491
cl_git_pass(git_futils_readbuffer(&dot_git_content, "root/b/c_wd/.git"));
492-
cl_assert_equal_s("gitdir: ../my_repository/", dot_git_content.ptr);
492+
cl_assert_equal_s("gitdir: ../my_repository/\n", dot_git_content.ptr);
493493

494494
git_str_dispose(&dot_git_content);
495495
cleanup_repository("root");
@@ -526,7 +526,7 @@ void test_repo_init__relative_gitdir_2(void)
526526

527527
/* Verify gitlink */
528528
cl_git_pass(git_futils_readbuffer(&dot_git_content, "root/b/c_wd/.git"));
529-
cl_assert_equal_s("gitdir: ../my_repository/", dot_git_content.ptr);
529+
cl_assert_equal_s("gitdir: ../my_repository/\n", dot_git_content.ptr);
530530

531531
git_str_dispose(&dot_git_content);
532532
cleanup_repository("root");

tests/libgit2/repo/setters.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ void test_repo_setters__setting_a_workdir_creates_a_gitlink(void)
5656

5757
cl_git_pass(git_futils_readbuffer(&content, "./new_workdir/.git"));
5858
cl_assert(git__prefixcmp(git_str_cstr(&content), "gitdir: ") == 0);
59-
cl_assert(git__suffixcmp(git_str_cstr(&content), "testrepo.git/") == 0);
59+
cl_assert(git__suffixcmp(git_str_cstr(&content), "testrepo.git/\n") == 0);
6060
git_str_dispose(&content);
6161

6262
cl_git_pass(git_repository_config(&cfg, repo));

tests/libgit2/submodule/add.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ void test_submodule_add__url_absolute(void)
6060

6161
/* Verify gitdir path is relative */
6262
cl_git_pass(git_futils_readbuffer(&dot_git_content, "submod2/" "sm_libgit2" "/.git"));
63-
cl_assert_equal_s("gitdir: ../.git/modules/sm_libgit2/", dot_git_content.ptr);
63+
cl_assert_equal_s("gitdir: ../.git/modules/sm_libgit2/\n", dot_git_content.ptr);
6464

6565
git_repository_free(repo);
6666
git_str_dispose(&dot_git_content);

tests/libgit2/submodule/repository_init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ void test_submodule_repository_init__basic(void)
2424

2525
/* Verify gitlink */
2626
cl_git_pass(git_futils_readbuffer(&dot_git_content, "submod2/" "sm_gitmodules_only" "/.git"));
27-
cl_assert_equal_s("gitdir: ../.git/modules/sm_gitmodules_only/", dot_git_content.ptr);
27+
cl_assert_equal_s("gitdir: ../.git/modules/sm_gitmodules_only/\n", dot_git_content.ptr);
2828

2929
cl_assert(git_fs_path_isfile("submod2/" "sm_gitmodules_only" "/.git"));
3030

0 commit comments

Comments
 (0)
0