Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

BlameCommandTest.java 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562
  1. /*
  2. * Copyright (C) 2011, GitHub Inc.
  3. * and other copyright owners as documented in the project's IP log.
  4. *
  5. * This program and the accompanying materials are made available
  6. * under the terms of the Eclipse Distribution License v1.0 which
  7. * accompanies this distribution, is reproduced below, and is
  8. * available at http://www.eclipse.org/org/documents/edl-v10.php
  9. *
  10. * All rights reserved.
  11. *
  12. * Redistribution and use in source and binary forms, with or
  13. * without modification, are permitted provided that the following
  14. * conditions are met:
  15. *
  16. * - Redistributions of source code must retain the above copyright
  17. * notice, this list of conditions and the following disclaimer.
  18. *
  19. * - Redistributions in binary form must reproduce the above
  20. * copyright notice, this list of conditions and the following
  21. * disclaimer in the documentation and/or other materials provided
  22. * with the distribution.
  23. *
  24. * - Neither the name of the Eclipse Foundation, Inc. nor the
  25. * names of its contributors may be used to endorse or promote
  26. * products derived from this software without specific prior
  27. * written permission.
  28. *
  29. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
  30. * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
  31. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  32. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  33. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  34. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  35. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  36. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  37. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  38. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  39. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  40. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  41. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  42. */
  43. package org.eclipse.jgit.api;
  44. import static org.junit.Assert.assertEquals;
  45. import static org.junit.Assert.assertNotNull;
  46. import static org.junit.Assert.assertTrue;
  47. import java.io.File;
  48. import org.eclipse.jgit.api.MergeCommand.FastForwardMode;
  49. import org.eclipse.jgit.api.ResetCommand.ResetType;
  50. import org.eclipse.jgit.blame.BlameResult;
  51. import org.eclipse.jgit.diff.RawTextComparator;
  52. import org.eclipse.jgit.junit.RepositoryTestCase;
  53. import org.eclipse.jgit.lib.ConfigConstants;
  54. import org.eclipse.jgit.lib.CoreConfig.AutoCRLF;
  55. import org.eclipse.jgit.revwalk.RevCommit;
  56. import org.eclipse.jgit.storage.file.FileBasedConfig;
  57. import org.junit.Test;
  58. /**
  59. * Unit tests of {@link BlameCommand}
  60. */
  61. public class BlameCommandTest extends RepositoryTestCase {
  62. private static String join(String... lines) {
  63. StringBuilder joined = new StringBuilder();
  64. for (String line : lines)
  65. joined.append(line).append('\n');
  66. return joined.toString();
  67. }
  68. @Test
  69. public void testSingleRevision() throws Exception {
  70. try (Git git = new Git(db)) {
  71. String[] content = new String[] { "first", "second", "third" };
  72. writeTrashFile("file.txt", join(content));
  73. git.add().addFilepattern("file.txt").call();
  74. RevCommit commit = git.commit().setMessage("create file").call();
  75. BlameCommand command = new BlameCommand(db);
  76. command.setFilePath("file.txt");
  77. BlameResult lines = command.call();
  78. assertNotNull(lines);
  79. assertEquals(3, lines.getResultContents().size());
  80. for (int i = 0; i < 3; i++) {
  81. assertEquals(commit, lines.getSourceCommit(i));
  82. assertEquals(i, lines.getSourceLine(i));
  83. }
  84. }
  85. }
  86. @Test
  87. public void testTwoRevisions() throws Exception {
  88. try (Git git = new Git(db)) {
  89. String[] content1 = new String[] { "first", "second" };
  90. writeTrashFile("file.txt", join(content1));
  91. git.add().addFilepattern("file.txt").call();
  92. RevCommit commit1 = git.commit().setMessage("create file").call();
  93. String[] content2 = new String[] { "first", "second", "third" };
  94. writeTrashFile("file.txt", join(content2));
  95. git.add().addFilepattern("file.txt").call();
  96. RevCommit commit2 = git.commit().setMessage("create file").call();
  97. BlameCommand command = new BlameCommand(db);
  98. command.setFilePath("file.txt");
  99. BlameResult lines = command.call();
  100. assertEquals(3, lines.getResultContents().size());
  101. assertEquals(commit1, lines.getSourceCommit(0));
  102. assertEquals(0, lines.getSourceLine(0));
  103. assertEquals(commit1, lines.getSourceCommit(1));
  104. assertEquals(1, lines.getSourceLine(1));
  105. assertEquals(commit2, lines.getSourceCommit(2));
  106. assertEquals(2, lines.getSourceLine(2));
  107. }
  108. }
  109. @Test
  110. public void testRename() throws Exception {
  111. testRename("file1.txt", "file2.txt");
  112. }
  113. @Test
  114. public void testRenameInSubDir() throws Exception {
  115. testRename("subdir/file1.txt", "subdir/file2.txt");
  116. }
  117. @Test
  118. public void testMoveToOtherDir() throws Exception {
  119. testRename("subdir/file1.txt", "otherdir/file1.txt");
  120. }
  121. private void testRename(String sourcePath, String destPath)
  122. throws Exception {
  123. try (Git git = new Git(db)) {
  124. String[] content1 = new String[] { "a", "b", "c" };
  125. writeTrashFile(sourcePath, join(content1));
  126. git.add().addFilepattern(sourcePath).call();
  127. RevCommit commit1 = git.commit().setMessage("create file").call();
  128. writeTrashFile(destPath, join(content1));
  129. git.add().addFilepattern(destPath).call();
  130. git.rm().addFilepattern(sourcePath).call();
  131. git.commit().setMessage("moving file").call();
  132. String[] content2 = new String[] { "a", "b", "c2" };
  133. writeTrashFile(destPath, join(content2));
  134. git.add().addFilepattern(destPath).call();
  135. RevCommit commit3 = git.commit().setMessage("editing file").call();
  136. BlameCommand command = new BlameCommand(db);
  137. command.setFollowFileRenames(true);
  138. command.setFilePath(destPath);
  139. BlameResult lines = command.call();
  140. assertEquals(commit1, lines.getSourceCommit(0));
  141. assertEquals(0, lines.getSourceLine(0));
  142. assertEquals(sourcePath, lines.getSourcePath(0));
  143. assertEquals(commit1, lines.getSourceCommit(1));
  144. assertEquals(1, lines.getSourceLine(1));
  145. assertEquals(sourcePath, lines.getSourcePath(1));
  146. assertEquals(commit3, lines.getSourceCommit(2));
  147. assertEquals(2, lines.getSourceLine(2));
  148. assertEquals(destPath, lines.getSourcePath(2));
  149. }
  150. }
  151. @Test
  152. public void testTwoRenames() throws Exception {
  153. try (Git git = new Git(db)) {
  154. // Commit 1: Add file.txt
  155. String[] content1 = new String[] { "a" };
  156. writeTrashFile("file.txt", join(content1));
  157. git.add().addFilepattern("file.txt").call();
  158. RevCommit commit1 = git.commit().setMessage("create file").call();
  159. // Commit 2: Rename to file1.txt
  160. writeTrashFile("file1.txt", join(content1));
  161. git.add().addFilepattern("file1.txt").call();
  162. git.rm().addFilepattern("file.txt").call();
  163. git.commit().setMessage("moving file").call();
  164. // Commit 3: Edit file1.txt
  165. String[] content2 = new String[] { "a", "b" };
  166. writeTrashFile("file1.txt", join(content2));
  167. git.add().addFilepattern("file1.txt").call();
  168. RevCommit commit3 = git.commit().setMessage("editing file").call();
  169. // Commit 4: Rename to file2.txt
  170. writeTrashFile("file2.txt", join(content2));
  171. git.add().addFilepattern("file2.txt").call();
  172. git.rm().addFilepattern("file1.txt").call();
  173. git.commit().setMessage("moving file again").call();
  174. BlameCommand command = new BlameCommand(db);
  175. command.setFollowFileRenames(true);
  176. command.setFilePath("file2.txt");
  177. BlameResult lines = command.call();
  178. assertEquals(commit1, lines.getSourceCommit(0));
  179. assertEquals(0, lines.getSourceLine(0));
  180. assertEquals("file.txt", lines.getSourcePath(0));
  181. assertEquals(commit3, lines.getSourceCommit(1));
  182. assertEquals(1, lines.getSourceLine(1));
  183. assertEquals("file1.txt", lines.getSourcePath(1));
  184. }
  185. }
  186. @Test
  187. public void testDeleteTrailingLines() throws Exception {
  188. try (Git git = new Git(db)) {
  189. String[] content1 = new String[] { "a", "b", "c", "d" };
  190. String[] content2 = new String[] { "a", "b" };
  191. writeTrashFile("file.txt", join(content2));
  192. git.add().addFilepattern("file.txt").call();
  193. RevCommit commit1 = git.commit().setMessage("create file").call();
  194. writeTrashFile("file.txt", join(content1));
  195. git.add().addFilepattern("file.txt").call();
  196. git.commit().setMessage("edit file").call();
  197. writeTrashFile("file.txt", join(content2));
  198. git.add().addFilepattern("file.txt").call();
  199. git.commit().setMessage("edit file").call();
  200. BlameCommand command = new BlameCommand(db);
  201. command.setFilePath("file.txt");
  202. BlameResult lines = command.call();
  203. assertEquals(content2.length, lines.getResultContents().size());
  204. assertEquals(commit1, lines.getSourceCommit(0));
  205. assertEquals(commit1, lines.getSourceCommit(1));
  206. assertEquals(0, lines.getSourceLine(0));
  207. assertEquals(1, lines.getSourceLine(1));
  208. }
  209. }
  210. @Test
  211. public void testDeleteMiddleLines() throws Exception {
  212. try (Git git = new Git(db)) {
  213. String[] content1 = new String[] { "a", "b", "c", "d", "e" };
  214. String[] content2 = new String[] { "a", "c", "e" };
  215. writeTrashFile("file.txt", join(content2));
  216. git.add().addFilepattern("file.txt").call();
  217. RevCommit commit1 = git.commit().setMessage("edit file").call();
  218. writeTrashFile("file.txt", join(content1));
  219. git.add().addFilepattern("file.txt").call();
  220. git.commit().setMessage("edit file").call();
  221. writeTrashFile("file.txt", join(content2));
  222. git.add().addFilepattern("file.txt").call();
  223. git.commit().setMessage("edit file").call();
  224. BlameCommand command = new BlameCommand(db);
  225. command.setFilePath("file.txt");
  226. BlameResult lines = command.call();
  227. assertEquals(content2.length, lines.getResultContents().size());
  228. assertEquals(commit1, lines.getSourceCommit(0));
  229. assertEquals(0, lines.getSourceLine(0));
  230. assertEquals(commit1, lines.getSourceCommit(1));
  231. assertEquals(1, lines.getSourceLine(1));
  232. assertEquals(commit1, lines.getSourceCommit(2));
  233. assertEquals(2, lines.getSourceLine(2));
  234. }
  235. }
  236. @Test
  237. public void testEditAllLines() throws Exception {
  238. try (Git git = new Git(db)) {
  239. String[] content1 = new String[] { "a", "1" };
  240. String[] content2 = new String[] { "b", "2" };
  241. writeTrashFile("file.txt", join(content1));
  242. git.add().addFilepattern("file.txt").call();
  243. git.commit().setMessage("edit file").call();
  244. writeTrashFile("file.txt", join(content2));
  245. git.add().addFilepattern("file.txt").call();
  246. RevCommit commit2 = git.commit().setMessage("create file").call();
  247. BlameCommand command = new BlameCommand(db);
  248. command.setFilePath("file.txt");
  249. BlameResult lines = command.call();
  250. assertEquals(content2.length, lines.getResultContents().size());
  251. assertEquals(commit2, lines.getSourceCommit(0));
  252. assertEquals(commit2, lines.getSourceCommit(1));
  253. }
  254. }
  255. @Test
  256. public void testMiddleClearAllLines() throws Exception {
  257. try (Git git = new Git(db)) {
  258. String[] content1 = new String[] { "a", "b", "c" };
  259. writeTrashFile("file.txt", join(content1));
  260. git.add().addFilepattern("file.txt").call();
  261. git.commit().setMessage("edit file").call();
  262. writeTrashFile("file.txt", "");
  263. git.add().addFilepattern("file.txt").call();
  264. git.commit().setMessage("create file").call();
  265. writeTrashFile("file.txt", join(content1));
  266. git.add().addFilepattern("file.txt").call();
  267. RevCommit commit3 = git.commit().setMessage("edit file").call();
  268. BlameCommand command = new BlameCommand(db);
  269. command.setFilePath("file.txt");
  270. BlameResult lines = command.call();
  271. assertEquals(content1.length, lines.getResultContents().size());
  272. assertEquals(commit3, lines.getSourceCommit(0));
  273. assertEquals(commit3, lines.getSourceCommit(1));
  274. assertEquals(commit3, lines.getSourceCommit(2));
  275. }
  276. }
  277. @Test
  278. public void testCoreAutoCrlf1() throws Exception {
  279. testCoreAutoCrlf(AutoCRLF.INPUT, AutoCRLF.FALSE);
  280. }
  281. @Test
  282. public void testCoreAutoCrlf2() throws Exception {
  283. testCoreAutoCrlf(AutoCRLF.FALSE, AutoCRLF.FALSE);
  284. }
  285. @Test
  286. public void testCoreAutoCrlf3() throws Exception {
  287. testCoreAutoCrlf(AutoCRLF.INPUT, AutoCRLF.INPUT);
  288. }
  289. @Test
  290. public void testCoreAutoCrlf4() throws Exception {
  291. testCoreAutoCrlf(AutoCRLF.FALSE, AutoCRLF.INPUT);
  292. }
  293. @Test
  294. public void testCoreAutoCrlf5() throws Exception {
  295. testCoreAutoCrlf(AutoCRLF.INPUT, AutoCRLF.TRUE);
  296. }
  297. private void testCoreAutoCrlf(AutoCRLF modeForCommitting,
  298. AutoCRLF modeForReset) throws Exception {
  299. try (Git git = new Git(db)) {
  300. FileBasedConfig config = db.getConfig();
  301. config.setEnum(ConfigConstants.CONFIG_CORE_SECTION, null,
  302. ConfigConstants.CONFIG_KEY_AUTOCRLF, modeForCommitting);
  303. config.save();
  304. String joinedCrlf = "a\r\nb\r\nc\r\n";
  305. File trashFile = writeTrashFile("file.txt", joinedCrlf);
  306. git.add().addFilepattern("file.txt").call();
  307. RevCommit commit = git.commit().setMessage("create file").call();
  308. // re-create file from the repo
  309. trashFile.delete();
  310. config.setEnum(ConfigConstants.CONFIG_CORE_SECTION, null,
  311. ConfigConstants.CONFIG_KEY_AUTOCRLF, modeForReset);
  312. config.save();
  313. git.reset().setMode(ResetType.HARD).call();
  314. BlameCommand command = new BlameCommand(db);
  315. command.setFilePath("file.txt");
  316. BlameResult lines = command.call();
  317. assertEquals(3, lines.getResultContents().size());
  318. assertEquals(commit, lines.getSourceCommit(0));
  319. assertEquals(commit, lines.getSourceCommit(1));
  320. assertEquals(commit, lines.getSourceCommit(2));
  321. }
  322. }
  323. @Test
  324. public void testConflictingMerge1() throws Exception {
  325. try (Git git = new Git(db)) {
  326. RevCommit base = commitFile("file.txt", join("0", "1", "2", "3", "4"),
  327. "master");
  328. git.checkout().setName("side").setCreateBranch(true)
  329. .setStartPoint(base).call();
  330. RevCommit side = commitFile("file.txt",
  331. join("0", "1 side", "2", "3 on side", "4"), "side");
  332. commitFile("file.txt", join("0", "1", "2"), "master");
  333. checkoutBranch("refs/heads/master");
  334. git.merge().include(side).call();
  335. // The merge results in a conflict, which we resolve using mostly the
  336. // side branch contents. Especially the "4" survives.
  337. RevCommit merge = commitFile("file.txt",
  338. join("0", "1 side", "2", "3 resolved", "4"), "master");
  339. BlameCommand command = new BlameCommand(db);
  340. command.setFilePath("file.txt");
  341. BlameResult lines = command.call();
  342. assertEquals(5, lines.getResultContents().size());
  343. assertEquals(base, lines.getSourceCommit(0));
  344. assertEquals(side, lines.getSourceCommit(1));
  345. assertEquals(base, lines.getSourceCommit(2));
  346. assertEquals(merge, lines.getSourceCommit(3));
  347. assertEquals(base, lines.getSourceCommit(4));
  348. }
  349. }
  350. // this test inverts the order of the master and side commit and is
  351. // otherwise identical to testConflictingMerge1
  352. @Test
  353. public void testConflictingMerge2() throws Exception {
  354. try (Git git = new Git(db)) {
  355. RevCommit base = commitFile("file.txt", join("0", "1", "2", "3", "4"),
  356. "master");
  357. commitFile("file.txt", join("0", "1", "2"), "master");
  358. git.checkout().setName("side").setCreateBranch(true)
  359. .setStartPoint(base).call();
  360. RevCommit side = commitFile("file.txt",
  361. join("0", "1 side", "2", "3 on side", "4"), "side");
  362. checkoutBranch("refs/heads/master");
  363. git.merge().include(side).call();
  364. // The merge results in a conflict, which we resolve using mostly the
  365. // side branch contents. Especially the "4" survives.
  366. RevCommit merge = commitFile("file.txt",
  367. join("0", "1 side", "2", "3 resolved", "4"), "master");
  368. BlameCommand command = new BlameCommand(db);
  369. command.setFilePath("file.txt");
  370. BlameResult lines = command.call();
  371. assertEquals(5, lines.getResultContents().size());
  372. assertEquals(base, lines.getSourceCommit(0));
  373. assertEquals(side, lines.getSourceCommit(1));
  374. assertEquals(base, lines.getSourceCommit(2));
  375. assertEquals(merge, lines.getSourceCommit(3));
  376. assertEquals(base, lines.getSourceCommit(4));
  377. }
  378. }
  379. @Test
  380. public void testWhitespaceMerge() throws Exception {
  381. try (Git git = new Git(db)) {
  382. RevCommit base = commitFile("file.txt", join("0", "1", "2"), "master");
  383. RevCommit side = commitFile("file.txt", join("0", "1", " 2 side "),
  384. "side");
  385. checkoutBranch("refs/heads/master");
  386. git.merge().setFastForward(FastForwardMode.NO_FF).include(side).call();
  387. // change whitespace, so the merge content is not identical to side, but
  388. // is the same when ignoring whitespace
  389. writeTrashFile("file.txt", join("0", "1", "2 side"));
  390. RevCommit merge = git.commit().setAll(true).setMessage("merge")
  391. .setAmend(true)
  392. .call();
  393. BlameCommand command = new BlameCommand(db);
  394. command.setFilePath("file.txt")
  395. .setTextComparator(RawTextComparator.WS_IGNORE_ALL)
  396. .setStartCommit(merge.getId());
  397. BlameResult lines = command.call();
  398. assertEquals(3, lines.getResultContents().size());
  399. assertEquals(base, lines.getSourceCommit(0));
  400. assertEquals(base, lines.getSourceCommit(1));
  401. assertEquals(side, lines.getSourceCommit(2));
  402. }
  403. }
  404. @Test
  405. public void testBlameWithNulByteInHistory() throws Exception {
  406. try (Git git = new Git(db)) {
  407. String[] content1 = { "First line", "Another line" };
  408. writeTrashFile("file.txt", join(content1));
  409. git.add().addFilepattern("file.txt").call();
  410. RevCommit c1 = git.commit().setMessage("create file").call();
  411. String[] content2 = { "First line", "Second line with NUL >\000<",
  412. "Another line" };
  413. assertTrue("Content should contain a NUL byte",
  414. content2[1].indexOf(0) > 0);
  415. writeTrashFile("file.txt", join(content2));
  416. git.add().addFilepattern("file.txt").call();
  417. git.commit().setMessage("add line with NUL").call();
  418. String[] content3 = { "First line", "Second line with NUL >\000<",
  419. "Third line" };
  420. writeTrashFile("file.txt", join(content3));
  421. git.add().addFilepattern("file.txt").call();
  422. RevCommit c3 = git.commit().setMessage("change third line").call();
  423. String[] content4 = { "First line", "Second line with NUL >\\000<",
  424. "Third line" };
  425. assertTrue("Content should not contain a NUL byte",
  426. content4[1].indexOf(0) < 0);
  427. writeTrashFile("file.txt", join(content4));
  428. git.add().addFilepattern("file.txt").call();
  429. RevCommit c4 = git.commit().setMessage("fix NUL line").call();
  430. BlameResult lines = git.blame().setFilePath("file.txt").call();
  431. assertEquals(3, lines.getResultContents().size());
  432. assertEquals(c1, lines.getSourceCommit(0));
  433. assertEquals(c4, lines.getSourceCommit(1));
  434. assertEquals(c3, lines.getSourceCommit(2));
  435. }
  436. }
  437. @Test
  438. public void testBlameWithNulByteInTopRevision() throws Exception {
  439. try (Git git = new Git(db)) {
  440. String[] content1 = { "First line", "Another line" };
  441. writeTrashFile("file.txt", join(content1));
  442. git.add().addFilepattern("file.txt").call();
  443. RevCommit c1 = git.commit().setMessage("create file").call();
  444. String[] content2 = { "First line", "Second line with NUL >\000<",
  445. "Another line" };
  446. assertTrue("Content should contain a NUL byte",
  447. content2[1].indexOf(0) > 0);
  448. writeTrashFile("file.txt", join(content2));
  449. git.add().addFilepattern("file.txt").call();
  450. RevCommit c2 = git.commit().setMessage("add line with NUL").call();
  451. String[] content3 = { "First line", "Second line with NUL >\000<",
  452. "Third line" };
  453. writeTrashFile("file.txt", join(content3));
  454. git.add().addFilepattern("file.txt").call();
  455. RevCommit c3 = git.commit().setMessage("change third line").call();
  456. BlameResult lines = git.blame().setFilePath("file.txt").call();
  457. assertEquals(3, lines.getResultContents().size());
  458. assertEquals(c1, lines.getSourceCommit(0));
  459. assertEquals(c2, lines.getSourceCommit(1));
  460. assertEquals(c3, lines.getSourceCommit(2));
  461. }
  462. }
  463. }