Skip to content

Commit 0e5625c

Browse files
hhourani27isomorphic-git-bot
authored andcommitted
fix: push tag: do not update remote ref (#1948)
* fix: do not update remote ref when pushing a tag * doc: update push doc
1 parent 06e01b3 commit 0e5625c

File tree

11 files changed

+23
-13
lines changed

11 files changed

+23
-13
lines changed

docs/en/next/push.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
<tr><td><a href="./onPrePush">onPrePush</a></td><td>PrePushCallback</td><td>optional pre-push hook callback</td></tr>
7171
<tr><td>dir</td><td>string</td><td>The <a href="/docs/en/next/dir-vs-gitdir">working tree</a> directory path</td></tr>
7272
<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>
73-
<tr><td>ref</td><td>string</td><td>Which branch to push. By default this is the currently checked out branch.</td></tr>
73+
<tr><td>ref</td><td>string</td><td>Which branch or tag to push. By default this is the currently checked out branch.</td></tr>
7474
<tr><td>url</td><td>string</td><td>The URL of the remote repository. The default is the value set in the git config for that remote.</td></tr>
7575
<tr><td>remote</td><td>string</td><td>If URL is not specified, determines which remote to use.</td></tr>
7676
<tr><td>remoteRef</td><td>string</td><td>The name of the receiving branch on the remote. By default this is the configured remote tracking branch.</td></tr>

docs/en/next/push/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
<tr><td><a href="./onPrePush">onPrePush</a></td><td>PrePushCallback</td><td>optional pre-push hook callback</td></tr>
7171
<tr><td>dir</td><td>string</td><td>The <a href="/docs/en/next/dir-vs-gitdir">working tree</a> directory path</td></tr>
7272
<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>
73-
<tr><td>ref</td><td>string</td><td>Which branch to push. By default this is the currently checked out branch.</td></tr>
73+
<tr><td>ref</td><td>string</td><td>Which branch or tag to push. By default this is the currently checked out branch.</td></tr>
7474
<tr><td>url</td><td>string</td><td>The URL of the remote repository. The default is the value set in the git config for that remote.</td></tr>
7575
<tr><td>remote</td><td>string</td><td>If URL is not specified, determines which remote to use.</td></tr>
7676
<tr><td>remoteRef</td><td>string</td><td>The name of the receiving branch on the remote. By default this is the configured remote tracking branch.</td></tr>

docs/en/push.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
<tr><td><a href="./onPrePush">onPrePush</a></td><td>PrePushCallback</td><td>optional pre-push hook callback</td></tr>
7171
<tr><td>dir</td><td>string</td><td>The <a href="/docs/en/dir-vs-gitdir">working tree</a> directory path</td></tr>
7272
<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>
73-
<tr><td>ref</td><td>string</td><td>Which branch to push. By default this is the currently checked out branch.</td></tr>
73+
<tr><td>ref</td><td>string</td><td>Which branch or tag to push. By default this is the currently checked out branch.</td></tr>
7474
<tr><td>url</td><td>string</td><td>The URL of the remote repository. The default is the value set in the git config for that remote.</td></tr>
7575
<tr><td>remote</td><td>string</td><td>If URL is not specified, determines which remote to use.</td></tr>
7676
<tr><td>remoteRef</td><td>string</td><td>The name of the receiving branch on the remote. By default this is the configured remote tracking branch.</td></tr>

docs/en/push/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
<tr><td><a href="./onPrePush">onPrePush</a></td><td>PrePushCallback</td><td>optional pre-push hook callback</td></tr>
7171
<tr><td>dir</td><td>string</td><td>The <a href="/docs/en/dir-vs-gitdir">working tree</a> directory path</td></tr>
7272
<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>
73-
<tr><td>ref</td><td>string</td><td>Which branch to push. By default this is the currently checked out branch.</td></tr>
73+
<tr><td>ref</td><td>string</td><td>Which branch or tag to push. By default this is the currently checked out branch.</td></tr>
7474
<tr><td>url</td><td>string</td><td>The URL of the remote repository. The default is the value set in the git config for that remote.</td></tr>
7575
<tr><td>remote</td><td>string</td><td>If URL is not specified, determines which remote to use.</td></tr>
7676
<tr><td>remoteRef</td><td>string</td><td>The name of the receiving branch on the remote. By default this is the configured remote tracking branch.</td></tr>

js/isomorphic-git/index.cjs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12473,7 +12473,12 @@ async function _push({
1247312473
}
1247412474

1247512475
// Update the local copy of the remote ref
12476-
if (remote && result.ok && result.refs[fullRemoteRef].ok) {
12476+
if (
12477+
remote &&
12478+
result.ok &&
12479+
result.refs[fullRemoteRef].ok &&
12480+
!fullRef.startsWith('refs/tags')
12481+
) {
1247712482
// TODO: I think this should actually be using a refspec transform rather than assuming 'refs/remotes/{remote}'
1247812483
const ref = `refs/remotes/${remote}/${fullRemoteRef.replace(
1247912484
'refs/heads',
@@ -12520,7 +12525,7 @@ async function _push({
1252012525
* @param {PrePushCallback} [args.onPrePush] - optional pre-push hook callback
1252112526
* @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path
1252212527
* @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path
12523-
* @param {string} [args.ref] - Which branch to push. By default this is the currently checked out branch.
12528+
* @param {string} [args.ref] - Which branch or tag to push. By default this is the currently checked out branch.
1252412529
* @param {string} [args.url] - The URL of the remote repository. The default is the value set in the git config for that remote.
1252512530
* @param {string} [args.remote] - If URL is not specified, determines which remote to use.
1252612531
* @param {string} [args.remoteRef] - The name of the receiving branch on the remote. By default this is the configured remote tracking branch.

js/isomorphic-git/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2463,7 +2463,7 @@ export function pull({ fs: _fs, http, onProgress, onMessage, onAuth, onAuthSucce
24632463
* @param {PrePushCallback} [args.onPrePush] - optional pre-push hook callback
24642464
* @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path
24652465
* @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path
2466-
* @param {string} [args.ref] - Which branch to push. By default this is the currently checked out branch.
2466+
* @param {string} [args.ref] - Which branch or tag to push. By default this is the currently checked out branch.
24672467
* @param {string} [args.url] - The URL of the remote repository. The default is the value set in the git config for that remote.
24682468
* @param {string} [args.remote] - If URL is not specified, determines which remote to use.
24692469
* @param {string} [args.remoteRef] - The name of the receiving branch on the remote. By default this is the configured remote tracking branch.

js/isomorphic-git/index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12467,7 +12467,12 @@ async function _push({
1246712467
}
1246812468

1246912469
// Update the local copy of the remote ref
12470-
if (remote && result.ok && result.refs[fullRemoteRef].ok) {
12470+
if (
12471+
remote &&
12472+
result.ok &&
12473+
result.refs[fullRemoteRef].ok &&
12474+
!fullRef.startsWith('refs/tags')
12475+
) {
1247112476
// TODO: I think this should actually be using a refspec transform rather than assuming 'refs/remotes/{remote}'
1247212477
const ref = `refs/remotes/${remote}/${fullRemoteRef.replace(
1247312478
'refs/heads',
@@ -12514,7 +12519,7 @@ async function _push({
1251412519
* @param {PrePushCallback} [args.onPrePush] - optional pre-push hook callback
1251512520
* @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path
1251612521
* @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path
12517-
* @param {string} [args.ref] - Which branch to push. By default this is the currently checked out branch.
12522+
* @param {string} [args.ref] - Which branch or tag to push. By default this is the currently checked out branch.
1251812523
* @param {string} [args.url] - The URL of the remote repository. The default is the value set in the git config for that remote.
1251912524
* @param {string} [args.remote] - If URL is not specified, determines which remote to use.
1252012525
* @param {string} [args.remoteRef] - The name of the receiving branch on the remote. By default this is the configured remote tracking branch.

js/isomorphic-git/index.umd.min.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2463,7 +2463,7 @@ export function pull({ fs: _fs, http, onProgress, onMessage, onAuth, onAuthSucce
24632463
* @param {PrePushCallback} [args.onPrePush] - optional pre-push hook callback
24642464
* @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path
24652465
* @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path
2466-
* @param {string} [args.ref] - Which branch to push. By default this is the currently checked out branch.
2466+
* @param {string} [args.ref] - Which branch or tag to push. By default this is the currently checked out branch.
24672467
* @param {string} [args.url] - The URL of the remote repository. The default is the value set in the git config for that remote.
24682468
* @param {string} [args.remote] - If URL is not specified, determines which remote to use.
24692469
* @param {string} [args.remoteRef] - The name of the receiving branch on the remote. By default this is the configured remote tracking branch.

js/isomorphic-git/index.umd.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/isomorphic-git/index.umd.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)