Skip to content

Fix PR #3598 : Auto init non-git repository (part 2)#3599

Merged
mittalyashu merged 7 commits intogitthermal:chore/add-nodegitfrom
KaKi87:chore/add-nodegit
Jan 22, 2020
Merged

Fix PR #3598 : Auto init non-git repository (part 2)#3599
mittalyashu merged 7 commits intogitthermal:chore/add-nodegitfrom
KaKi87:chore/add-nodegit

Conversation

@KaKi87
Copy link
Copy Markdown
Contributor

@KaKi87 KaKi87 commented Dec 25, 2019

Fixes #3598

@KaKi87 KaKi87 changed the title Chore/add nodegit Fix PR #3598 : Auto init non-git repository (part 2) Dec 25, 2019
@mittalyashu
Copy link
Copy Markdown
Member

mittalyashu commented Dec 31, 2019

I tested the fix locally on my machine.

Seems like everything is working fine, except the button status is not getting updated when autoInit is enabled.

Please see this video.

@mittalyashu mittalyashu added this to the 0.1.0 milestone Dec 31, 2019
@KaKi87
Copy link
Copy Markdown
Contributor Author

KaKi87 commented Dec 31, 2019

I see. However, this is out of this PR's scope.
Could you please merge this one and close #3598 then I'll be working on a fix for this button ?
Thanks

@mittalyashu
Copy link
Copy Markdown
Member

That button issue is surely a part of this PR, could you please add a fix for the same.

@KaKi87
Copy link
Copy Markdown
Contributor Author

KaKi87 commented Jan 1, 2020

The bug you're describing predates this PR.

@mittalyashu
Copy link
Copy Markdown
Member

I understand what you mean, that this PR title describes to add feature to auto-initialise the git repository, in addition to that initialising the git repository from button is also a part of it.

Copy link
Copy Markdown
Member

@mittalyashu mittalyashu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KaKi87 Can you please look into these changes, after then I think we're good with merging it.

if (!repository && autoInitFeature) {
gitInit({ path });
}
this.newRepository.isGitRepo = !!repository;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
this.newRepository.isGitRepo = !!repository;
this.newRepository.isGitRepo = true;

Copy link
Copy Markdown
Member

@mittalyashu mittalyashu Jan 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried few ways to get the Repository {} object, seems like it not working. So for now we go with hard-coded true value.

Not the best option, I know, but I will look into improving the gitInit() API further.

