Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initialize repository (nodegit) #3592

Merged
merged 4 commits into from Dec 20, 2019
Merged

Initialize repository (nodegit) #3592

merged 4 commits into from Dec 20, 2019

Conversation

KaKi87
Copy link
Contributor

@KaKi87 KaKi87 commented Nov 13, 2019

The purpose of this PR is to replace the old simple-git/localStorage code by the new nodegit/sqlite methods to perforn a repository initialization using NodeGIt's API and the addRepository mixin.

@mittalyashu mittalyashu changed the title NodeGit + SQLite migration : implement initialize repository feature Initialise repository feature (nodegit) Nov 15, 2019
@mittalyashu mittalyashu changed the title Initialise repository feature (nodegit) Initialise repositor (nodegit) Nov 15, 2019
@mittalyashu mittalyashu changed the title Initialise repositor (nodegit) Initialise repository (nodegit) Nov 15, 2019
@mittalyashu
Copy link
Member

😅

@KaKi87 KaKi87 changed the title Initialise repository (nodegit) Initialize repository (nodegit) Nov 15, 2019
@mittalyashu
Copy link
Member

Initializing repository feature includes many sub-features:

  1. Block user to open workspace page if repository is not initialized
  2. User should still be able to access settings page
  3. Update repository data in database
  4. Show repository git init status on welcome page
  5. Create a app settings for auto-initialise git repository or manual process

FAQ

Which case can you have a local and saved non-initialized repository?

Allowing users to add non-git repository and later adding option to initialize git repository directly from thermal app is an handy feature.

It is for those situations where the user just wants to add a project to Thermal but doesn't want to initialise the repository.

Also it will give user more control over how they want to initialize the repository.

@KaKi87
Copy link
Contributor Author

KaKi87 commented Nov 18, 2019

  • Block user to open workspace page if repository is not initialized
  • User should still be able to access settings page
  • Update repository data in database
  • Show repository git init status on welcome page
  • Create an app setting for auto-initialize git repository or manual process

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.
@mittalyashu
Copy link
Member

mittalyashu commented Dec 11, 2019

Block user to open workspace page if repository is not initialized

How about hiding the sidebar if the directory is not a git repository?

@KaKi87
Copy link
Contributor Author

KaKi87 commented Dec 12, 2019

That's what I wanted to do next. Unfortunately, I didn't found out how to do that considering the current UI structure.

@mittalyashu
Copy link
Member

Yeah, I am also not sure hiding the sidebar for non-git repository is the right choice.

@mittalyashu
Copy link
Member

Create an app setting for auto-initialize git repository or manual process

This PR will cover this feature #3596

@mittalyashu mittalyashu merged commit 1b3fcf5 into gitthermal:chore/add-nodegit Dec 20, 2019
@mittalyashu mittalyashu added difficulty: easy Git Git related stuff git commit... ⚙ Improvement New feature or request labels Dec 20, 2019
@mittalyashu mittalyashu added this to the 0.1.0 milestone Dec 20, 2019
@mittalyashu mittalyashu added this to To do in Roadmap via automation Dec 20, 2019
@mittalyashu mittalyashu moved this from To do to Done in Roadmap Dec 20, 2019
@KaKi87
Copy link
Contributor Author

KaKi87 commented Dec 20, 2019

What do you think is the right choice ?

@mittalyashu
Copy link
Member

About what?

@KaKi87
Copy link
Contributor Author

KaKi87 commented Dec 20, 2019

Yeah, I am also not sure hiding the sidebar for non-git repository is the right choice.

@mittalyashu
Copy link
Member

Even if we try to disable each item individually in the sidebar that will be a lot of work.

So, to make the process easier, the only possible option is left to hide the sidebar.

@KaKi87
Copy link
Contributor Author

KaKi87 commented Dec 20, 2019

Even if we try to disable each item individually in the sidebar that will be a lot of work.

I'd like to point out that this is proof that there's a design issue in the DOM structure, it should be simpler.

@mittalyashu mittalyashu mentioned this pull request Dec 20, 2019
13 tasks
@mittalyashu
Copy link
Member

mittalyashu commented Dec 21, 2019

I'd like to point out that this is proof that there's a design issue in the DOM structure, it should be simpler.

What do you mean? Can you elaborate it with some examples?

Right now, we have

<router-link
	class="repository__sidebar__item"
	:to="{ name: 'repositoryHistory' }"
>
	<t-flexbox align-items="center">
		<clockIcon />
		<p>History</p>
	</t-flexbox>
</router-link>

<router-link> based linked wrapped in a parent div tag. This is a very simple HTML structure we are following like list of items.

After the basic NodeGit integration is done, I was thinking to work on sidebar and change the HTML structure to something like this:

image

@KaKi87 KaKi87 deleted the nodegit/initialize-repository branch December 31, 2019 11:54
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
difficulty: easy Git Git related stuff git commit... ⚙ Improvement New feature or request
Projects
Roadmap
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants