Spaces:
Paused
Paused
Fix status check in GitHub sync
Browse files
server/src/services/githubSyncService.ts
CHANGED
|
@@ -48,6 +48,9 @@ export async function runGithubSync(): Promise<void> {
|
|
| 48 |
const destDbPath = path.join(syncDir, 'travel.db');
|
| 49 |
fs.copyFileSync(dbPath, destDbPath);
|
| 50 |
|
|
|
|
|
|
|
|
|
|
| 51 |
// Check if there are changes
|
| 52 |
const status = execSync(`git -C ${syncDir} status --porcelain`, { encoding: 'utf8' });
|
| 53 |
if (!status) {
|
|
@@ -56,7 +59,6 @@ export async function runGithubSync(): Promise<void> {
|
|
| 56 |
}
|
| 57 |
|
| 58 |
logInfo('GitHub Sync: Committing and pushing changes');
|
| 59 |
-
execSync(`git -C ${syncDir} add -f travel.db`, { stdio: 'ignore' });
|
| 60 |
execSync(`git -C ${syncDir} -c user.name="TREK Sync" -c user.email="sync@trek.local" commit -m "Update database: ${new Date().toISOString()}"`, { stdio: 'ignore' });
|
| 61 |
execSync(`git -C ${syncDir} push origin ${BRANCH}`, { stdio: 'ignore' });
|
| 62 |
logInfo('GitHub Sync: Success');
|
|
|
|
| 48 |
const destDbPath = path.join(syncDir, 'travel.db');
|
| 49 |
fs.copyFileSync(dbPath, destDbPath);
|
| 50 |
|
| 51 |
+
// Force add because .db is usually ignored in TREK
|
| 52 |
+
execSync(`git -C ${syncDir} add -f travel.db`, { stdio: 'ignore' });
|
| 53 |
+
|
| 54 |
// Check if there are changes
|
| 55 |
const status = execSync(`git -C ${syncDir} status --porcelain`, { encoding: 'utf8' });
|
| 56 |
if (!status) {
|
|
|
|
| 59 |
}
|
| 60 |
|
| 61 |
logInfo('GitHub Sync: Committing and pushing changes');
|
|
|
|
| 62 |
execSync(`git -C ${syncDir} -c user.name="TREK Sync" -c user.email="sync@trek.local" commit -m "Update database: ${new Date().toISOString()}"`, { stdio: 'ignore' });
|
| 63 |
execSync(`git -C ${syncDir} push origin ${BRANCH}`, { stdio: 'ignore' });
|
| 64 |
logInfo('GitHub Sync: Success');
|