Skip to content

Commit 2be3f8f

Browse files
hhourani27isomorphic-git-bot
authored andcommitted
feat: commit --amend (#1949)
* Add tests a doc for normalizeAuthorObject & normalizeCommitterObject * move normalize fcts from commit api to coommand * add commit param to normalizeAuthorObject * add commit param to normalizeCommitterObject * feat: amend commit * feat: optional message with amend
1 parent 0e5625c commit 2be3f8f

File tree

11 files changed

+602
-314
lines changed

11 files changed

+602
-314
lines changed

docs/en/commit.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
<tr><td><a href="./onSign">onSign</a></td><td>SignCallback</td><td>a PGP signing implementation</td></tr>
6565
<tr><td>dir</td><td>string</td><td>The <a href="/docs/en/dir-vs-gitdir">working tree</a> directory path</td></tr>
6666
<tr><td><strong>gitdir</strong></td><td>string = join(dir,'.git')</td><td>The <a href="/docs/en/dir-vs-gitdir">git directory</a> path</td></tr>
67-
<tr><td><strong>message</strong></td><td>string</td><td>The commit message to use.</td></tr>
67+
<tr><td>message</td><td>string</td><td>The commit message to use. Required, unless <code>amend === true</code></td></tr>
6868
<tr><td>author</td><td>Object</td><td>The details about the author.</td></tr>
6969
<tr><td>author.name</td><td>string</td><td>Default is <code>user.name</code> config.</td></tr>
7070
<tr><td>author.email</td><td>string</td><td>Default is <code>user.email</code> config.</td></tr>
@@ -76,6 +76,7 @@
7676
<tr><td>committer.timestamp</td><td>number = Math.floor(Date.now()/1000)</td><td>Set the committer timestamp field. This is the integer number of seconds since the Unix epoch (1970-01-01 00:00:00).</td></tr>
7777
<tr><td>committer.timezoneOffset</td><td>number</td><td>Set the committer timezone offset field. This is the difference, in minutes, from the current timezone to UTC. Default is <code>(new Date()).getTimezoneOffset()</code>.</td></tr>
7878
<tr><td>signingKey</td><td>string</td><td>Sign the tag object using this private PGP key.</td></tr>
79+
<tr><td>amend</td><td>boolean = false</td><td>If true, replaces the last commit pointed to by <code>ref</code> with a new commit.</td></tr>
7980
<tr><td>dryRun</td><td>boolean = false</td><td>If true, simulates making a commit so you can test whether it would succeed. Implies <code>noUpdateBranch</code>.</td></tr>
8081
<tr><td>noUpdateBranch</td><td>boolean = false</td><td>If true, does not update the branch pointer after creating the commit.</td></tr>
8182
<tr><td>ref</td><td>string</td><td>The fully expanded name of the branch to commit to. Default is the current branch pointed to by HEAD. (TODO: fix it so it can expand branch names without throwing if the branch doesn't exist yet.)</td></tr>

docs/en/commit/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
<tr><td><a href="./onSign">onSign</a></td><td>SignCallback</td><td>a PGP signing implementation</td></tr>
6565
<tr><td>dir</td><td>string</td><td>The <a href="/docs/en/dir-vs-gitdir">working tree</a> directory path</td></tr>
6666
<tr><td><strong>gitdir</strong></td><td>string = join(dir,'.git')</td><td>The <a href="/docs/en/dir-vs-gitdir">git directory</a> path</td></tr>
67-
<tr><td><strong>message</strong></td><td>string</td><td>The commit message to use.</td></tr>
67+
<tr><td>message</td><td>string</td><td>The commit message to use. Required, unless <code>amend === true</code></td></tr>
6868
<tr><td>author</td><td>Object</td><td>The details about the author.</td></tr>
6969
<tr><td>author.name</td><td>string</td><td>Default is <code>user.name</code> config.</td></tr>
7070
<tr><td>author.email</td><td>string</td><td>Default is <code>user.email</code> config.</td></tr>
@@ -76,6 +76,7 @@
7676
<tr><td>committer.timestamp</td><td>number = Math.floor(Date.now()/1000)</td><td>Set the committer timestamp field. This is the integer number of seconds since the Unix epoch (1970-01-01 00:00:00).</td></tr>
7777
<tr><td>committer.timezoneOffset</td><td>number</td><td>Set the committer timezone offset field. This is the difference, in minutes, from the current timezone to UTC. Default is <code>(new Date()).getTimezoneOffset()</code>.</td></tr>
7878
<tr><td>signingKey</td><td>string</td><td>Sign the tag object using this private PGP key.</td></tr>
79+
<tr><td>amend</td><td>boolean = false</td><td>If true, replaces the last commit pointed to by <code>ref</code> with a new commit.</td></tr>
7980
<tr><td>dryRun</td><td>boolean = false</td><td>If true, simulates making a commit so you can test whether it would succeed. Implies <code>noUpdateBranch</code>.</td></tr>
8081
<tr><td>noUpdateBranch</td><td>boolean = false</td><td>If true, does not update the branch pointer after creating the commit.</td></tr>
8182
<tr><td>ref</td><td>string</td><td>The fully expanded name of the branch to commit to. Default is the current branch pointed to by HEAD. (TODO: fix it so it can expand branch names without throwing if the branch doesn't exist yet.)</td></tr>

docs/en/next/commit.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
<tr><td><a href="./onSign">onSign</a></td><td>SignCallback</td><td>a PGP signing implementation</td></tr>
6565
<tr><td>dir</td><td>string</td><td>The <a href="/docs/en/next/dir-vs-gitdir">working tree</a> directory path</td></tr>
6666
<tr><td><strong>gitdir</strong></td><td>string = join(dir,'.git')</td><td>The <a href="/docs/en/next/dir-vs-gitdir">git directory</a> path</td></tr>
67-
<tr><td><strong>message</strong></td><td>string</td><td>The commit message to use.</td></tr>
67+
<tr><td>message</td><td>string</td><td>The commit message to use. Required, unless <code>amend === true</code></td></tr>
6868
<tr><td>author</td><td>Object</td><td>The details about the author.</td></tr>
6969
<tr><td>author.name</td><td>string</td><td>Default is <code>user.name</code> config.</td></tr>
7070
<tr><td>author.email</td><td>string</td><td>Default is <code>user.email</code> config.</td></tr>
@@ -76,6 +76,7 @@
7676
<tr><td>committer.timestamp</td><td>number = Math.floor(Date.now()/1000)</td><td>Set the committer timestamp field. This is the integer number of seconds since the Unix epoch (1970-01-01 00:00:00).</td></tr>
7777
<tr><td>committer.timezoneOffset</td><td>number</td><td>Set the committer timezone offset field. This is the difference, in minutes, from the current timezone to UTC. Default is <code>(new Date()).getTimezoneOffset()</code>.</td></tr>
7878
<tr><td>signingKey</td><td>string</td><td>Sign the tag object using this private PGP key.</td></tr>
79+
<tr><td>amend</td><td>boolean = false</td><td>If true, replaces the last commit pointed to by <code>ref</code> with a new commit.</td></tr>
7980
<tr><td>dryRun</td><td>boolean = false</td><td>If true, simulates making a commit so you can test whether it would succeed. Implies <code>noUpdateBranch</code>.</td></tr>
8081
<tr><td>noUpdateBranch</td><td>boolean = false</td><td>If true, does not update the branch pointer after creating the commit.</td></tr>
8182
<tr><td>ref</td><td>string</td><td>The fully expanded name of the branch to commit to. Default is the current branch pointed to by HEAD. (TODO: fix it so it can expand branch names without throwing if the branch doesn't exist yet.)</td></tr>

docs/en/next/commit/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
<tr><td><a href="./onSign">onSign</a></td><td>SignCallback</td><td>a PGP signing implementation</td></tr>
6565
<tr><td>dir</td><td>string</td><td>The <a href="/docs/en/next/dir-vs-gitdir">working tree</a> directory path</td></tr>
6666
<tr><td><strong>gitdir</strong></td><td>string = join(dir,'.git')</td><td>The <a href="/docs/en/next/dir-vs-gitdir">git directory</a> path</td></tr>
67-
<tr><td><strong>message</strong></td><td>string</td><td>The commit message to use.</td></tr>
67+
<tr><td>message</td><td>string</td><td>The commit message to use. Required, unless <code>amend === true</code></td></tr>
6868
<tr><td>author</td><td>Object</td><td>The details about the author.</td></tr>
6969
<tr><td>author.name</td><td>string</td><td>Default is <code>user.name</code> config.</td></tr>
7070
<tr><td>author.email</td><td>string</td><td>Default is <code>user.email</code> config.</td></tr>
@@ -76,6 +76,7 @@
7676
<tr><td>committer.timestamp</td><td>number = Math.floor(Date.now()/1000)</td><td>Set the committer timestamp field. This is the integer number of seconds since the Unix epoch (1970-01-01 00:00:00).</td></tr>
7777
<tr><td>committer.timezoneOffset</td><td>number</td><td>Set the committer timezone offset field. This is the difference, in minutes, from the current timezone to UTC. Default is <code>(new Date()).getTimezoneOffset()</code>.</td></tr>
7878
<tr><td>signingKey</td><td>string</td><td>Sign the tag object using this private PGP key.</td></tr>
79+
<tr><td>amend</td><td>boolean = false</td><td>If true, replaces the last commit pointed to by <code>ref</code> with a new commit.</td></tr>
7980
<tr><td>dryRun</td><td>boolean = false</td><td>If true, simulates making a commit so you can test whether it would succeed. Implies <code>noUpdateBranch</code>.</td></tr>
8081
<tr><td>noUpdateBranch</td><td>boolean = false</td><td>If true, does not update the branch pointer after creating the commit.</td></tr>
8182
<tr><td>ref</td><td>string</td><td>The fully expanded name of the branch to commit to. Default is the current branch pointed to by HEAD. (TODO: fix it so it can expand branch names without throwing if the branch doesn't exist yet.)</td></tr>

0 commit comments

Comments
 (0)