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.

dmestas 2026-11-12 04:04 UTC small-fixes
Commit 98f68f69d28ba45090e3c5829f5f18d46e6ed8ccaa42b7349f8578c8f325701f
1 file changed +2 -7
+2 -7
--- src/export.c
+++ src/export.c
@@ -1007,13 +1007,10 @@
10071007
db_reset(&sIns);
10081008
return mprintf(":%d", db_last_insert_rowid());
10091009
}
10101010
10111011
/* This is the SHA3-256 hash of an empty file */
1012
-static const char zEmptySha3[] =
1013
- "a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a";
1014
-
10151012
/*
10161013
** Export a single file named by zUuid.
10171014
**
10181015
** Return 0 on success and non-zero on any failure.
10191016
**
@@ -1024,26 +1021,24 @@
10241021
*/
10251022
static int gitmirror_send_file(FILE *xCmd, const char *zUuid, int bPhantomOk){
10261023
char *zMark;
10271024
int rid;
10281025
int rc;
1029
- Blob data;
1026
+ Blob data = BLOB_INITIALIZER;
10301027
rid = fast_uuid_to_rid(zUuid);
1031
- if( rid<0 ){
1028
+ if( rid<=0 ){
10321029
if( bPhantomOk || uuid_is_shunned(zUuid) ){
10331030
gitmirror_message(VERB_EXTRA, "missing file: %s\n", zUuid);
1034
- zUuid = zEmptySha3;
10351031
}else{
10361032
return 1;
10371033
}
10381034
}else{
10391035
rc = content_get(rid, &data);
10401036
if( rc==0 ){
10411037
if( bPhantomOk ){
10421038
blob_init(&data, 0, 0);
10431039
gitmirror_message(VERB_EXTRA, "missing file: %s\n", zUuid);
1044
- zUuid = zEmptySha3;
10451040
}else{
10461041
return 1;
10471042
}
10481043
}
10491044
}
10501045
--- 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

Keyboard Shortcuts

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