149 Commits

Author SHA1 Message Date
Seth Hillbrand b79862e7b8 Reset git cancel flag when opening new project
EmptyTreePrj() sets the KIGIT_COMMON cancel flag to true during
project close to stop in-flight git operations. However, when
ReCreateTreePrj() opens a new git repository for the next project,
the cancel flag was never reset to false. Since the KIGIT_COMMON
object persists across project switches (owned by PROJECT_TREE),
all git operations (status icons, sync, fetch) were permanently
disabled after the first project close.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/23344
2026-03-06 11:44:56 -08:00
Seth Hillbrand c52ab91c84 Reduce compile times by extracting headers
Break the most expensive header include chains that contaminate the
largest number of translation units

New lightweight headers for extractdded types:
font_metrics.h, mouse_drag_action.h, board_project_settings_params.h,
common_settings_internals.h, wx_infobar_message_type.h,
zone_layer_properties_grid.h
2026-02-13 17:10:45 -08:00
Jeff Young 596604590e Formatting. 2026-02-08 15:04:03 +00:00
Seth Hillbrand 7f1c286312 Add CSV file type icon to project tree
CSV files now display with a dedicated icon in the project tree
instead of the generic unknown file icon. The icon shows a file
shape with a grid pattern representing tabular data.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21250
2026-01-28 18:30:31 -08:00
Alex Shvartzkop 456d334bb4 Fix assert failure related to .history on MSW.
wxMSWFileSystemWatcher::AddTree only adds the root tree,
not all subtrees like wxFileSystemWatcherBase::AddTree.
2026-01-19 03:33:17 +03:00
Seth Hillbrand 0319da048b Remove .history from watchlist
When we save, we update the .history backup system.  Each of these
changes will trigger the fswatcher even if we don't explicitly remove
the .history and descendants from the watch
2026-01-13 18:34:14 -08:00
Alex Shvartzkop 8b348d20d9 Fix crash when CallAfter is called while destructing thread pool on exit.
PROJECT_TREE_PANE is already destructed at that point.
2026-01-13 14:57:51 +05:00
Seth Hillbrand 23765b6ebe Fix git status icons not showing when project opened via symlink
When a project is opened through a symlinked path, libgit2's
git_repository_workdir() returns the canonical path with symlinks
resolved. This caused a path mismatch between the tree cache
(which uses the user-provided symlinked path) and git status
results (which used canonical paths), preventing status icons
from being displayed.

The fix introduces SetProjectDir()/GetProjectDir() methods to
KIGIT_COMMON to store and use the user-provided project path.
A helper function computeSymlinkPreservingWorkDir() computes
the git working directory path while preserving symlinks from
the original user path.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21092
2026-01-11 20:04:12 -08:00
Seth Hillbrand 553d32cdf2 Add null pointer checks in project tree pane to prevent crashes 2026-01-09 18:16:51 -08:00
Seth Hillbrand 09413b0fc6 Change Remove Version Control to Disable
We don't need destructive operations in KiCad.  We can just disable the
git integration on a per-project basis for people

Fixes https://gitlab.com/kicad/code/kicad/-/issues/22134
2026-01-02 10:39:33 -08:00
Seth Hillbrand fd2ddf60b7 Handle git cancellation when closing
Tidies up a few places where we need to hold the mutex and early exit
from loops if we are quitting

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21849
2025-12-29 08:58:46 -08:00
Seth Hillbrand b0bee18c9e Quiet linux errors in fswatcher
There's no good way to catch initialization errors in the wx fswatcher
and we can't check to see if it has been properly initialized.  So,
instead, we need to catch the assert error thrown on resource
exhaustion and use that as a proxy
2025-11-30 12:28:12 -08:00
Seth Hillbrand 883925bfe0 Allow local history auto update
Fix a crash with the tip menu
2025-10-24 17:55:26 -07:00
Seth Hillbrand 8257870ac3 ADDED: Local History
Local history combines project backup and autosave into a single place
where arbitrary history can be stored efficiently and restored to any
point in time.  Git commits are made on a debouce timer to hold
modifications, allowing the user to step backwards in time to arbitrary
points.  Restoring backups does not remove the existing files and
choosing to restore an autosave point does not remove the state of the
files prior to the restore, providing additional safety.

