Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e8d5df9

Browse files
carlosmnEdward Thomson
authored and
Edward Thomson
committed
config: show we write a spurious duplicated section header
We should notice that we are in the correct section to add. This is a cosmetic bug, since replacing any of these settings does work.
1 parent b6130fe commit e8d5df9

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/config/write.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,3 +695,27 @@ void test_config_write__locking(void)
695695

696696
git_config_free(cfg);
697697
}
698+
699+
void test_config_write__repeated(void)
700+
{
701+
const char *filename = "config-repeated";
702+
git_config *cfg;
703+
git_buf result;
704+
const char *expected = "[sample \"prefix\"]\n\
705+
\tsetting1 = someValue1\n\
706+
\tsetting2 = someValue2\n\
707+
\tsetting3 = someValue3\n\
708+
\tsetting4 = someValue4\n\
709+
";
710+
cl_git_pass(git_config_open_ondisk(&cfg, filename));
711+
cl_git_pass(git_config_set_string(cfg, "sample.prefix.setting1", "someValue1"));
712+
cl_git_pass(git_config_set_string(cfg, "sample.prefix.setting2", "someValue2"));
713+
cl_git_pass(git_config_set_string(cfg, "sample.prefix.setting3", "someValue3"));
714+
cl_git_pass(git_config_set_string(cfg, "sample.prefix.setting4", "someValue4"));
715+
716+
cl_git_pass(git_config_open_ondisk(&cfg, filename));
717+
718+
cl_git_pass(git_futils_readbuffer(&result, filename));
719+
cl_assert_equal_s(expected, result.ptr);
720+
git_buf_free(&result);
721+
}

0 commit comments

Comments
 (0)