Fossil SCM

Exit with non-zero code when the pull/push/sync commands fail. Reported off-list by Dan Mestas.

danield 2026-10-15 13:00 UTC trunk
Commit 1cda9ec21038f578e2a6a53db20ded9e39f5550d63a3f2f23c0e24196f52208e
1 file changed +10 -4
+10 -4
--- src/sync.c
+++ src/sync.c
@@ -46,11 +46,11 @@
4646
4747
4848
/*
4949
** Call client_sync() one or more times in order to complete a
5050
** sync operation. Usually, client_sync() is called only once, though
51
-** is can be called multiple times if the SYNC_ALLURL flags is set.
51
+** it can be called multiple times if the SYNC_ALLURL flags is set.
5252
*/
5353
static int client_sync_all_urls(
5454
unsigned syncFlags, /* Mask of SYNC_* flags */
5555
unsigned configRcvMask, /* Receive these configuration items */
5656
unsigned configSendMask, /* Send these configuration items */
@@ -408,11 +408,13 @@
408408
process_sync_args(&configFlags, &syncFlags, 0, urlOmitFlags);
409409
410410
/* We should be done with options.. */
411411
verify_all_options();
412412
413
- client_sync_all_urls(syncFlags, configFlags, 0, zAltPCode);
413
+ if( client_sync_all_urls(syncFlags, configFlags, 0, zAltPCode)!=0 ){
414
+ fossil_exit(1);
415
+ }
414416
}
415417
416418
/*
417419
** COMMAND: push
418420
**
@@ -458,11 +460,13 @@
458460
verify_all_options();
459461
460462
if( db_get_boolean("dont-push",0) ){
461463
fossil_fatal("pushing is prohibited: the 'dont-push' option is set");
462464
}
463
- client_sync_all_urls(syncFlags, 0, 0, 0);
465
+ if( client_sync_all_urls(syncFlags, 0, 0, 0)!=0 ){
466
+ fossil_exit(1);
467
+ }
464468
}
465469
466470
467471
/*
468472
** COMMAND: sync
@@ -524,11 +528,13 @@
524528
if( db_get_boolean("dont-push",0) ) syncFlags &= ~SYNC_PUSH;
525529
if( (syncFlags & SYNC_PUSH)==0 ){
526530
fossil_warning("pull only: the 'dont-push' option is set");
527531
}
528532
}
529
- client_sync_all_urls(syncFlags, configFlags, 0, 0);
533
+ if( client_sync_all_urls(syncFlags, configFlags, 0, 0)!=0 ){
534
+ fossil_exit(1);
535
+ }
530536
}
531537
532538
/*
533539
** Handle the "fossil unversioned sync" and "fossil unversioned revert"
534540
** commands.
535541
--- src/sync.c
+++ src/sync.c
@@ -46,11 +46,11 @@
46
47
48 /*
49 ** Call client_sync() one or more times in order to complete a
50 ** sync operation. Usually, client_sync() is called only once, though
51 ** is can be called multiple times if the SYNC_ALLURL flags is set.
52 */
53 static int client_sync_all_urls(
54 unsigned syncFlags, /* Mask of SYNC_* flags */
55 unsigned configRcvMask, /* Receive these configuration items */
56 unsigned configSendMask, /* Send these configuration items */
@@ -408,11 +408,13 @@
408 process_sync_args(&configFlags, &syncFlags, 0, urlOmitFlags);
409
410 /* We should be done with options.. */
411 verify_all_options();
412
413 client_sync_all_urls(syncFlags, configFlags, 0, zAltPCode);
 
 
414 }
415
416 /*
417 ** COMMAND: push
418 **
@@ -458,11 +460,13 @@
458 verify_all_options();
459
460 if( db_get_boolean("dont-push",0) ){
461 fossil_fatal("pushing is prohibited: the 'dont-push' option is set");
462 }
463 client_sync_all_urls(syncFlags, 0, 0, 0);
 
 
464 }
465
466
467 /*
468 ** COMMAND: sync
@@ -524,11 +528,13 @@
524 if( db_get_boolean("dont-push",0) ) syncFlags &= ~SYNC_PUSH;
525 if( (syncFlags & SYNC_PUSH)==0 ){
526 fossil_warning("pull only: the 'dont-push' option is set");
527 }
528 }
529 client_sync_all_urls(syncFlags, configFlags, 0, 0);
 
 
530 }
531
532 /*
533 ** Handle the "fossil unversioned sync" and "fossil unversioned revert"
534 ** commands.
535
--- src/sync.c
+++ src/sync.c
@@ -46,11 +46,11 @@
46
47
48 /*
49 ** Call client_sync() one or more times in order to complete a
50 ** sync operation. Usually, client_sync() is called only once, though
51 ** it can be called multiple times if the SYNC_ALLURL flags is set.
52 */
53 static int client_sync_all_urls(
54 unsigned syncFlags, /* Mask of SYNC_* flags */
55 unsigned configRcvMask, /* Receive these configuration items */
56 unsigned configSendMask, /* Send these configuration items */
@@ -408,11 +408,13 @@
408 process_sync_args(&configFlags, &syncFlags, 0, urlOmitFlags);
409
410 /* We should be done with options.. */
411 verify_all_options();
412
413 if( client_sync_all_urls(syncFlags, configFlags, 0, zAltPCode)!=0 ){
414 fossil_exit(1);
415 }
416 }
417
418 /*
419 ** COMMAND: push
420 **
@@ -458,11 +460,13 @@
460 verify_all_options();
461
462 if( db_get_boolean("dont-push",0) ){
463 fossil_fatal("pushing is prohibited: the 'dont-push' option is set");
464 }
465 if( client_sync_all_urls(syncFlags, 0, 0, 0)!=0 ){
466 fossil_exit(1);
467 }
468 }
469
470
471 /*
472 ** COMMAND: sync
@@ -524,11 +528,13 @@
528 if( db_get_boolean("dont-push",0) ) syncFlags &= ~SYNC_PUSH;
529 if( (syncFlags & SYNC_PUSH)==0 ){
530 fossil_warning("pull only: the 'dont-push' option is set");
531 }
532 }
533 if( client_sync_all_urls(syncFlags, configFlags, 0, 0)!=0 ){
534 fossil_exit(1);
535 }
536 }
537
538 /*
539 ** Handle the "fossil unversioned sync" and "fossil unversioned revert"
540 ** commands.
541

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button