Skip to content

Commit

Permalink
added git safe.directory flag to support git repos on network drives …
Browse files Browse the repository at this point in the history
…(security implications accepted by community)
  • Loading branch information
JonasLukasczyk committed Dec 20, 2024
1 parent 222733d commit 93c5cef
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions packages/renderer/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -161,22 +161,21 @@ onMounted(async () => {
}
console.log(git_lfs_running[1]);
const git_config = (await window.ipc.invoke('GitService.run', {
args: [`config`,`--list`]
}))[1].split('\n');
// check if lfs installed
{
const git_config = await window.ipc.invoke('GitService.run', {
args: [`config`,`--list`]
});
const lfs_checks = [
'filter.lfs.process=git-lfs filter-process',
'filter.lfs.required=true',
'filter.lfs.clean=git-lfs clean -- %f',
'filter.lfs.smudge=git-lfs smudge -- %f'
];
const lines = git_config[1].split('\n');
let lfs_installed = true;
for(let check of lfs_checks)
if(!lines.includes(check)) lfs_installed = false;
if(!git_config.includes(check)) lfs_installed = false;
if(!lfs_installed){
console.log('installing git lfs');
await window.ipc.invoke('GitService.run', {
Expand All @@ -187,9 +186,16 @@ onMounted(async () => {
// add common git flags
{
// enable network paths (possible git authentication credential leak but requested by community)
if(!git_config.includes(`safe.directory=*`))
await window.ipc.invoke('GitService.run', {
args: [`config`,`--global`,`--add`, `safe.directory`, `"*"`]
});
// prevent lfs timeouts
await window.ipc.invoke('GitService.run', {
args: [`config`,`--global`,`lfs.activitytimeout`, `0`]
});
// enable long paths on windows
await window.ipc.invoke('GitService.run', {
args: [`config`,`--global`,`core.longpaths`,`true`]
});
Expand Down

0 comments on commit 93c5cef

Please sign in to comment.