Keeps the maximum storage size limit but removes the additional
limitations of number of backups/backups per day, etc as these are not
relevant to a CoW-based backup as unchanged files do not take up
additional space.
2025-10-23 15:36:07 -07:00
Jeff Young 8454df8a9c Silence wx assert about 0 IDs not working on Mac. 2025-09-26 12:13:45 +01:00
Seth Hillbrand d5e03741b7 When using git, show all files
Git tracks the status of files in the repository, so we shouldn't hide
the non-root schematics

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21583

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21583
2025-09-19 11:22:10 -07:00
Seth Hillbrand 4aa3576a4c Fix build warnings
Use detach_task since we don't need the return values
2025-09-14 06:05:22 -07:00
Seth Hillbrand 6e2b20ed0e Update BS Threadpool to 5.0 2025-09-10 13:02:24 -07:00
Seth Hillbrand aac15f4596 Encapsulate libgit commands into single backend
Sets stage for allowing alternate backends for version control
2025-09-08 21:04:31 -07:00
Seth Hillbrand 9ea088f83f Add git shutdown command
Will allow interrupting long commands during the update message
2025-08-02 20:31:40 -07:00
Seth Hillbrand c9e9a4e073 Allow git init to succeed without remote 2025-08-02 16:39:11 -07:00
Jeff Young 6c6c02a329 Don't assume a tree root.
Fixes KICAD-Y72.
2025-08-01 16:46:50 +01:00
Seth Hillbrand f2b6ac5d18 Refactor git calls into their own namespace 2025-07-31 08:32:07 -07:00
Seth Hillbrand 2aad11e3e7 Refactor some git routines into utility class 2025-07-30 16:59:41 -07:00
Seth Hillbrand da19b87cb1 Be sure to clean up remote pointer 2025-07-30 16:18:57 -07:00
Seth Hillbrand 949021dc35 Fix potential crash if git_repository_init fails
Don't wrap smart pointer before init
2025-07-30 16:15:55 -07:00
Jeff Young dc4f639c61 Make sure selected item is still valid before activating (KICAD-18S). 2025-07-14 23:46:03 +01:00
jean-pierre charras f6fd54498d Re-add missing include 2025-07-11 15:07:31 +02:00
Jeff Young 5b91a24380 Retire WINDOW_FREEZER in favour of wxWindowUpdateLocker.
Also pulls out previous fix to a Sentry issue I can
no longer find, at least until I figure out what
went wrong.
2025-07-11 13:21:04 +01:00
Jeff Young 53c90b0469 Upgrade ShowPlayer re-entrancy guard (KICAD-XAC). 2025-07-10 17:54:42 +01:00
Jeff Young 9a3c9d780f Formatting. 2025-07-02 23:10:10 -06:00
Jeff Young 06dcb64ad8 Harden progress reporter API against misuse.
Also, titles are nouns, not verbs.  (Messages
*inside* reporters are verbs.)

Also implements progress reporter for Altium
schematic import.
2025-06-01 19:38:24 +01:00
Jeff Young 4bb54b3439 Move more stuff to ACTIONs framework. 2025-05-23 15:19:49 +01:00
Seth Hillbrand ca7fbbe176 Add wait dialog when switching projects
If we are in the middle of a git operation when switching projects, wait
and show the user a dialog explaining what is going on
2025-05-09 13:31:46 -07:00
Seth Hillbrand 3d29fae7a9 Remove TreeControl call from thread
On Windows, this may use SendMessageW, forcing a wait for UI in the
thread

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20572
2025-04-07 17:05:54 -07:00
Seth Hillbrand 937f225df0 Update tree based on elements not map
Rather than updating the tree with all elements in the map (some of
which may have changed), we iterate over the tree and set those elements
that we find in the map.  This ensures that all elements updated in the
tree exist there

(cherry picked from commit 579c08155f)

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20464
2025-03-26 13:11:58 -07:00
Seth Hillbrand f83e607e6e Enable/disable git tracking in user prefs
Don't require advanced config for people who want to disable
2025-03-24 11:52:50 -07:00
Seth Hillbrand b8225ba2d6 Fix some regressions in git handling
Set default to rebase for pull
Update error string on auth failure
Improve trace logging
2025-03-21 11:55:44 -07:00
Seth Hillbrand 676dd4ceec Fix inheritance for git_common
Avoids repo type pointer issues when casting from void
2025-03-15 13:05:45 -07:00
Seth Hillbrand 26c331a837 Adjust git handling
- Utilize scoped deletion for individual git_*_free() calls
- Protect against multiple usage when updating icons
- Reduce frequency of git update calls
2025-03-14 17:01:03 -07:00
Seth Hillbrand 18ac99d838 Prevent fetch without repo
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20152
2025-02-28 08:34:24 -08:00
Seth Hillbrand 9211136953 Fix windows build 2025-02-26 18:15:17 -08:00
Seth Hillbrand 5027a562e4 Adjust git timing parameters
Move most of the update firing to the file system watcher (except for
windows network shares that still need timed updated).  Gate the repo
status for sync

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20133
2025-02-26 15:56:38 -08:00
Seth Hillbrand aa1baec062 Fix git flicker on Windows 2025-02-25 19:38:01 -08:00
Seth Hillbrand 2c54ab277b Thread git checks
Push the git checks from the main thread into child threads to prevent
resource contention in some cases where Windows machines might have many
files in git that are _also_ being managed by Google Drive

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20078
2025-02-25 16:07:19 -08:00
Graham Keeth 68869f6439 capitalize Git in display strings 2025-02-21 15:18:16 +00:00
Seth Hillbrand f6c507bff9 Fix git issue with file separators
In some cases, GetPath will not return the trailing `/` leading to
inability to commit any files in git
2025-02-18 10:00:54 -08:00
Seth Hillbrand ba208fd5c9 Suppress git remove if not at head
Don't offer to remove the .git directory if we are not looking at the
base of the git repository for safety

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19889
2025-02-12 14:43:08 -08:00
Seth Hillbrand 088a90cf68 Prevent committing bad files
Avoid backup, lock, autosave files
Avoid files that are not visible to KiCad (outside of the project
directory/sub-directories)

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19891
2025-02-12 13:44:08 -08:00
Jon Evans 8af6defafe Git: allow making the first commit in a branch 2025-02-08 17:30:55 -05:00