async gitInit(path) {
await gitInit({ path });
this.addRepositoryToDatabase(path);
this.addRepositoryToDatabase(repositoryPath);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
this.addRepositoryToDatabase(repositoryPath);
this.addRepositoryToDatabase(repositoryPath);

Can you move this before closing the modal?

{ $repositoryId: this.repositoryId },
(err, data) => {
if (err) console.log(err);
else this.isGit = 1;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
else this.isGit = 1;
else this.queryAllRepository();

Also, don't forget to import the required mixin for the same.

@KaKi87
Copy link
Copy Markdown
Contributor Author

KaKi87 commented Jan 18, 2020

@KaKi87 Can you please look into these changes, after then I think we're good with merging it.

Again, your changes request would only be justified if my PR was creating regressions, which is not the case.

Please let's work step-by-step.

@mittalyashu mittalyashu merged commit cfd8cab into gitthermal:chore/add-nodegit Jan 22, 2020
@KaKi87
Copy link
Copy Markdown
Contributor Author

KaKi87 commented Jan 22, 2020

Finally.
I'll start working on the several issues you talked about.

@KaKi87 KaKi87 deleted the chore/add-nodegit branch January 22, 2020 14:31
@KaKi87 KaKi87 restored the chore/add-nodegit branch January 22, 2020 14:31
mittalyashu added a commit that referenced this pull request Jan 22, 2020
Incase error event a message can be shown inside the modal.

Reference: #3599 (comment)
mittalyashu added a commit that referenced this pull request Jan 23, 2020
Creating a updateIsGitStatus mutation to update isGit value inside repository vuex store.

Database is updated with the required changes with vuex is unaware of the changes which causes is bug to show repository as `isGit: false`.

Reference: #3599 (comment)
@KaKi87 KaKi87 deleted the chore/add-nodegit branch February 3, 2020 18:29
mittalyashu added a commit that referenced this pull request Jun 5, 2021
* Initialize Git repository (nodegit) (#3509)

* Install NodeGit package

* Fix nodegit package installation (#3512)

* Change node_version to 10.16.0

* Define node & electron engines in package.json

* FIX: Add comma after node version engine

* Switch back to latest version of Node@10

* Split script command yarn and yarn build:window

* Update "postinstall" script command to install electron app deps

* Install electron app native deps

* Merge yarn && yarn postinstall && yarn build:linux command

* Test windows pipeline with npm

* Upgrade nodegit & electron-builder package

* Run pipeline in npm

* Run audit fix

* Run install && audit fix

* install & audit fix & postinstall & build:window

* Update build description

* Move yarn to npm

* Update echo command

* Remove electron from engines

* Update npm registry url

* Initialize repo using nodegit

* Use promise instead of async

* git status (nodegit)

* fix: switchRepository mutation to toggle modal

* Remove remote refs & validate git repository

Remove function for getting remote url on adding repository and only validate git repository.

* Add getBranchName function using nodegit

* Add source column to db table

Source column tells the source of repository (local or remote repo)

* git status and get file status type

Getting repository git status along with each file type, symbol, and color.

* Query repository data on route (enter & update)

* Clear repositoryData on routeLeave

* Update projectId to repositoryId (route params)

* Add repositoryData state, getters, and mutation

* Show branch name and working changes

* Move to next page after database data

* Show staged files in workspace

* Query repository & repositorySettings features data

* Remove refs from workspace

* Move to status-list component

Remove fileChangesSkeleton and use status-list component

* Create status item component

* Remove branchName parmas from workspace route

* Pass branchName as props to commit-message

* NodeGit + SQLite migration : implement clone feature (#3589)

* Use nodegit

* Use database

* Add cloning progress

* Run ESLint

* Remove workspace vuex store

* Emit stagedFile to statusList component

Storing all the statusList component inside stagedFile local data property.

* Change projectId to repositoryId

Repository ID is unique ID assigned to each repository from SQLite database.

* Show repo path in switch repo modal

* Set default branchName to "master"

* Remove getFeatureValue computed property

* Get repository data using mixin

Using repositoryData.js as mixin to get data from repository.js vuex store as repositoryData computed property.

* Git remote functions

Add these 3 remote functions

* getRemoteListNames
* getRemoteUrl
* addRemoteUrl

* Remove branchName as route props

* Query remoteUrl from db

Fetch remote url from database on entering repository route

* Save remote url to db on adding repository

* Update add remote url with nodegit

* store filePreview value locally data property

filePreview is a local data property stored in `workspace.vue` to toggle view for diff preview component with blankSlate component

* adjust workspace files width

* Remove file diff preview method

* refactor: remove unused code

* Remove spacingProps, import repositoryData

* Update repositoryData computed property data

* Update to repositoryId & remove branchName params

* Remove event.preventDefault()

* Remove repositoryDataMixin import from settings.vue

* Update remoteUrl on saveSettings method

Update remoteUrl to database on running the saveSettings() method

* Git fetch functions

* pullRemoteBranch function

* Add gitFetch method to navbar

* Update directoryPath arguments (openTerminal & openFileExplorer)

* Update gitPull method with nodegit

* Remove branchName as route params

* Update repositoryData import

* Toggle commit-message component in workspace view

* Query repositoryName on enter repository route

* Change Git module to Clone in clone.js

* Remove console statement

* Format the code

* Update openCmdTerminal() method

* Initialize repository (nodegit) (#3592)

* Use nodegit and database instead of simple-git for initialize repository feature

* Disable git features for non-initialized repositories

* Add initialize repository feature from homepage

This commit includes an anti-pattern because of mutating this.isGit prop inside component but this can't be avoided without making some major changes.

* Settings to auto initialize non-git repository (#3596)

* Get & set settings to localStorage

Using if/else statement in beforeCreate lifecycle hook insted of using in vuex store mutation

* Add AutoInit settings to experimental page

* typo: initialize spellings

* Dispatch update to settings store (in single line)

* fix: autoInit undefined value in settings store

#3596 (comment)

* Remove console.log statement in setSettings

* Fix PR #3598 : Auto init non-git repository (part 2) (#3599)

* auto initialize non-git repository

* Update repositoryItem.vue after `npm run lint:fix`

* Do not initialize new repository on create

* Fix blocking error on new repository creation when folder does not exist

Co-authored-by: Yashu Mittal <mittalyashu77@gmail.com>

* addRepositoryToDatabase based closing modal

Incase error event a message can be shown inside the modal.

Reference: #3599 (comment)

* update isGit value in repository store

Creating a updateIsGitStatus mutation to update isGit value inside repository vuex store.

Database is updated with the required changes with vuex is unaware of the changes which causes is bug to show repository as `isGit: false`.

Reference: #3599 (comment)

* Update .electron-vue files

replace package-lock.json with yarn.lock

* change node engine v14

* ci: run pipeline with node v14 & v16

* ci: change npm to yarn

* set node engine v14 or v16

* ci: yarn postinstall deps

Co-authored-by: KaKi87 <tiana.lemesle@live.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants