mirror of
https://github.com/shumadrid/obsidian-git-changelog.git
synced 2026-07-22 05:42:16 +00:00
refactor: rename convertToInclude setting
This commit is contained in:
parent
7302642bcb
commit
790fc02936
8 changed files with 69 additions and 17 deletions
50
README.md
50
README.md
|
|
@ -4,6 +4,26 @@ A new [Obsidian](https://obsidian.md) plugin that utilizes Git commit history to
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
## Table of Contents
|
||||||
|
|
||||||
|
- [Installation](#installation)
|
||||||
|
- [Features](#features)
|
||||||
|
- [Vault Changelog View](#vault-changelog-view)
|
||||||
|
- [File Changelog View](#file-changelog-view)
|
||||||
|
- [Changelog Customizability](#changelog-customizability)
|
||||||
|
- [Live Stats in the Status Bar for the Current Note](#live-stats-in-the-status-bar-for-the-current-note)
|
||||||
|
- [Integration with Git Plugin's Diff View](#integration-with-git-plugins-diff-view)
|
||||||
|
- [Data Loss Monitoring](#data-loss-monitoring)
|
||||||
|
- [Common Causes of Data Loss](#common-causes-of-data-loss)
|
||||||
|
- [How to Use](#how-to-use)
|
||||||
|
- [Limitations](#limitations)
|
||||||
|
- [Roadmap](#roadmap)
|
||||||
|
- [Alternatives](#alternatives)
|
||||||
|
- [FAQ](#faq)
|
||||||
|
- [Debugging](#debugging)
|
||||||
|
- [Contributing](#contributing)
|
||||||
|
- [Credits](#credits)
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
Install the plugin from [the official Community Plugins repository](https://obsidian.md/plugins?id=git-changelog).
|
Install the plugin from [the official Community Plugins repository](https://obsidian.md/plugins?id=git-changelog).
|
||||||
|
|
@ -22,6 +42,7 @@ Install the plugin from [the official Community Plugins repository](https://obsi
|
||||||
- Shows the total count of lines added and deleted.
|
- Shows the total count of lines added and deleted.
|
||||||
- Displays counts of files added, modified, deleted, and moved/renamed (total or text and non-text separately). If a file is both renamed/moved and modified, it will contribute towards the renamed files stats.
|
- Displays counts of files added, modified, deleted, and moved/renamed (total or text and non-text separately). If a file is both renamed/moved and modified, it will contribute towards the renamed files stats.
|
||||||
- Lists per file lines added and deleted, along with additional file statuses (**A**dded, **R**enamed, **M**oved, or **D**eleted).
|
- Lists per file lines added and deleted, along with additional file statuses (**A**dded, **R**enamed, **M**oved, or **D**eleted).
|
||||||
|
- The files are sorted from most number of lines changed to least.
|
||||||
- **Exclude Files and Folders:**
|
- **Exclude Files and Folders:**
|
||||||
|
|
||||||
Usually you specify files and folders you want to exclude from your Git repository in the `.gitignore` file.
|
Usually you specify files and folders you want to exclude from your Git repository in the `.gitignore` file.
|
||||||
|
|
@ -30,7 +51,7 @@ Install the plugin from [the official Community Plugins repository](https://obsi
|
||||||
|
|
||||||
But this setting is useful if you want to keep some files backed up by your repository (e.g. because they're valuable), but exclude them from appearing in the vault changelog.
|
But this setting is useful if you want to keep some files backed up by your repository (e.g. because they're valuable), but exclude them from appearing in the vault changelog.
|
||||||
|
|
||||||
Common examples for this: `.trash` and `.obsidian` folders, debug/log files, or conflict files generated by a syncing service that can clutter the changelog stats.
|
Common examples for this: `/.trash`, `/attachments` and `/.obsidian` folders, debug/log files, or conflict files generated by a syncing service that can clutter the changelog stats.
|
||||||
|
|
||||||
Also use this setting to filter files and folders that already exist in previous commits, since specifying files in .gitignore doesn't remove them from previous commits.
|
Also use this setting to filter files and folders that already exist in previous commits, since specifying files in .gitignore doesn't remove them from previous commits.
|
||||||
|
|
||||||
|
|
@ -38,6 +59,14 @@ Install the plugin from [the official Community Plugins repository](https://obsi
|
||||||
|
|
||||||
For advanced users: If you configured your Git repository to be below the vault root directory, the paths should be relative to the Git repo, not the vault.
|
For advanced users: If you configured your Git repository to be below the vault root directory, the paths should be relative to the Git repo, not the vault.
|
||||||
|
|
||||||
|
- **Include items:**
|
||||||
|
|
||||||
|
Convert the `Exclude Files and Folders` list to an include list, while excluding everything else.
|
||||||
|
|
||||||
|
An example case where this can come in handy is when you notice your vault misbehaving, you can trigger this setting and put `.obsidian` in the list to exclusively see changes made inside your configuration folder.
|
||||||
|
|
||||||
|
Then you can easily investigate what settings recently changed and if some of the changes are the cause of your issue.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### File Changelog View
|
### File Changelog View
|
||||||
|
|
@ -53,7 +82,7 @@ Install the plugin from [the official Community Plugins repository](https://obsi
|
||||||
|
|
||||||
- Set a custom day start time (if you're a night owl and want to track your actual days).
|
- Set a custom day start time (if you're a night owl and want to track your actual days).
|
||||||
- Set a custom timezone to base the intervals on or detect it automatically.
|
- Set a custom timezone to base the intervals on or detect it automatically.
|
||||||
- Choose to view hourly, daily, weekly, or monthly intervals.
|
- Easily switch between hourly, daily, weekly, and monthly intervals.
|
||||||
- Choose from 5 options to ignore whitespace changes with varying intensity.
|
- Choose from 5 options to ignore whitespace changes with varying intensity.
|
||||||
- **Adjust file rename detection strictness:**
|
- **Adjust file rename detection strictness:**
|
||||||
|
|
||||||
|
|
@ -150,14 +179,21 @@ If you don't want to depend on Git, check out the [Vault Changelog](https://gith
|
||||||
|
|
||||||
## FAQ
|
## FAQ
|
||||||
|
|
||||||
### Will this plugin alter my Git repository/config?
|
- Will this plugin alter my Git repository/config?
|
||||||
|
|
||||||
- No. This plugin is intended to be read-only and does not alter any Git configurations.
|
- No. This plugin is intended to be read-only and does not alter any Git configurations. However, it's in beta, so bugs are possible.
|
||||||
However, it's in beta, so bugs are possible.
|
|
||||||
|
|
||||||
### I have been using Obsidian for some time but don't have a Git repo set up. Can I still use this plugin to view the history of my vault?
|
The only exception is if you explicitly click the `Apply` button for the `Difference detection algorithm` setting, which applies the selected algorithm to the `.git/config` file.
|
||||||
|
|
||||||
- No. 😔
|
- I have been using Obsidian for some time but don't have a Git repo set up. Can I still use this plugin to view the history of my vault?
|
||||||
|
|
||||||
|
- No. 😔
|
||||||
|
|
||||||
|
- After making substantial changes, the plugin is showing unusual stats.
|
||||||
|
|
||||||
|
- Try disabling all exclusion rules and see if it was some rule that was influencing the stats.
|
||||||
|
|
||||||
|
Example scenario: A folder that was marked as excluded is now moved to a different location, the existing rule no longer affects that folder, so the plugin is showing the files inside that folder as added instead of moved.
|
||||||
|
|
||||||
## Debugging
|
## Debugging
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,8 @@ export default typescriptEslint.config(
|
||||||
'error',
|
'error',
|
||||||
{
|
{
|
||||||
ignore: [-1, 0, 1, 2],
|
ignore: [-1, 0, 1, 2],
|
||||||
ignoreDefaultValues: true
|
ignoreDefaultValues: true,
|
||||||
|
ignoreClassFieldInitialValues: true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
'@typescript-eslint/explicit-function-return-type': [
|
'@typescript-eslint/explicit-function-return-type': [
|
||||||
|
|
|
||||||
|
|
@ -106,8 +106,16 @@ export class GitChangelogPlugin extends PluginBase<GitChangelogPluginSettings> {
|
||||||
this.consoleDebug(`Error:`, error.stack);
|
this.consoleDebug(`Error:`, error.stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line no-magic-numbers
|
public displayNotice(
|
||||||
public displayNotice(message: string, timeout: number = 3 * 1000): void {
|
message: DocumentFragment | string,
|
||||||
|
// eslint-disable-next-line no-magic-numbers
|
||||||
|
timeout: number = 3 * 1000
|
||||||
|
): void {
|
||||||
|
if (message instanceof DocumentFragment) {
|
||||||
|
new Notice(message, timeout);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
new Notice(`${this.manifest.name}:\n${message}`, timeout);
|
new Notice(`${this.manifest.name}:\n${message}`, timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,8 +70,8 @@ export class VaultChangelogManager extends ChangelogManager<VaultChangelogEntry>
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
oldSettings.vaultChangelogGenerationSettings.convertToInclude !==
|
oldSettings.vaultChangelogGenerationSettings.convertToIncludeList !==
|
||||||
newSettings.vaultChangelogGenerationSettings.convertToInclude
|
newSettings.vaultChangelogGenerationSettings.convertToIncludeList
|
||||||
) {
|
) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ export async function runRepoDiff({
|
||||||
const pathSpec = convertGitIgnoreToPathspec(
|
const pathSpec = convertGitIgnoreToPathspec(
|
||||||
plugin.settings.vaultChangelogGenerationSettings
|
plugin.settings.vaultChangelogGenerationSettings
|
||||||
.excludeFilesAndFoldersLines,
|
.excludeFilesAndFoldersLines,
|
||||||
plugin.settings.vaultChangelogGenerationSettings.convertToInclude
|
plugin.settings.vaultChangelogGenerationSettings.convertToIncludeList
|
||||||
);
|
);
|
||||||
|
|
||||||
const numstatArguments = [
|
const numstatArguments = [
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,14 @@ export function addExcludeMenuItem({
|
||||||
plugin
|
plugin
|
||||||
});
|
});
|
||||||
const ruleAlreadyExists = lineNumber !== -1;
|
const ruleAlreadyExists = lineNumber !== -1;
|
||||||
const actionTitle = ruleAlreadyExists ? 'Reinclude' : 'Exclude';
|
const isIncludeList =
|
||||||
|
plugin.settings.vaultChangelogGenerationSettings.convertToIncludeList;
|
||||||
|
let actionTitle: string;
|
||||||
|
if (isIncludeList) {
|
||||||
|
actionTitle = ruleAlreadyExists ? 'Re-exclude' : 'Include';
|
||||||
|
} else {
|
||||||
|
actionTitle = ruleAlreadyExists ? 'Reinclude' : 'Exclude';
|
||||||
|
}
|
||||||
|
|
||||||
item
|
item
|
||||||
.setSection('action')
|
.setSection('action')
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ export interface ChangelogGenerationSettings {
|
||||||
|
|
||||||
export interface VaultChangelogGenerationSettings {
|
export interface VaultChangelogGenerationSettings {
|
||||||
excludeFilesAndFoldersLines: string[];
|
excludeFilesAndFoldersLines: string[];
|
||||||
convertToInclude: boolean;
|
convertToIncludeList: boolean;
|
||||||
interval: ChangelogInterval;
|
interval: ChangelogInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -120,7 +120,7 @@ export class GitChangelogPluginSettings
|
||||||
export const DEFAULT_VAULT_CHANGELOG_GENERATION_SETTINGS: VaultChangelogGenerationSettings =
|
export const DEFAULT_VAULT_CHANGELOG_GENERATION_SETTINGS: VaultChangelogGenerationSettings =
|
||||||
{
|
{
|
||||||
excludeFilesAndFoldersLines: [],
|
excludeFilesAndFoldersLines: [],
|
||||||
convertToInclude: false,
|
convertToIncludeList: false,
|
||||||
interval: ChangelogInterval.Daily
|
interval: ChangelogInterval.Daily
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ export class IncludeItemsToggle extends GitChangelogSetting {
|
||||||
toggle
|
toggle
|
||||||
.setValue(
|
.setValue(
|
||||||
this.plugin.settings.vaultChangelogGenerationSettings
|
this.plugin.settings.vaultChangelogGenerationSettings
|
||||||
.convertToInclude
|
.convertToIncludeList
|
||||||
)
|
)
|
||||||
.onChange((value) => {
|
.onChange((value) => {
|
||||||
const newSettings = this.plugin.settingsClone;
|
const newSettings = this.plugin.settingsClone;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue