Skip to content

Commit 173bbc4

Browse files
committed
chore: rename plugin to Git close #681
1 parent b477def commit 173bbc4

10 files changed

+128
-117
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Obsidian Git
1+
# Git
22

33
Plugin that allows you to back up your [Obsidian.md](https://obsidian.md) vault to a remote Git repository (e.g. private repo on GitHub).
44

docs/Getting Started.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ The instructions assume you are using [GitHub](https://github.com), but can be e
4646
- Minimal permissions required are
4747
- "Read access to metadata"
4848
- "Read and Write access to contents and commit status"
49-
5. In Obsidian settings, enable community plugins. Browse plugins to install Obsidian Git.
50-
6. Enable Obsidian Git (on the same screen)
51-
7. Go to Options for the Obsidian Git plugin (bottom of main settings page, under Community Plugins section)
49+
5. In Obsidian settings, enable community plugins. Browse plugins to install Git.
50+
6. Enable Git (on the same screen)
51+
7. Go to Options for the Git plugin (bottom of main settings page, under Community Plugins section)
5252
8. Under the "Authentication/Commit Author" section, fill in the username on your git server and your password/personal access token.
5353
9. Don't touch any settings under "Advanced"
54-
10. Exit plugin settings, open command palette, choose "Obsidian Git: Clone existing remote repo".
54+
10. Exit plugin settings, open command palette, choose "Git: Clone existing remote repo".
5555
11. Fill in repo URL in the text field and press the repo URL button below it. The repo URL is NOT the URL in the browser. You have to append `.git`. - `https://github.com/<username>/<repo>.git
56-
- E.g. `https://github.com/denolehov/obsidian-git.git`
56+
- E.g. `https://github.com/denolehov/obsidian-git.git`
5757
12. Follow instructions to determine the folder to place repo in and whether an `.obsidian` directory already exits.
5858
13. Clone should start. Popup notifications (if not disabled) will display the progress. Do not exit until a popup appears requesting that you "Restart Obsidian".
5959

@@ -74,11 +74,10 @@ Depending on the size of your repository and your device, Obsidian may crash dur
7474
8. Copy the repo from Working Copy. Delete the vault from Obsidian and paste the repo there (repo has the same name as the vault).
7575
9. Open Obsidian.
7676
10. All your cloned files should be visible.
77-
11. Install and enable the Obsidian Git plugin.
77+
11. Install and enable the Git plugin.
7878
12. Add your name/email to the "Authentication/Commit Author" section in the plugin settings.
7979
13. Use the command palette to call the "Pull" command.
8080

8181
## Start with new repo
8282

8383
Similar steps as [existing repo](#existing-repo), except use the `Initialize a new repo` command, followed by `Edit remotes` to add the remote repo to track. This remote repo will need to exist and be empty. Also make sure to read on how to best configure your [[Tips-and-Tricks#Gitignore|.gitignore]].
84-

docs/Installation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ aliases:
99
## Plugin installation
1010

1111
### From within Obsidian
12-
Go to "Settings" -> "Community plugins" -> "Browse", search for "Obsidian Git", install and enable it.
12+
Go to "Settings" -> "Community plugins" -> "Browse", search for "Git", install and enable it.
1313

1414
### Manual
1515
1. Download `obsidian-git-<latest-version>.zip` from the [latest release](https://github.com/denolehov/obsidian-git/releases/latest)
1616
2. Unpack the zip in `<vault>/.obsidian/plugins/obsidian-git`
1717
3. Reload Obsidian (CTRL + R)
1818
4. Go to settings and disable restricted mode
19-
5. Enable `Obsidian Git`
19+
5. Enable `Git`
2020

2121
# Windows
2222

docs/Line Authoring.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ A quick showcase of all functionality. This feature is based on [git-blame](http
1212

1313
![](assets/line-author-activate.png)
1414

15-
It can also be activated via Command Palette `Obsidian Git: Toggle line author information`.
15+
It can also be activated via Command Palette `Git: Toggle line author information`.
1616

1717
## Default line author information
1818

@@ -96,7 +96,7 @@ color or variable.
9696
![](assets/line-author-text-color.png)
9797

9898
Example:
99-
| `var(--text-muted)` | `var(--text-normal)` |
99+
| `var(--text-muted)` | `var(--text-normal)` |
100100
|----------------------------------------------|-----------------------------------------------|
101101
| ![](assets/line-author-text-color-muted.png) | ![](assets/line-author-text-color-normal.png) |
102102

@@ -153,13 +153,13 @@ In this case the newest of all lines is shown in the gutter.
153153

154154
This can be activated in the settings.
155155

156-
| **Original** | **Changed with preserved whitespace** | **Changed with ignored whitespace** |
157-
|------------------------------------------------------|-------------------------------------------------------|-------------------------------------------------------|
156+
| **Original** | **Changed with preserved whitespace** | **Changed with ignored whitespace** |
157+
| ---------------------------------------------------- | ------------------------------------------------------- | ----------------------------------------------------- |
158158
| ![](assets/line-author-ignore-whitespace-before.png) | ![](assets/line-author-ignore-whitespace-preserved.png) | ![](assets/line-author-ignore-whitespace-ignored.png) |
159159

160160
Note, how ignoring the whitespace does not mark the indented
161161
lines as changes, as only additional whitespace was added.
162162

163163
## Submodules support
164164

165-
Line author information is fully supported in submodules.
165+
Line author information is fully supported in submodules.

docs/dev/LineAuthorFeature.md

Lines changed: 103 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,70 @@
11
# Line Authoring Feature - Developer Documentation
2-
* This feature was developed by [GollyTicker](https://github.com/GollyTicker).
3-
* [Feature documentation for users](https://publish.obsidian.md/git-doc/Line+Authoring)
2+
3+
- This feature was developed by [GollyTicker](https://github.com/GollyTicker).
4+
- [Feature documentation for users](https://publish.obsidian.md/git-doc/Line+Authoring)
45

56
## Architecture
67

78
To understand how this feature integrates with the [Codemirror 6 editor](https://codemirror.net/) used in the Obsidian editors, it is adviseable to read the following sections of the [Codemirror Guide](https://codemirror.net/docs/guide/):
8-
* Architecture Overview > (everything)
9-
* Data Model
10-
* Configuration
11-
* Facets
12-
* Transactions
13-
* View > (intro)
14-
* Extending Codemirror
15-
* State Fields
9+
10+
- Architecture Overview > (everything)
11+
- Data Model
12+
- Configuration
13+
- Facets
14+
- Transactions
15+
- View > (intro)
16+
- Extending Codemirror
17+
- State Fields
1618

1719
Furthermore, the following concepts are necessary:
18-
* [EditorState](https://codemirror.net/docs/ref/#state.EditorState)
19-
* [State Field](https://codemirror.net/docs/ref/#state.StateField)
20-
* [Transaction](https://codemirror.net/docs/ref/#state.Transaction)
21-
* [Creating a transaction](https://codemirror.net/docs/ref/#state.EditorState.update)
22-
* [Annotation within a transaction](https://codemirror.net/docs/ref/#state.Annotation)
23-
* [ChangeSet](https://codemirror.net/docs/ref/#state.ChangeSet) (for the unsaved changes gutter update)
24-
* [Exmaple: Document Changes](https://codemirror.net/examples/change/)
25-
* [Example: Configuratoin and Extension](https://codemirror.net/examples/config/)
20+
21+
- [EditorState](https://codemirror.net/docs/ref/#state.EditorState)
22+
- [State Field](https://codemirror.net/docs/ref/#state.StateField)
23+
- [Transaction](https://codemirror.net/docs/ref/#state.Transaction)
24+
- [Creating a transaction](https://codemirror.net/docs/ref/#state.EditorState.update)
25+
- [Annotation within a transaction](https://codemirror.net/docs/ref/#state.Annotation)
26+
- [ChangeSet](https://codemirror.net/docs/ref/#state.ChangeSet) (for the unsaved changes gutter update)
27+
- [Exmaple: Document Changes](https://codemirror.net/examples/change/)
28+
- [Example: Configuratoin and Extension](https://codemirror.net/examples/config/)
2629

2730
Given changes/updates of the file or file-view within Obsidian, we want to re-compute the line authoring (via [git-blame](https://git-scm.com/docs/git-blame)) and show it in the line gutters left to the editors.
2831

2932
When doing this, we need to integrate with the declarative modeling of Codemirror - and have its views automatically updated, when we change its associated data.
3033

3134
We achieve the goal via the following steps:
35+
3236
1. Every new editor pane in Obsidian subscribes itself
33-
by its filepath ([LineAuthoringSubcriber](/src/lineAuthor/control.ts))
34-
and listens in an internal publish-subscriber-model
35-
([eventsPerFilepath.ts](/src/lineAuthor/eventsPerFilepath.ts))
36-
for updates on that filepath.
37+
by its filepath ([LineAuthoringSubcriber](/src/lineAuthor/control.ts))
38+
and listens in an internal publish-subscriber-model
39+
([eventsPerFilepath.ts](/src/lineAuthor/eventsPerFilepath.ts))
40+
for updates on that filepath.
3741
2. Any changed file in the Obsidian Vault or anytime when a new
38-
file is opened, [lineAuthorProvider](/src/lineAuthor/lineAuthoProvider.ts)
39-
initiates the asynchronous computation of the
40-
[LineAuthoring](/src/lineAuthor/model.ts)
41-
via [simpleGit.ts](/src/simpleGit.ts) -
42-
which parses the output of `git-blame`.
42+
file is opened, [lineAuthorProvider](/src/lineAuthor/lineAuthoProvider.ts)
43+
initiates the asynchronous computation of the
44+
[LineAuthoring](/src/lineAuthor/model.ts)
45+
via [simpleGit.ts](/src/simpleGit.ts) -
46+
which parses the output of `git-blame`.
4347
3. Once the `LineAuthoring` is computed, the publish-subscriber-model is notified
44-
of the new value for the corresponding filepath.
48+
of the new value for the corresponding filepath.
4549
4. The notified `LineAuthoringSubcriber` creates a new transaction
46-
(via [newComputationResultAsTransaction](/src/lineAuthor/model.ts))
47-
containing the `LineAuthoring`.
50+
(via [newComputationResultAsTransaction](/src/lineAuthor/model.ts))
51+
containing the `LineAuthoring`.
4852
5. The `LineAuthoringSubscriber` [dispatches the transaction
49-
on the current EditorView](https://codemirror.net/docs/ref/#view.EditorView.dispatch).
53+
on the current EditorView](https://codemirror.net/docs/ref/#view.EditorView.dispatch).
5054
6. The [StateField's update](https://codemirror.net/docs/ref/#state.StateField^define^config.update)
51-
method is called by Codemirror due to the dispatched transaction.
52-
The [lineAuthorState](/src/lineAuthor/model.ts) updates itself with the
53-
newest `LineAuthoring`, if it one was provided in the transaction.
55+
method is called by Codemirror due to the dispatched transaction.
56+
The [lineAuthorState](/src/lineAuthor/model.ts) updates itself with the
57+
newest `LineAuthoring`, if it one was provided in the transaction.
5458
7. The [lineAuthorGutter](/src/lineAuthor/view/view.ts) is automatically re-rendered,
55-
due to the dispatch and the changes of the state-fields. The re-rendering
56-
now accesses the newest state-field values - resulting in a new DOM.
59+
due to the dispatch and the changes of the state-fields. The re-rendering
60+
now accesses the newest state-field values - resulting in a new DOM.
5761

5862
## Development
5963

6064
You can use this test-vault https://github.com/GollyTicker/obsidian-git-test-vault-online.
6165

6266
Once the watchmode npm is started, one can simply open the `test-vault` in Obsidian to
63-
test the plugin. The Obsidian Git plugin files are symbolic links to the
67+
test the plugin. The Git plugin files are symbolic links to the
6468
automatically re-compiled files at repository root level.
6569

6670
One can additionally use the
@@ -70,77 +74,88 @@ One can additionally use the
7074

7175
These cases should be tested, when changes to this feature have been made.
7276

73-
* running outside of a git repository
74-
* opening an untracked file
75-
* opening and closing obsidian windows of panes/notes
76-
* notes with a starting "--" in their filename
77-
* special characters in filenames
78-
* unicode filenames
79-
* empty file
80-
* file with populated last line
81-
* multi-line block with differeing line commits
82-
* examples for moving/copy-following
83-
* submodules
84-
* vault root != repository root
85-
* error in git blame result
86-
* open multiple files simultanously
87-
* open same file multiple times - and edit
88-
* open same files in multiple windows - and edit
89-
* open empty tracked file and make edits. quick update should respond sensibly
90-
* open file in a large, complex real-world vault with unknown characteristics
91-
(the private vault of the developer GollyTicker suffices) and repeatedly press Enter in a tracked file.
92-
* We expect no errors, but after adding the unsaved changed gutter update feature,
93-
an early bu was present, where errors would occur during rendering and the view would become messed up.
94-
* UI should render correctly regardless of whether line numbers are shown as well or not.
95-
* [[see obsidan forum discussion](https://forum.obsidian.md/t/added-editor-gutter-overlaps-and-obscures-editor-content/45217)
96-
* indentation changes and changes after last line (without trailing newline) with 'Ignored whitespace' enabled/disabled
97-
* [Unsaved Changes Gutter Update Scenario](#unsaved-changes-gutter-update-scenario)
98-
* commit file in a different time-zone than the current Obsidian user
99-
* check that time-zone "local" formatting is correct
100-
* time-zone "UTC" should always show the same result regardless of the local time-zone
101-
* line authoring id correctly uses submodule HEAD revision rather than super-project.
102-
* There was a bug with the old super-project identifier. It did not fully work with submodules as the following scenario lead to a different displayed line authoring, than the true one.
77+
- running outside of a git repository
78+
- opening an untracked file
79+
- opening and closing obsidian windows of panes/notes
80+
- notes with a starting "--" in their filename
81+
- special characters in filenames
82+
- unicode filenames
83+
- empty file
84+
- file with populated last line
85+
- multi-line block with differeing line commits
86+
- examples for moving/copy-following
87+
- submodules
88+
- vault root != repository root
89+
- error in git blame result
90+
- open multiple files simultanously
91+
- open same file multiple times - and edit
92+
- open same files in multiple windows - and edit
93+
- open empty tracked file and make edits. quick update should respond sensibly
94+
- open file in a large, complex real-world vault with unknown characteristics
95+
(the private vault of the developer GollyTicker suffices) and repeatedly press Enter in a tracked file.
96+
- We expect no errors, but after adding the unsaved changed gutter update feature,
97+
an early bu was present, where errors would occur during rendering and the view would become messed up.
98+
- UI should render correctly regardless of whether line numbers are shown as well or not.
99+
- [[see obsidan forum discussion](https://forum.obsidian.md/t/added-editor-gutter-overlaps-and-obscures-editor-content/45217)
100+
- indentation changes and changes after last line (without trailing newline) with 'Ignored whitespace' enabled/disabled
101+
- [Unsaved Changes Gutter Update Scenario](#unsaved-changes-gutter-update-scenario)
102+
- commit file in a different time-zone than the current Obsidian user
103+
- check that time-zone "local" formatting is correct
104+
- time-zone "UTC" should always show the same result regardless of the local time-zone
105+
- line authoring id correctly uses submodule HEAD revision rather than super-project.
106+
107+
- There was a bug with the old super-project identifier. It did not fully work with submodules as the following scenario lead to a different displayed line authoring, than the true one.
108+
103109
1. remember the lineAuthoringId A for a file in a submodule in the vault.
104-
* it uses the HEAD of the git super-project rather than of the submodule the file is contained in.
110+
111+
- it uses the HEAD of the git super-project rather than of the submodule the file is contained in.
112+
105113
2. add a few lines in the file. The plugin will correctly detect the changed file-contents
106-
hash, which will trigger re-computation and re-render.
114+
hash, which will trigger re-computation and re-render.
107115
3. commit the changes in the submodule - without making a corresponding commit in the super-project.
108116
4. Close the file and re-open it in Obsidian.
109-
* In the submodule, the HEAD has changed - but not in the super-project.
110-
* Since the file path and file contents are same after committing, they haven't changed.
111-
* The current cache key doesn't detect this change and hence the view isn't updated.
112-
* Reloading Obsidian entirely will evict the cache - and the line authoring will be shown correctly again.
117+
118+
- In the submodule, the HEAD has changed - but not in the super-project.
119+
- Since the file path and file contents are same after committing, they haven't changed.
120+
- The current cache key doesn't detect this change and hence the view isn't updated.
121+
- Reloading Obsidian entirely will evict the cache - and the line authoring will be shown correctly again.
113122

114123
### Unsaved Changes Gutter Update Scenario
115124

116125
This scenario contains two main cases to test:
117126

118127
#### 1. Untracked file
128+
119129
1. Open an untracked file. It should show +++ everywhere.
120130
2. Make insertions, deletions and in-line changes. It should always show +++.
121131

122132
#### 2. Tracked file
133+
123134
1. Open a tracked file with different line author dates and colors
124135
2. Make insertions, deletions and in-line changes.
125-
* It should first show % until the changes are saved and the line authoring is computed.
126-
* The % should preserving the color of the changed line and insertions/deletions should shift the
136+
137+
- It should first show % until the changes are saved and the line authoring is computed.
138+
- The % should preserving the color of the changed line and insertions/deletions should shift the
127139
line authoring for subsequent lines accordingly
140+
128141
3. Make multi-line insertions, deletions and in-line changes (e.g. via cut-copy-pasting of blocks of text).
129-
* Hint: Use Ctrl+Z as well.
130-
* The behavior should be same as above.
142+
143+
- Hint: Use Ctrl+Z as well.
144+
- The behavior should be same as above.
145+
131146
4. Make changes at the intersection of unsaved and saved changes. The result should be consistent with above.
132147

133148
## Potential Future Improvements
134149

135-
* show commit info when click/hover on gutter
136-
* show / highlight diff when hover/click on gutter
137-
* small tooltip widget when hovering/right-clicking on line author gutter with author/hash, etc.
138-
* show deleted lines
139-
* interpret new 'newline' at end of line as non-change to make gutter change marking more intuitive.
140-
* [one option is to add a setting which switches between compatibility-mode and comfort-mode](https://github.com/denolehov/obsidian-git/pull/288)
141-
* distinguish untracked and changed line (e.g. "~" and "+")
142-
* use addMomentFormat in settings.ts when configuring the line author date format.
143-
* main.ts: refreshUpdatedHead(): Detect, if the head has changed from outside of Obsidian git (e.g. script) and run this callback then.
144-
* Avoid "Uncaught illegal access error" when closing a separate Obsidian window.
150+
- show commit info when click/hover on gutter
151+
- show / highlight diff when hover/click on gutter
152+
- small tooltip widget when hovering/right-clicking on line author gutter with author/hash, etc.
153+
- show deleted lines
154+
- interpret new 'newline' at end of line as non-change to make gutter change marking more intuitive.
155+
- [one option is to add a setting which switches between compatibility-mode and comfort-mode](https://github.com/denolehov/obsidian-git/pull/288)
156+
- distinguish untracked and changed line (e.g. "~" and "+")
157+
- use addMomentFormat in settings.ts when configuring the line author date format.
158+
- main.ts: refreshUpdatedHead(): Detect, if the head has changed from outside of Git (e.g. script) and run this callback then.
159+
- Avoid "Uncaught illegal access error" when closing a separate Obsidian window.
145160
It doesn't seem to have any impact on UX yet though...
146-
* Unique initials option: [work in progress branch](https://github.com/GollyTicker/obsidian-git/tree/line-author-unique-initials)
161+
- Unique initials option: [work in progress branch](https://github.com/GollyTicker/obsidian-git/tree/line-author-unique-initials)

manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"id": "obsidian-git",
3-
"name": "Obsidian Git",
3+
"name": "Git",
44
"description": "Backup your vault with Git.",
55
"isDesktopOnly": false,
66
"fundingUrl": "https://ko-fi.com/vinzent",
77
"js": "main.js",
88
"version": "2.22.1"
9-
}
9+
}

0 commit comments

Comments
 (0)