View Javadoc
1   /*
2    * Copyright (C) 2012, IBM Corporation and others. and others
3    *
4    * This program and the accompanying materials are made available under the
5    * terms of the Eclipse Distribution License v. 1.0 which is available at
6    * https://www.eclipse.org/org/documents/edl-v10.php.
7    *
8    * SPDX-License-Identifier: BSD-3-Clause
9    */
10  package org.eclipse.jgit.pgm;
11  
12  import static org.junit.Assert.assertArrayEquals;
13  
14  import org.eclipse.jgit.lib.CLIRepositoryTestCase;
15  import org.junit.Test;
16  
17  public class CommitAndLogTest extends CLIRepositoryTestCase {
18  	@Test
19  	public void testCommitAmend() throws Exception {
20  		assertArrayEquals(new String[] { // commit
21  						"[master 101cffba0364877df1942891eba7f465f628a3d2] first comit", //
22  						"", // amend
23  						"[master d2169869dadf16549be20dcf8c207349d2ed6c62] first commit", //
24  						"", // log
25  						"commit d2169869dadf16549be20dcf8c207349d2ed6c62", //
26  						"Author: GIT_COMMITTER_NAME <GIT_COMMITTER_EMAIL>", //
27  						"Date:   Sat Aug 15 20:12:58 2009 -0330", //
28  						"", //
29  						"    first commit", //
30  						"", //
31  						"" //
32  				}, execute("git commit -m 'first comit'", //
33  						"git commit --amend -m 'first commit'", //
34  						"git log"));
35  	}
36  }