fix: mention file changelog edge cases in info tooltip

This commit is contained in:
shumadrid 2025-04-15 02:14:33 +02:00
parent e58a981253
commit 8f39e82434
5 changed files with 76 additions and 14 deletions

View file

@ -61,8 +61,7 @@ To easily see the what's new in future updates, it's recommended to use the [Plu
- **Context menu integration:** To exclude a file or folder, just right-click on it inside the File explorer and select "Git changelog: Exclude" from the context menu, no need to manually define paths.
> [!NOTE]
> 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:**
@ -80,6 +79,9 @@ To easily see the what's new in future updates, it's recommended to use the [Plu
![File Changelog View](.github/file-changelog-view.webp)
> [!WARNING]
> Showing a lot of versions and files will reduce view performance. This will be fixed soon.
### Changelog Customizability
- Set a custom day start time (if you're a night owl and want to track your actual days).
@ -102,24 +104,24 @@ To easily see the what's new in future updates, it's recommended to use the [Plu
- Click on any file version in the changelog views to open the corresponding diff view showing the changes.
> [!WARNING]
> Currently, only the "Split" diff view works. The "Unified" view shows inaccurate changes.
> [!WARNING]
> Currently, only the "Split" diff view works. The "Unified" view shows inaccurate changes.
### Compare Two Vault States in History
- Use the `Compare two vault states in history` command to compare any two points in the vault's git history.
- All settings that apply to the vault changelog view also apply to this command.
- All settings that apply to the changelog views also apply to this command.
![Vault's git history comparison](.github/vault-git-history-comparison-modal.png)
### See Changes since the Last Checkpoint
### Show Vault Changes since the Last Checkpoint
- The easiest way to track all changes made to your vault over time is to use the `Show vault changes since the last checkpoint` command to open a temporary view that shows all changes that happened since the last checkpoint (meaning: the last time you ran this command and approved the shown changes).
- If you're someone who's always concerned about data integrity, you don't need to have the vault changelog view open all the time in order to track changes. 😁 Just run this command every now and then to inspect all changes made since the last time you checked. (Be it a few minutes ago or a few months.)
- All settings that apply to the vault changelog view also apply to this command.
- All settings that apply to the changelog views also apply to this command.
## Data Loss Monitoring
@ -223,6 +225,22 @@ If you don't want to depend on Git, check out the these alternative plugins:
## FAQ
- Why is the File changelog view showing inaccurate history for some files?
- Most common cases for this are: **The file had its file path changed (renamed/moved or one of its parent folders was renamed/moved)**...
1. and the change isn't committed yet.
2. and was also significantly modified, so that the similarity of the old and new version went below the `File move/rename detection strictness` threshold, resulting in Git treating the file as a new file instead of a renamed/moved one.
3. but the only changes were letter capitalization changes, and now Git is saying that the file has no history ([Why?](https://github.com/shumadrid/obsidian-git-changelog/issues/3) TLDR: Git is case sensitive, your file system might not be). To solve this:
1. Add an emoji (or anything) as a prefix in the name to all the affected files/folders in your vault (an easier way is to only prefix all the topmost folders).
2. Commit all the changes.
3. After committing, the files will be tracked again with the newly capitalized names, and you can remove the emoji prefixes.
- Will this plugin alter my Git repository/config?
- 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.

View file

@ -3,7 +3,7 @@
import type GitChangelogPlugin from 'main.ts';
import {
COMPARED_VERSIONS_DATE_SEPARATOR,
COMPARED_VERSIONS_DATE_SEPARATOR_ICON,
COPY_COMMIT_HASH_ICON,
TOGGLE_FILES_SUMMARY_OPTION_ICON
} from 'constants.ts';
@ -138,7 +138,7 @@
$effect(() => {
if (arrowIconElement) {
setIcon(arrowIconElement, COMPARED_VERSIONS_DATE_SEPARATOR);
setIcon(arrowIconElement, COMPARED_VERSIONS_DATE_SEPARATOR_ICON);
}
if (sameCommitIconElement) {

View file

@ -4,7 +4,7 @@
import type { GitChangelogSettings } from 'settings/settings.ts';
import {
COMPARED_VERSIONS_DATE_SEPARATOR,
COMPARED_VERSIONS_DATE_SEPARATOR_ICON,
COPY_COMMIT_HASH_ICON,
TOGGLE_FILES_SUMMARY_OPTION_ICON
} from 'constants.ts';
@ -28,7 +28,7 @@
NoCommits = 'No commits in the repository.',
NoCheckpoints = 'No checkpoints yet.',
CheckpointCommitNoLongerExists = 'The commit tied to the last checkpoint no longer exists or the checkpoint value is corrupted.',
NoChanges = 'No committed changes since the last checkpoint.',
NoChanges = 'No committed included changes since the last checkpoint.',
Loaded = 'Loaded',
UnknownError = 'Unknown error occurred.'
}
@ -196,7 +196,7 @@
$effect(() => {
if (arrowIconElement) {
setIcon(arrowIconElement, COMPARED_VERSIONS_DATE_SEPARATOR);
setIcon(arrowIconElement, COMPARED_VERSIONS_DATE_SEPARATOR_ICON);
}
if (onCheckpointCommitIconElement) {

View file

@ -2,6 +2,8 @@
import type { GitChangelogPlugin } from 'GitChangelogPlugin.svelte.ts';
import type { EventRef } from 'obsidian';
import { INFO_TOOLTIP_ICON } from 'constants.ts';
import { setIcon } from 'obsidian';
import { onDestroy, untrack } from 'svelte';
import { LoaderState } from 'svelte-infinite';
import { assertNotNull } from 'utils.ts';
@ -31,6 +33,8 @@
let settingsChangedReference: EventRef;
let activeFileChangedReference: EventRef;
let infoTooltipIcon = $state<HTMLElement>();
const changelogManager = $derived(plugin.fileChangelogManager);
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call
const loaderState = new LoaderState();
@ -100,6 +104,15 @@
}
});
$effect(() => {
if (infoTooltipIcon) {
setIcon(
infoTooltipIcon,
assertNotNull(infoTooltipIcon.getAttr('data-icon'))
);
}
});
$effect.pre(() => {
setIntervalAdjective();
});
@ -162,7 +175,23 @@
{:else if changelogState === FileChangelogState.NoMarkdownFileOpen}
<div class="pane-empty">No file opened.</div>
{:else if changelogState === FileChangelogState.EmptyHistory}
<div class="pane-empty">File has no Git history.</div>
<div class=" pane-empty">
<div>File has no Git history.</div>
<div class="git-changelog-row">
<div
bind:this={infoTooltipIcon}
data-icon={INFO_TOOLTIP_ICON}
aria-label="Due to Git limitations, it doesn't show the history of files that had their:
1. file path changed without the changes being committed.
2. file path changes be capitalization changes only."
class="icon git-changelog-tooltip-icon"
></div>
<a
href="https://github.com/shumadrid/obsidian-git-changelog?tab=readme-ov-file#faq"
class="external-link git-changelog-read-more">Read more</a
>
</div>
</div>
{/if}
<!-- if changelogState === FileChangelogState.Initializing, show nothing -->
</div>
@ -170,4 +199,18 @@
</div>
<style lang="scss">
.git-changelog-tooltip-icon {
margin-top: var(--size-4-1);
}
.git-changelog-read-more {
font-size: var(--font-small);
}
.git-changelog-row {
display: flex;
gap: var(--size-4-1);
align-items: center;
justify-content: center;
}
</style>

View file

@ -39,7 +39,8 @@ export const OPEN_FILE_ICON = 'file-input';
export const PLUS_ICON = 'plus';
export const MINUS_ICON = 'minus';
export const COPY_COMMIT_HASH_ICON = 'git-commit-horizontal';
export const COMPARED_VERSIONS_DATE_SEPARATOR = 'clock-10';
export const COMPARED_VERSIONS_DATE_SEPARATOR_ICON = 'clock-10';
export const INFO_TOOLTIP_ICON = 'info';
export const CHANGELOG_LOAD_AMOUNT_BASE_MULTIPLIER = 35;
export const CHANGELOG_LOAD_AMOUNT_VERSIONS = 10;