Commit Graph

64 Commits

Author SHA1 Message Date
Seth Hillbrand 508bb36f8b Fix null dereference in PROJECT_GIT_UTILS
In CLI mode, SetGitBackend() is never called so GetGitBackend() returns
nullptr. GetRepositoryForFile(), CreateBranch(), and RemoveVCS() all
called GetGitBackend()->method() unconditionally, causing a SIGSEGV when
a schematic containing ${VCSHASH} or ${VCSSHORTHASH} text variables is
loaded via kicad-cli jobset run.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/23214
2026-03-02 08:03:53 -08:00
Alex Shvartzkop 405d299dd5 Fix "returning reference to local temporary object" 2026-02-20 11:05:04 +03:00
Wayne Stambaugh c19341dfe7 Coding policy fixes. 2026-02-04 11:38:42 -05:00
Seth Hillbrand 0b116673ab Git: Show error when pull fails due to unstaged changes
When git pull fails due to unstaged changes in the working directory,
show an informative error message instead of silently failing.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20363
2026-01-26 22:20:25 -08: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 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
Mark Roszko 2fc265ecef Fix more build errors on MSVC.
Not sure why it's suddenly a problem but it was tripping up on the vector template expansion already existing out of wx.
2025-11-26 13:34:24 -05:00
Seth Hillbrand a603ad8041 Allow for 8 hex char + 1 nul char in VCSSHORTHASH 2025-10-08 00:51:05 -07:00
Mark Roszko c43e9cb35e Fix MSVC build 2025-10-07 00:09:58 +00:00
Jeff Young e84c94a557 Performance tweaks. 2025-10-06 15:06:39 +01:00
Mark Roszko 593238eed8 Fix build due to GIT_BUF_INIT on some platforms 2025-09-24 20:09:51 -04:00
Seth Hillbrand 4ed56d87a4 Lazy load git credentials when needed
Prevents querying SecretStore on boot

Fixes https://gitlab.com/kicad/code/kicad/issues/20176
2025-09-21 14:21:28 -07:00
jean-pierre charras 79a3b7ac5f Add missing header to compil on msys2 2025-09-12 19:44:19 +02:00
Seth Hillbrand accbee3c6e Move git stuff to kicommon to fix build
And do other cool stuff
2025-09-12 07:17:42 -07:00
Seth Hillbrand c64f99c57a ADDED: VCSHASH and VCSSHORTHASH
Right now, git hashes only resolved by the variables ${VCSHASH} or
${VCSSHORTHASH}
2025-09-12 06:00:27 -07:00
Mark Roszko 297ca1bb7b Fix windows builds with a temporary hackfix for now 2025-09-09 11:12:39 -04: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 11f9817ebc Fix compile issue for Ubuntu
Thanks dnschneid!
2025-08-23 12:05:05 -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
Seth Hillbrand a7ab02224e Fix pathspec lifetime issue
Don't let stack pointers go out of scope before using

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21417
2025-08-02 12:33:55 -07:00
Seth Hillbrand f2b6ac5d18 Refactor git calls into their own namespace 2025-07-31 08:32:07 -07:00
Seth Hillbrand 01cf01981f Add more generalized pull for non-origin remotes 2025-07-31 08:32:07 -07:00
Seth Hillbrand 261d31c9e8 Handle case where there is no parent in the commit 2025-07-31 08:32:06 -07:00
Seth Hillbrand 7af404af43 Fix improper boolean check
This was assigning a boolean 1 or 0 to the error instead of the git
error code
2025-07-31 08:32:06 -07:00
Seth Hillbrand 2aad11e3e7 Refactor some git routines into utility class 2025-07-30 16:59:41 -07:00
Jeff Young 96fa79cef2 Minor performance optimizations. 2025-06-03 11:41:27 +01: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
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
Tomasz Wlostowski 1638322649 KIGIT: fix crash when the repo has no remote set 2025-03-25 16:06:52 +01:00
Seth Hillbrand cf93cdf13f Respect user preference for rebase/merge 2025-03-24 15:40:25 -07:00
Seth Hillbrand ea36110980 Trying again to fix Mac build 2025-03-21 17:07:28 -07:00
Seth Hillbrand b65ceb60b2 Fix builds for newer libgit2 (1.8.0 and newer) 2025-03-21 17:03:28 -07:00
Seth Hillbrand faf6243d1a Fix build on Windows 2025-03-21 14:42:52 -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
aris-kimi bb62444fe9 Fix a git2 related crash when closing KiCad
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/20202
2025-03-14 20:00:17 -07:00
Seth Hillbrand 2c52f98da4 Add ability for git to negotiate with agents
Updates the git connection dialog to reflect default agentic behavior,
followed by default keys and only then reverting to a custom selection
if the user desires

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20204
2025-03-14 17:01:03 -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 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
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 7edacd4fb8 Fix git push for some configurations
Reset ssh test keys prior to pushing.  Specify head reference
2025-02-12 13:00:46 -08:00
Jon Evans 04387dd42f Git: safety for calling KIGIT_COMMON with no repo 2025-02-08 16:32:48 -05:00
Jon Evans d4815534bf Fix lifetime of git_reference in handleFastForward
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19890
2025-02-08 14:40:11 -05:00
Seth Hillbrand 988d229bbf Clean up unused var
Turns out we didn't need that one
2025-01-21 16:21:27 -08:00
Seth Hillbrand 5a57e5cfd4 Handle SSH keys better
OpenSSH will iterate through a series of keys.  Additionally, there may
be a key specified in the ssh/config file that we need to account for.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18864
2025-01-21 15:59:07 -08:00
Seth Hillbrand 427d7d2dad Move git password management to local password control
Don't keep passwords in plain text config files that may be checked into
version control.  Passwords stored in system-specific password managers

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18053
2025-01-20 17:33:55 -08:00
Wayne Stambaugh 5c8f4697ca Common folder housekeeping part 1. 2025-01-12 12:06:45 -05:00
Seth Hillbrand 0b2d4d4879 Revise Copyright statement to align with TLF
Recommendation is to avoid using the year nomenclature as this
information is already encoded in the git repo.  Avoids needing to
repeatly update.

Also updates AUTHORS.txt from current repo with contributor names
2025-01-01 14:12:04 -08:00