mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-02-18 13:47:45 +01:00
- Replace git pull with fetch + merge to avoid conflicts with global git config (e.g. pull.ff=only) and background fetch --all - Disable commit/commit+push buttons when message is empty - Always show Push/Pull menu items even without remotes configured - Default remote name to 'origin' when adding a new remote
27 lines
951 B
TypeScript
27 lines
951 B
TypeScript
import type { GitCallbacks } from '@yaakapp-internal/git';
|
|
import { sync } from '../../init/sync';
|
|
import { promptCredentials } from './credentials';
|
|
import { promptDivergedStrategy } from './diverged';
|
|
import { addGitRemote } from './showAddRemoteDialog';
|
|
import { promptUncommittedChangesStrategy } from './uncommitted';
|
|
|
|
export function gitCallbacks(dir: string): GitCallbacks {
|
|
return {
|
|
addRemote: async () => {
|
|
return addGitRemote(dir, 'origin');
|
|
},
|
|
promptCredentials: async ({ url, error }) => {
|
|
const creds = await promptCredentials({ url, error });
|
|
if (creds == null) throw new Error('Cancelled credentials prompt');
|
|
return creds;
|
|
},
|
|
promptDiverged: async ({ remote, branch }) => {
|
|
return promptDivergedStrategy({ remote, branch });
|
|
},
|
|
promptUncommittedChanges: async () => {
|
|
return promptUncommittedChangesStrategy();
|
|
},
|
|
forceSync: () => sync({ force: true }),
|
|
};
|
|
}
|