()
| 1075 | |
| 1076 | #[test] |
| 1077 | fn rebase_no_forkpoint() { |
| 1078 | std::env::set_var("LANG", "C"); |
| 1079 | let repo_name = "rebase_no_forkpoint"; |
| 1080 | let repo = setup_git_repo(repo_name); |
| 1081 | let path_to_repo = generate_path_to_repo(repo_name); |
| 1082 | |
| 1083 | { |
| 1084 | // create new file |
| 1085 | create_new_file(&path_to_repo, "hello_world.txt", "Hello, world!"); |
| 1086 | |
| 1087 | // add first commit to master |
| 1088 | first_commit_all(&repo, "first commit"); |
| 1089 | |
| 1090 | assert_eq!(&get_current_branch_name(&repo), "master"); |
| 1091 | }; |
| 1092 | |
| 1093 | // create and checkout new branch named feature_1 |
| 1094 | { |
| 1095 | let branch_name = "feature_1"; |
| 1096 | create_branch(&repo, branch_name); |
| 1097 | checkout_branch(&repo, branch_name); |
| 1098 | }; |
| 1099 | |
| 1100 | { |
| 1101 | assert_eq!(&get_current_branch_name(&repo), "feature_1"); |
| 1102 | |
| 1103 | // create new file |
| 1104 | create_new_file(&path_to_repo, "file_1.txt", "contents 1"); |
| 1105 | |
| 1106 | // add commit to branch feature_1 |
| 1107 | commit_all(&repo, "message"); |
| 1108 | }; |
| 1109 | |
| 1110 | // go back to master branch and add a few commits |
| 1111 | { |
| 1112 | checkout_branch(&repo, "master"); |
| 1113 | |
| 1114 | // create new file |
| 1115 | create_new_file(&path_to_repo, "hello_world2.txt", "Hello, world!"); |
| 1116 | |
| 1117 | // add commit to master |
| 1118 | commit_all(&repo, "hello_world"); |
| 1119 | |
| 1120 | // create new file |
| 1121 | create_new_file(&path_to_repo, "hello_world3.txt", "Hello, world!"); |
| 1122 | |
| 1123 | // add commit to master |
| 1124 | commit_all(&repo, "hello_world"); |
| 1125 | |
| 1126 | assert_eq!(&get_current_branch_name(&repo), "master"); |
| 1127 | }; |
| 1128 | |
| 1129 | // // check out HEAD~2 |
| 1130 | // { |
| 1131 | // let commit = repo |
| 1132 | // .find_commit(repo.head().unwrap().target().unwrap()) |
| 1133 | // .unwrap(); |
| 1134 | // let parent = commit.parent(0).unwrap(); |
nothing calls this directly
no test coverage detected