Fossil SCM
Additional fixes to the "fossil import" command. Correct handling of zero-length content files. Correct handling of merges with no new or modified files.
Commit
3873aa7ecb90bce176bafaa8296102e371a49088
Parent
9c31866404f1c09…
1 file changed
+7
-6
+7
-6
| --- src/import.c | ||
| +++ src/import.c | ||
| @@ -148,16 +148,13 @@ | ||
| 148 | 148 | ** Use data accumulated in gg from a "blob" record to add a new file |
| 149 | 149 | ** to the BLOB table. |
| 150 | 150 | */ |
| 151 | 151 | static void finish_blob(void){ |
| 152 | 152 | Blob content; |
| 153 | - | |
| 154 | - if( gg.nData>0 ){ | |
| 155 | - blob_init(&content, gg.aData, gg.nData); | |
| 156 | - fast_insert_content(&content, gg.zMark); | |
| 157 | - blob_reset(&content); | |
| 158 | - } | |
| 153 | + blob_init(&content, gg.aData, gg.nData); | |
| 154 | + fast_insert_content(&content, gg.zMark); | |
| 155 | + blob_reset(&content); | |
| 159 | 156 | import_reset(0); |
| 160 | 157 | } |
| 161 | 158 | |
| 162 | 159 | /* |
| 163 | 160 | ** Use data accumulated in gg from a "tag" record to add a new |
| @@ -186,18 +183,22 @@ | ||
| 186 | 183 | const ImportFile *pA = (const ImportFile*)pLeft; |
| 187 | 184 | const ImportFile *pB = (const ImportFile*)pRight; |
| 188 | 185 | return strcmp(pA->zName, pB->zName); |
| 189 | 186 | } |
| 190 | 187 | |
| 188 | +/* Forward reference */ | |
| 189 | +static void import_prior_files(void); | |
| 190 | + | |
| 191 | 191 | /* |
| 192 | 192 | ** Use data accumulated in gg from a "commit" record to add a new |
| 193 | 193 | ** manifest artifact to the BLOB table. |
| 194 | 194 | */ |
| 195 | 195 | static void finish_commit(void){ |
| 196 | 196 | int i; |
| 197 | 197 | char *zFromBranch; |
| 198 | 198 | Blob record, cksum; |
| 199 | + import_prior_files(); | |
| 199 | 200 | qsort(gg.aFile, gg.nFile, sizeof(gg.aFile[0]), mfile_cmp); |
| 200 | 201 | blob_zero(&record); |
| 201 | 202 | blob_appendf(&record, "C %F\n", gg.zComment); |
| 202 | 203 | blob_appendf(&record, "D %s\n", gg.zDate); |
| 203 | 204 | for(i=0; i<gg.nFile; i++){ |
| 204 | 205 |
| --- src/import.c | |
| +++ src/import.c | |
| @@ -148,16 +148,13 @@ | |
| 148 | ** Use data accumulated in gg from a "blob" record to add a new file |
| 149 | ** to the BLOB table. |
| 150 | */ |
| 151 | static void finish_blob(void){ |
| 152 | Blob content; |
| 153 | |
| 154 | if( gg.nData>0 ){ |
| 155 | blob_init(&content, gg.aData, gg.nData); |
| 156 | fast_insert_content(&content, gg.zMark); |
| 157 | blob_reset(&content); |
| 158 | } |
| 159 | import_reset(0); |
| 160 | } |
| 161 | |
| 162 | /* |
| 163 | ** Use data accumulated in gg from a "tag" record to add a new |
| @@ -186,18 +183,22 @@ | |
| 186 | const ImportFile *pA = (const ImportFile*)pLeft; |
| 187 | const ImportFile *pB = (const ImportFile*)pRight; |
| 188 | return strcmp(pA->zName, pB->zName); |
| 189 | } |
| 190 | |
| 191 | /* |
| 192 | ** Use data accumulated in gg from a "commit" record to add a new |
| 193 | ** manifest artifact to the BLOB table. |
| 194 | */ |
| 195 | static void finish_commit(void){ |
| 196 | int i; |
| 197 | char *zFromBranch; |
| 198 | Blob record, cksum; |
| 199 | qsort(gg.aFile, gg.nFile, sizeof(gg.aFile[0]), mfile_cmp); |
| 200 | blob_zero(&record); |
| 201 | blob_appendf(&record, "C %F\n", gg.zComment); |
| 202 | blob_appendf(&record, "D %s\n", gg.zDate); |
| 203 | for(i=0; i<gg.nFile; i++){ |
| 204 |
| --- src/import.c | |
| +++ src/import.c | |
| @@ -148,16 +148,13 @@ | |
| 148 | ** Use data accumulated in gg from a "blob" record to add a new file |
| 149 | ** to the BLOB table. |
| 150 | */ |
| 151 | static void finish_blob(void){ |
| 152 | Blob content; |
| 153 | blob_init(&content, gg.aData, gg.nData); |
| 154 | fast_insert_content(&content, gg.zMark); |
| 155 | blob_reset(&content); |
| 156 | import_reset(0); |
| 157 | } |
| 158 | |
| 159 | /* |
| 160 | ** Use data accumulated in gg from a "tag" record to add a new |
| @@ -186,18 +183,22 @@ | |
| 183 | const ImportFile *pA = (const ImportFile*)pLeft; |
| 184 | const ImportFile *pB = (const ImportFile*)pRight; |
| 185 | return strcmp(pA->zName, pB->zName); |
| 186 | } |
| 187 | |
| 188 | /* Forward reference */ |
| 189 | static void import_prior_files(void); |
| 190 | |
| 191 | /* |
| 192 | ** Use data accumulated in gg from a "commit" record to add a new |
| 193 | ** manifest artifact to the BLOB table. |
| 194 | */ |
| 195 | static void finish_commit(void){ |
| 196 | int i; |
| 197 | char *zFromBranch; |
| 198 | Blob record, cksum; |
| 199 | import_prior_files(); |
| 200 | qsort(gg.aFile, gg.nFile, sizeof(gg.aFile[0]), mfile_cmp); |
| 201 | blob_zero(&record); |
| 202 | blob_appendf(&record, "C %F\n", gg.zComment); |
| 203 | blob_appendf(&record, "D %s\n", gg.zDate); |
| 204 | for(i=0; i<gg.nFile; i++){ |
| 205 |