Fossil SCM
In "fossil git export", export a shunned or missing file as an empty file under its own name, as the comment on gitmirror_send_file() says. A hash that is not found gives a record number of zero, not a negative one, so the check-in was abandoned instead.
Commit
98f68f69d28ba45090e3c5829f5f18d46e6ed8ccaa42b7349f8578c8f325701f
Parent
24256a040bb9a6b…
1 file changed
+2
-7
+2
-7
| --- src/export.c | ||
| +++ src/export.c | ||
| @@ -1007,13 +1007,10 @@ | ||
| 1007 | 1007 | db_reset(&sIns); |
| 1008 | 1008 | return mprintf(":%d", db_last_insert_rowid()); |
| 1009 | 1009 | } |
| 1010 | 1010 | |
| 1011 | 1011 | /* This is the SHA3-256 hash of an empty file */ |
| 1012 | -static const char zEmptySha3[] = | |
| 1013 | - "a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a"; | |
| 1014 | - | |
| 1015 | 1012 | /* |
| 1016 | 1013 | ** Export a single file named by zUuid. |
| 1017 | 1014 | ** |
| 1018 | 1015 | ** Return 0 on success and non-zero on any failure. |
| 1019 | 1016 | ** |
| @@ -1024,26 +1021,24 @@ | ||
| 1024 | 1021 | */ |
| 1025 | 1022 | static int gitmirror_send_file(FILE *xCmd, const char *zUuid, int bPhantomOk){ |
| 1026 | 1023 | char *zMark; |
| 1027 | 1024 | int rid; |
| 1028 | 1025 | int rc; |
| 1029 | - Blob data; | |
| 1026 | + Blob data = BLOB_INITIALIZER; | |
| 1030 | 1027 | rid = fast_uuid_to_rid(zUuid); |
| 1031 | - if( rid<0 ){ | |
| 1028 | + if( rid<=0 ){ | |
| 1032 | 1029 | if( bPhantomOk || uuid_is_shunned(zUuid) ){ |
| 1033 | 1030 | gitmirror_message(VERB_EXTRA, "missing file: %s\n", zUuid); |
| 1034 | - zUuid = zEmptySha3; | |
| 1035 | 1031 | }else{ |
| 1036 | 1032 | return 1; |
| 1037 | 1033 | } |
| 1038 | 1034 | }else{ |
| 1039 | 1035 | rc = content_get(rid, &data); |
| 1040 | 1036 | if( rc==0 ){ |
| 1041 | 1037 | if( bPhantomOk ){ |
| 1042 | 1038 | blob_init(&data, 0, 0); |
| 1043 | 1039 | gitmirror_message(VERB_EXTRA, "missing file: %s\n", zUuid); |
| 1044 | - zUuid = zEmptySha3; | |
| 1045 | 1040 | }else{ |
| 1046 | 1041 | return 1; |
| 1047 | 1042 | } |
| 1048 | 1043 | } |
| 1049 | 1044 | } |
| 1050 | 1045 |
| --- src/export.c | |
| +++ src/export.c | |
| @@ -1007,13 +1007,10 @@ | |
| 1007 | db_reset(&sIns); |
| 1008 | return mprintf(":%d", db_last_insert_rowid()); |
| 1009 | } |
| 1010 | |
| 1011 | /* This is the SHA3-256 hash of an empty file */ |
| 1012 | static const char zEmptySha3[] = |
| 1013 | "a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a"; |
| 1014 | |
| 1015 | /* |
| 1016 | ** Export a single file named by zUuid. |
| 1017 | ** |
| 1018 | ** Return 0 on success and non-zero on any failure. |
| 1019 | ** |
| @@ -1024,26 +1021,24 @@ | |
| 1024 | */ |
| 1025 | static int gitmirror_send_file(FILE *xCmd, const char *zUuid, int bPhantomOk){ |
| 1026 | char *zMark; |
| 1027 | int rid; |
| 1028 | int rc; |
| 1029 | Blob data; |
| 1030 | rid = fast_uuid_to_rid(zUuid); |
| 1031 | if( rid<0 ){ |
| 1032 | if( bPhantomOk || uuid_is_shunned(zUuid) ){ |
| 1033 | gitmirror_message(VERB_EXTRA, "missing file: %s\n", zUuid); |
| 1034 | zUuid = zEmptySha3; |
| 1035 | }else{ |
| 1036 | return 1; |
| 1037 | } |
| 1038 | }else{ |
| 1039 | rc = content_get(rid, &data); |
| 1040 | if( rc==0 ){ |
| 1041 | if( bPhantomOk ){ |
| 1042 | blob_init(&data, 0, 0); |
| 1043 | gitmirror_message(VERB_EXTRA, "missing file: %s\n", zUuid); |
| 1044 | zUuid = zEmptySha3; |
| 1045 | }else{ |
| 1046 | return 1; |
| 1047 | } |
| 1048 | } |
| 1049 | } |
| 1050 |
| --- src/export.c | |
| +++ src/export.c | |
| @@ -1007,13 +1007,10 @@ | |
| 1007 | db_reset(&sIns); |
| 1008 | return mprintf(":%d", db_last_insert_rowid()); |
| 1009 | } |
| 1010 | |
| 1011 | /* This is the SHA3-256 hash of an empty file */ |
| 1012 | /* |
| 1013 | ** Export a single file named by zUuid. |
| 1014 | ** |
| 1015 | ** Return 0 on success and non-zero on any failure. |
| 1016 | ** |
| @@ -1024,26 +1021,24 @@ | |
| 1021 | */ |
| 1022 | static int gitmirror_send_file(FILE *xCmd, const char *zUuid, int bPhantomOk){ |
| 1023 | char *zMark; |
| 1024 | int rid; |
| 1025 | int rc; |
| 1026 | Blob data = BLOB_INITIALIZER; |
| 1027 | rid = fast_uuid_to_rid(zUuid); |
| 1028 | if( rid<=0 ){ |
| 1029 | if( bPhantomOk || uuid_is_shunned(zUuid) ){ |
| 1030 | gitmirror_message(VERB_EXTRA, "missing file: %s\n", zUuid); |
| 1031 | }else{ |
| 1032 | return 1; |
| 1033 | } |
| 1034 | }else{ |
| 1035 | rc = content_get(rid, &data); |
| 1036 | if( rc==0 ){ |
| 1037 | if( bPhantomOk ){ |
| 1038 | blob_init(&data, 0, 0); |
| 1039 | gitmirror_message(VERB_EXTRA, "missing file: %s\n", zUuid); |
| 1040 | }else{ |
| 1041 | return 1; |
| 1042 | } |
| 1043 | } |
| 1044 | } |
| 1045 |