feat(git): add isFileUncommitted utility and update cancelOutCreate logic

fix(repo): change pull command to standard without rebase
fix(changes): ensure UI refresh after discarding and adding changes
fix(delay-profile): correct label structure for tags in DelayProfileForm
This commit is contained in:
Sam Chau
2025-12-29 01:35:50 +10:30
parent 7db49af4a2
commit 4aa1c0c8e3
5 changed files with 43 additions and 11 deletions

View File

@@ -115,10 +115,10 @@ export async function fetch(repoPath: string): Promise<void> {
}
/**
* Pull with rebase
* Pull from remote
*/
export async function pull(repoPath: string): Promise<void> {
await execGit(['pull', '--rebase'], repoPath);
await execGit(['pull'], repoPath);
}
/**

View File

@@ -133,6 +133,23 @@ export async function getBranches(repoPath: string): Promise<string[]> {
return branches;
}
/**
* Check if a file is uncommitted (untracked or staged but not yet committed)
*/
export async function isFileUncommitted(repoPath: string, filepath: string): Promise<boolean> {
// Get relative path from repo root
const relativePath = filepath.startsWith(repoPath + '/')
? filepath.slice(repoPath.length + 1)
: filepath;
const output = await execGitSafe(['status', '--porcelain', relativePath], repoPath);
if (!output) return false;
const status = output.substring(0, 2);
// ?? = untracked, A = added (staged), AM = added and modified
return status.startsWith('??') || status[0] === 'A';
}
/**
* Get commit history
*/