diff options
author | pontusm <pontus.munck@gmail.com> | 2012-05-13 10:11:13 +0200 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2012-09-06 15:24:03 -0700 |
commit | 52462e1ccecdea86cceae9d25bf343265831bbaf (patch) | |
tree | e43dc1196952d4e57086a11bd479cfc5a97a919a | |
parent | 0e9f2fcef6955a9c15f216ad78eec538cc97a8f3 (diff) | |
download | libgit2-52462e1ccecdea86cceae9d25bf343265831bbaf.tar.gz |
Test case to reproduce issue #690.
Staged file status does not handle CRLF correctly. Ensures that the test repo has core.autocrlf=true for the test to fail.
-rw-r--r-- | tests-clar/status/worktree.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests-clar/status/worktree.c b/tests-clar/status/worktree.c index 75975c988..d4ae48b8d 100644 --- a/tests-clar/status/worktree.c +++ b/tests-clar/status/worktree.c @@ -797,3 +797,30 @@ void test_status_worktree__interruptable_foreach(void) cl_assert_equal_i(8, count); } + +void test_status_worktree__new_staged_file_must_handle_crlf(void) +{ + git_repository *repo; + git_index *index; + git_config *config; + unsigned int status; + + cl_git_pass(git_repository_init(&repo, "getting_started", 0)); + + // Ensure that repo has core.autocrlf=true + cl_git_pass(git_repository_config(&config, repo)); + cl_git_pass(git_config_set_bool(config, "core.autocrlf", true)); + + cl_git_mkfile("getting_started/testfile.txt", "content\r\n"); // Content with CRLF + + cl_git_pass(git_repository_index(&index, repo)); + cl_git_pass(git_index_add(index, "testfile.txt", 0)); + cl_git_pass(git_index_write(index)); + + cl_git_pass(git_status_file(&status, repo, "testfile.txt")); + cl_assert_equal_i(GIT_STATUS_INDEX_NEW, status); + + git_config_free(config); + git_index_free(index); + git_repository_free(repo); +} |