Skip to content

Commit

Permalink
Merge pull request #10 from pt1602/feature/add-git-pull-to-checkout-b…
Browse files Browse the repository at this point in the history
…utton

feat(checkoutButton): added `&& git pull` at the end
  • Loading branch information
pt1602 authored Mar 22, 2023
2 parents 21e0b5b + 33fddd1 commit ff692bc
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ It adds "git clone" before the repository source.

![Screenshot Git Clone](assets/readme-ressources/gitlab-git-clone.png "Screenshot Git Clone")

and also a _Checkout_ button on the Merge-Request page to copy the branch name plus a _git fetch && git checkout_ before it.
and also a _Checkout_ button on the Merge-Request page to copy the branch name plus a _git fetch && git checkout_ before and _git pull_ after it.

![Screenshot Merge Request](assets/readme-ressources/gitlab-merge-request.png "Screenshot Merge Request")

Expand Down
3 changes: 1 addition & 2 deletions js/frontend.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function createCopyBranchNameButton(branchNameEl) {
cloneBranchNameBtn.innerText = copyNameBtnVal;
if (branchName) {
cloneBranchNameBtn.addEventListener('click', () => {
navigator.clipboard.writeText('git fetch && git checkout ' + branchName).then(() => {
navigator.clipboard.writeText('git fetch && git checkout ' + branchName + ' && git pull').then(() => {
/* success - do nothing */
}, () => {
/* failure - do nothing */
Expand All @@ -35,7 +35,6 @@ if (currentPath.includes('merge_requests/')) {
if (branchNameEl) {
createCopyBranchNameButton(branchNameEl);
clearInterval(checkInterval);
return;
}
}, 300);
}
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Gitlab Git Clone",
"description": "Adds 'git clone' to the ssh/https clone url, so you simply can copy and paste it into your terminal.",
"version": "1.4",
"version": "1.5",
"manifest_version": 3,
"content_scripts": [
{
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gitlab-gitclone",
"version": "1.4.0",
"version": "1.5.0",
"description": "Adds 'git clone' to the ssh/https clone url, so you simply can copy and paste it into your terminal.",
"main": "./js/frontend.js",
"scripts": {
Expand Down
3 changes: 1 addition & 2 deletions ts/frontend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function createCopyBranchNameButton(branchNameEl: HTMLElement) {

if (branchName) {
cloneBranchNameBtn.addEventListener('click', () => {
navigator.clipboard.writeText('git fetch && git checkout ' + branchName).then(
navigator.clipboard.writeText('git fetch && git checkout ' + branchName + ' && git pull').then(
() => {
/* success - do nothing */
},
Expand All @@ -43,7 +43,6 @@ if (currentPath.includes('merge_requests/')) {
if (branchNameEl) {
createCopyBranchNameButton(branchNameEl);
clearInterval(checkInterval);
return;
}
}, 300);
}
Expand Down

0 comments on commit ff692bc

Please sign in to comment.