Fossil SCM

Fix the "fossil git export" command so that it returns a non-zero exit code if the "git push" command fails.

drh 2021-02-18 13:10 trunk
Commit da5faf18c3699d5c521695aed2e6069568e374111a2228de231984d1b255c5fe
1 file changed +5 -2
+5 -2
--- src/export.c
+++ src/export.c
@@ -1324,11 +1324,11 @@
13241324
/* Create a new Git repository at zMirror */
13251325
zCmd = mprintf("git init %$", zMirror);
13261326
gitmirror_message(VERB_NORMAL, "%s\n", zCmd);
13271327
rc = fossil_system(zCmd);
13281328
if( rc ){
1329
- fossil_fatal("cannot initialize git repository using: %s\n", zCmd);
1329
+ fossil_fatal("cannot initialize git repository using: %s", zCmd);
13301330
}
13311331
fossil_free(zCmd);
13321332
13331333
/* Must be in the new Git repository directory for subsequent commands */
13341334
rc = file_chdir(zMirror, 0);
@@ -1718,11 +1718,14 @@
17181718
zPushCmd = mprintf("git push --mirror %s", zPushUrl);
17191719
}
17201720
gitmirror_message(VERB_NORMAL, "%s\n", zPushCmd);
17211721
fossil_free(zPushCmd);
17221722
zPushCmd = mprintf("git push --mirror %$", zPushUrl);
1723
- fossil_system(zPushCmd);
1723
+ rc = fossil_system(zPushCmd);
1724
+ if( rc ){
1725
+ fossil_fatal("cannot push content using: %s", zPushCmd);
1726
+ }
17241727
fossil_free(zPushCmd);
17251728
}
17261729
}
17271730
17281731
/*
17291732
--- src/export.c
+++ src/export.c
@@ -1324,11 +1324,11 @@
1324 /* Create a new Git repository at zMirror */
1325 zCmd = mprintf("git init %$", zMirror);
1326 gitmirror_message(VERB_NORMAL, "%s\n", zCmd);
1327 rc = fossil_system(zCmd);
1328 if( rc ){
1329 fossil_fatal("cannot initialize git repository using: %s\n", zCmd);
1330 }
1331 fossil_free(zCmd);
1332
1333 /* Must be in the new Git repository directory for subsequent commands */
1334 rc = file_chdir(zMirror, 0);
@@ -1718,11 +1718,14 @@
1718 zPushCmd = mprintf("git push --mirror %s", zPushUrl);
1719 }
1720 gitmirror_message(VERB_NORMAL, "%s\n", zPushCmd);
1721 fossil_free(zPushCmd);
1722 zPushCmd = mprintf("git push --mirror %$", zPushUrl);
1723 fossil_system(zPushCmd);
 
 
 
1724 fossil_free(zPushCmd);
1725 }
1726 }
1727
1728 /*
1729
--- src/export.c
+++ src/export.c
@@ -1324,11 +1324,11 @@
1324 /* Create a new Git repository at zMirror */
1325 zCmd = mprintf("git init %$", zMirror);
1326 gitmirror_message(VERB_NORMAL, "%s\n", zCmd);
1327 rc = fossil_system(zCmd);
1328 if( rc ){
1329 fossil_fatal("cannot initialize git repository using: %s", zCmd);
1330 }
1331 fossil_free(zCmd);
1332
1333 /* Must be in the new Git repository directory for subsequent commands */
1334 rc = file_chdir(zMirror, 0);
@@ -1718,11 +1718,14 @@
1718 zPushCmd = mprintf("git push --mirror %s", zPushUrl);
1719 }
1720 gitmirror_message(VERB_NORMAL, "%s\n", zPushCmd);
1721 fossil_free(zPushCmd);
1722 zPushCmd = mprintf("git push --mirror %$", zPushUrl);
1723 rc = fossil_system(zPushCmd);
1724 if( rc ){
1725 fossil_fatal("cannot push content using: %s", zPushCmd);
1726 }
1727 fossil_free(zPushCmd);
1728 }
1729 }
1730
1731 /*
1732

Keyboard Shortcuts

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