You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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`
57
57
12. Follow instructions to determine the folder to place repo in and whether an `.obsidian` directory already exits.
58
58
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".
59
59
@@ -74,11 +74,10 @@ Depending on the size of your repository and your device, Obsidian may crash dur
74
74
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).
75
75
9. Open Obsidian.
76
76
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.
78
78
12. Add your name/email to the "Authentication/Commit Author" section in the plugin settings.
79
79
13. Use the command palette to call the "Pull" command.
80
80
81
81
## Start with new repo
82
82
83
83
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]].
# 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)
4
5
5
6
## Architecture
6
7
7
8
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
16
18
17
19
Furthermore, the following concepts are necessary:
-[Example: Configuratoin and Extension](https://codemirror.net/examples/config/)
26
29
27
30
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.
28
31
29
32
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.
30
33
31
34
We achieve the goal via the following steps:
35
+
32
36
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
* 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
- 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
+
103
109
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
+
105
113
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.
107
115
3. commit the changes in the submodule - without making a corresponding commit in the super-project.
108
116
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.
113
122
114
123
### Unsaved Changes Gutter Update Scenario
115
124
116
125
This scenario contains two main cases to test:
117
126
118
127
#### 1. Untracked file
128
+
119
129
1. Open an untracked file. It should show +++ everywhere.
120
130
2. Make insertions, deletions and in-line changes. It should always show +++.
121
131
122
132
#### 2. Tracked file
133
+
123
134
1. Open a tracked file with different line author dates and colors
124
135
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
127
139
line authoring for subsequent lines accordingly
140
+
128
141
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
+
131
146
4. Make changes at the intersection of unsaved and saved changes. The result should be consistent with above.
132
147
133
148
## Potential Future Improvements
134
149
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.
145
160
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)
0 commit comments