Commit Graph

13 Commits

Author SHA1 Message Date
Levi Neely c520e46cf5 Show "No git repository" instead of staying on "initializing" 2026-07-22 16:19:54 +02:00
Levi Neely f1ffad7eb8 Clear git state when project is closed
When viewChanged fires with no active project/document, reset all git
state, hide workspace controls, and show "No project" in the repo label.
2026-07-22 16:16:23 +02:00
Levi Neely 55b4fef0a0 Auto-generate .kateworkspace and .kateproject when opening a workspace
If a workspace is detected (heuristic or submodule) but lacks these files,
generate them automatically so Kate project detection works and workspace
metadata is established for future operations.
2026-07-22 16:13:52 +02:00
Levi Neely 029b1885a6 Add workspace support: multi-repo detection, create, remove, prune
Supports directories containing multiple git repos grouped by task/release.
Detects workspaces via .kateworkspace marker, .gitmodules (submodule monorepo),
or heuristic (2+ sibling git repos in parent dir).

New Workspaces tab lists peer workspaces with branch info.
Repo combo box switches active repo within a workspace.

.kateworkspace format (INI):
  [workspace]
  source=.         # primary
  source=../r7.20  # derived
  [hooks]
  OnRemove=<cleanup command> %d

Create workspace: pick source dir, enter name (=branch), fans out
git worktree add across all repos, copies .kateworkspace.

Remove workspace: runs OnRemove hook, git worktree remove per repo, rmdir.
Prune: git worktree prune across all source repos.
2026-07-22 16:09:07 +02:00
Levi Neely 460247e8a0 fix index.lock sticking: drop .git/ and index watches, use document-save events
The QFileSystemWatcher on .git/ directory and .git/index file caused a
feedback loop: every git operation touching the index fired watch events
that triggered git-status, creating lock contention and stale
index.lock files.

Now only concrete events trigger a refresh:
- .git/HEAD file change (branch switch)
- refs/heads/ directory change (branch create/delete)
- KTextEditor document save (documentSavedOrUploaded signal)

No periodic timers. The 500ms debounce remains as the single gate.
2026-07-20 10:55:41 +02:00
Levi Neely 7098d70b40 Fix branch context menu using wrong branch for Create Worktree
Capture the right-clicked branch in lambdas at menu-build time instead
of relying on currentItem() at action execution time, which could shift
due to auto-refresh or filter interactions.
2026-07-16 11:25:45 +02:00
Levi Neely b4e28097c8 Add git log tab, configurable tab visibility, and drag-reorderable tabs
- Log tab: shows last 200 commits, double-click to diff against HEAD,
  context menu with show commit and copy hash
- Tab visibility: right-click tab bar to toggle optional tabs
  (Branches, Stashes, Worktrees, Log); Status always visible
- Tabs are drag-reorderable; order and visibility persist via QSettings
- Branches: add Soft Reset to Merge Base context menu action
2026-07-16 08:58:47 +02:00
Levi Neely 7dabd4b9e6 Support deleting remote branches via the delete button
The delete button and context menu action now detect whether the
selected branch is remote (tracked via Qt::UserRole on list items).
Remote branches are deleted with `git push --delete <remote> <branch>`
with an appropriate confirmation dialog warning about server-side
removal. Local branches continue using `git branch -D`.
2026-07-16 05:38:10 +02:00
Levi Neely 3642f8b743 Preserve selection during auto-refresh
- Only refresh status model when git output actually changes (skip
  beginResetModel/endResetModel if raw output is identical)
- Filesystem watcher triggers updateStatus only, not refreshAll —
  branch/stash/worktree lists only rebuild on explicit user actions
- Branch list refreshes on HEAD file change (branch switch) with delay
  to avoid interrupting interactions
2026-07-16 04:42:07 +02:00
Levi Neely 3febe2f184 Fix auto-refresh: watch .git directory instead of just files
Watching individual files (.git/index, .git/HEAD) fails reliably
because git replaces them via atomic rename, which removes inotify
watches. Watch the .git directory itself via directoryChanged signal
which fires on any create/delete/rename inside it. Keep file watches
as fallback. Also watch refs/heads for branch tip changes.
2026-07-16 04:28:24 +02:00
Levi Neely a7e7542d70 Fix auto-refresh: re-add file watch after atomic replace
QFileSystemWatcher drops watches when git replaces index/HEAD via
atomic rename. Re-add the path after each fileChanged signal.
Also refresh all tabs (branches, stashes, worktrees) on fs change,
not just status.
2026-07-16 04:24:10 +02:00
Levi Neely ac8980a203 Use Kate's native diff viewer, add per-file and full changeset diff
- Integrate with libkateprivate's Utils::showDiff() to use Kate's built-in
  diff widget (respects user's Unified/SideBySide/Raw style preference)
- Add bundled kate-compat headers for DiffParams and Utils::showDiff decl
- CMakeLists.txt auto-detects libkateprivate, falls back to plain text diff
- Add 'Diff selected' button: shows diff for selected files with
  stage/unstage/discard actions available in the diff viewer
- Add 'Diff All' button: shows git diff HEAD for full changeset review
- Staged diffs show unstage action, unstaged diffs show stage+discard
- ReloadOnShow flag keeps diff views fresh after interactive operations
2026-07-16 04:21:51 +02:00
Levi Neely ab2d531240 Git++ Kate plugin: initial release
Full-featured Git integration for Kate with tabbed side panel:

Status tab:
- Live file status tree (staged/changed/untracked)
- Stage, unstage, discard with double-click support
- Commit with inline message editor and amend support
- Push, pull, fetch with progress spinner
- Filesystem watcher for auto-refresh

Branches tab:
- Filterable list of local and remote branches
- Checkout, create, delete, compare
- Create worktree from branch
- Copy branch name to clipboard

Stashes tab:
- List all stashes with apply, pop, drop, diff

Worktrees tab:
- List active worktrees
- Create (with branch picker), remove, prune
- Open worktree as Kate project

Indicators:
- Panel header with repo/branch/dirty state
- Status bar widget always visible
- Detached HEAD warning
- Remote operation progress
2026-07-15 16:58:05 +02:00