Fossil SCM
Comments and formatting.
Commit
1b253c23dee54dc2017f87cc99ef6590d9854781876a6d274b2d1ad208cee585
Parent
3669e957a52091d…
1 file changed
+16
-13
+16
-13
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -2752,17 +2752,22 @@ | ||
| 2752 | 2752 | CKIN1_ALLOW_CLOSED_LEAF = 1<<4 |
| 2753 | 2753 | }; |
| 2754 | 2754 | |
| 2755 | 2755 | /* |
| 2756 | 2756 | ** Creates a manifest file, written to pOut, from the state in the |
| 2757 | -** fully-populated pCI argument. Returns true on success. On error, | |
| 2758 | -** returns 0 and, if pErr is not NULL, writes an error message there. | |
| 2757 | +** fully-populated pCI argument. pCI is not *semantically* modified | |
| 2758 | +** but cannot be const because blob_str() may need to NUL-terminate | |
| 2759 | +** any given blob. | |
| 2760 | +** | |
| 2761 | +** Returns true on success. On error, returns 0 and, if pErr is not | |
| 2762 | +** NULL, writes an error message there. | |
| 2759 | 2763 | */ |
| 2760 | -static int create_manifest_one_file( Blob * pOut, CheckinOneFileInfo * pCI, | |
| 2764 | +static int create_manifest_one_file( Blob * pOut, | |
| 2765 | + CheckinOneFileInfo * pCI, | |
| 2761 | 2766 | Blob * pErr){ |
| 2762 | 2767 | Blob zCard = empty_blob; /* Z-card checksum */ |
| 2763 | - ManifestFile *zFile; /* One file entry from the pCI->pParent */ | |
| 2768 | + ManifestFile *zFile; /* One file entry from the pCI->pParent*/ | |
| 2764 | 2769 | int cmp = -99; /* filename comparison result */ |
| 2765 | 2770 | int fperm = 0; /* file permissions */ |
| 2766 | 2771 | const char *zPerm = 0; /* permissions for new F-card */ |
| 2767 | 2772 | const char *zFilename = 0; /* filename to use for F-card */ |
| 2768 | 2773 | const char *zUuid = 0; /* UUID for F-card */ |
| @@ -2777,15 +2782,11 @@ | ||
| 2777 | 2782 | assert(pCI->zUser); |
| 2778 | 2783 | |
| 2779 | 2784 | #define mf_err(EXPR) if(pErr) blob_appendf EXPR; return 0 |
| 2780 | 2785 | /* Potential TODOs include... |
| 2781 | 2786 | ** - Create a delta manifest, if possible, rather than a baseline. |
| 2782 | - ** - Enable adding of new files? It's implemented by disabled until | |
| 2783 | - ** we at least ensure that pCI->zFilename is a path-relative | |
| 2784 | - ** filename. | |
| 2785 | 2787 | ** - Maybe add support for tags. Those can be edited via /info page. |
| 2786 | - ** - Check for a commit to a closed leaf and re-open it. | |
| 2787 | 2788 | ** - Symlinks: if we're really in a checkout, handle commit/add of |
| 2788 | 2789 | ** symlinks like a normal commit would. For now we bail out if |
| 2789 | 2790 | ** told to handle a symlink because there would seem to be no(?) |
| 2790 | 2791 | ** sensible way to handle a symlink add/checkin without a |
| 2791 | 2792 | ** checkout. |
| @@ -2900,12 +2901,12 @@ | ||
| 2900 | 2901 | ** |
| 2901 | 2902 | ** Returns true on success. If pRid is not NULL, the RID of the |
| 2902 | 2903 | ** resulting manifest is written to *pRid. |
| 2903 | 2904 | ** |
| 2904 | 2905 | ** ckin1Flags is a bitmask of optional flags from fossil_ckin1_flags |
| 2905 | -** enum. See that enum for the docs for each flag. | |
| 2906 | -** | |
| 2906 | +** enum. See that enum for the docs for each flag. Pass 0 for no | |
| 2907 | +** flags. | |
| 2907 | 2908 | */ |
| 2908 | 2909 | static int checkin_one_file( CheckinOneFileInfo * pCI, int *pRid, |
| 2909 | 2910 | int ckin1Flags, Blob * pErr ){ |
| 2910 | 2911 | Blob mf = empty_blob; /* output manifest */ |
| 2911 | 2912 | int rid = 0, frid = 0; /* various RIDs */ |
| @@ -2943,20 +2944,22 @@ | ||
| 2943 | 2944 | } |
| 2944 | 2945 | /* Potential TODOs include: |
| 2945 | 2946 | ** |
| 2946 | 2947 | ** - Commit allows an empty checkin only with a flag, but we |
| 2947 | 2948 | ** currently disallow it entirely. Conform with commit? |
| 2948 | - ** - Check for a commit lock. | |
| 2949 | + ** | |
| 2950 | + ** - Check for a commit lock would require auto-sync, which this | |
| 2951 | + ** code cannot do if it's going to be run via a web page. | |
| 2949 | 2952 | */ |
| 2950 | 2953 | |
| 2951 | 2954 | /* |
| 2952 | 2955 | ** Confirm that pCI->zFilename can be found in pCI->pParent. If |
| 2953 | 2956 | ** not, fail. This is admittedly an artificial limitation, not |
| 2954 | 2957 | ** strictly necessary. We do it to hopefully reduce the chance of an |
| 2955 | 2958 | ** "oops" where file X/Y/z gets committed as X/Y/Z due to a typo or |
| 2956 | - ** case-sensitivity mismatch between the user and repo, or some | |
| 2957 | - ** such. | |
| 2959 | + ** case-sensitivity mismatch between the user/repo/filesystem, or | |
| 2960 | + ** some such. | |
| 2958 | 2961 | */ |
| 2959 | 2962 | manifest_file_rewind(pCI->pParent); |
| 2960 | 2963 | zFile = manifest_file_seek(pCI->pParent, pCI->zFilename, 0); |
| 2961 | 2964 | if(!zFile){ |
| 2962 | 2965 | ci_err((pErr,"File [%s] not found in manifest [%S]. " |
| 2963 | 2966 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -2752,17 +2752,22 @@ | |
| 2752 | CKIN1_ALLOW_CLOSED_LEAF = 1<<4 |
| 2753 | }; |
| 2754 | |
| 2755 | /* |
| 2756 | ** Creates a manifest file, written to pOut, from the state in the |
| 2757 | ** fully-populated pCI argument. Returns true on success. On error, |
| 2758 | ** returns 0 and, if pErr is not NULL, writes an error message there. |
| 2759 | */ |
| 2760 | static int create_manifest_one_file( Blob * pOut, CheckinOneFileInfo * pCI, |
| 2761 | Blob * pErr){ |
| 2762 | Blob zCard = empty_blob; /* Z-card checksum */ |
| 2763 | ManifestFile *zFile; /* One file entry from the pCI->pParent */ |
| 2764 | int cmp = -99; /* filename comparison result */ |
| 2765 | int fperm = 0; /* file permissions */ |
| 2766 | const char *zPerm = 0; /* permissions for new F-card */ |
| 2767 | const char *zFilename = 0; /* filename to use for F-card */ |
| 2768 | const char *zUuid = 0; /* UUID for F-card */ |
| @@ -2777,15 +2782,11 @@ | |
| 2777 | assert(pCI->zUser); |
| 2778 | |
| 2779 | #define mf_err(EXPR) if(pErr) blob_appendf EXPR; return 0 |
| 2780 | /* Potential TODOs include... |
| 2781 | ** - Create a delta manifest, if possible, rather than a baseline. |
| 2782 | ** - Enable adding of new files? It's implemented by disabled until |
| 2783 | ** we at least ensure that pCI->zFilename is a path-relative |
| 2784 | ** filename. |
| 2785 | ** - Maybe add support for tags. Those can be edited via /info page. |
| 2786 | ** - Check for a commit to a closed leaf and re-open it. |
| 2787 | ** - Symlinks: if we're really in a checkout, handle commit/add of |
| 2788 | ** symlinks like a normal commit would. For now we bail out if |
| 2789 | ** told to handle a symlink because there would seem to be no(?) |
| 2790 | ** sensible way to handle a symlink add/checkin without a |
| 2791 | ** checkout. |
| @@ -2900,12 +2901,12 @@ | |
| 2900 | ** |
| 2901 | ** Returns true on success. If pRid is not NULL, the RID of the |
| 2902 | ** resulting manifest is written to *pRid. |
| 2903 | ** |
| 2904 | ** ckin1Flags is a bitmask of optional flags from fossil_ckin1_flags |
| 2905 | ** enum. See that enum for the docs for each flag. |
| 2906 | ** |
| 2907 | */ |
| 2908 | static int checkin_one_file( CheckinOneFileInfo * pCI, int *pRid, |
| 2909 | int ckin1Flags, Blob * pErr ){ |
| 2910 | Blob mf = empty_blob; /* output manifest */ |
| 2911 | int rid = 0, frid = 0; /* various RIDs */ |
| @@ -2943,20 +2944,22 @@ | |
| 2943 | } |
| 2944 | /* Potential TODOs include: |
| 2945 | ** |
| 2946 | ** - Commit allows an empty checkin only with a flag, but we |
| 2947 | ** currently disallow it entirely. Conform with commit? |
| 2948 | ** - Check for a commit lock. |
| 2949 | */ |
| 2950 | |
| 2951 | /* |
| 2952 | ** Confirm that pCI->zFilename can be found in pCI->pParent. If |
| 2953 | ** not, fail. This is admittedly an artificial limitation, not |
| 2954 | ** strictly necessary. We do it to hopefully reduce the chance of an |
| 2955 | ** "oops" where file X/Y/z gets committed as X/Y/Z due to a typo or |
| 2956 | ** case-sensitivity mismatch between the user and repo, or some |
| 2957 | ** such. |
| 2958 | */ |
| 2959 | manifest_file_rewind(pCI->pParent); |
| 2960 | zFile = manifest_file_seek(pCI->pParent, pCI->zFilename, 0); |
| 2961 | if(!zFile){ |
| 2962 | ci_err((pErr,"File [%s] not found in manifest [%S]. " |
| 2963 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -2752,17 +2752,22 @@ | |
| 2752 | CKIN1_ALLOW_CLOSED_LEAF = 1<<4 |
| 2753 | }; |
| 2754 | |
| 2755 | /* |
| 2756 | ** Creates a manifest file, written to pOut, from the state in the |
| 2757 | ** fully-populated pCI argument. pCI is not *semantically* modified |
| 2758 | ** but cannot be const because blob_str() may need to NUL-terminate |
| 2759 | ** any given blob. |
| 2760 | ** |
| 2761 | ** Returns true on success. On error, returns 0 and, if pErr is not |
| 2762 | ** NULL, writes an error message there. |
| 2763 | */ |
| 2764 | static int create_manifest_one_file( Blob * pOut, |
| 2765 | CheckinOneFileInfo * pCI, |
| 2766 | Blob * pErr){ |
| 2767 | Blob zCard = empty_blob; /* Z-card checksum */ |
| 2768 | ManifestFile *zFile; /* One file entry from the pCI->pParent*/ |
| 2769 | int cmp = -99; /* filename comparison result */ |
| 2770 | int fperm = 0; /* file permissions */ |
| 2771 | const char *zPerm = 0; /* permissions for new F-card */ |
| 2772 | const char *zFilename = 0; /* filename to use for F-card */ |
| 2773 | const char *zUuid = 0; /* UUID for F-card */ |
| @@ -2777,15 +2782,11 @@ | |
| 2782 | assert(pCI->zUser); |
| 2783 | |
| 2784 | #define mf_err(EXPR) if(pErr) blob_appendf EXPR; return 0 |
| 2785 | /* Potential TODOs include... |
| 2786 | ** - Create a delta manifest, if possible, rather than a baseline. |
| 2787 | ** - Maybe add support for tags. Those can be edited via /info page. |
| 2788 | ** - Symlinks: if we're really in a checkout, handle commit/add of |
| 2789 | ** symlinks like a normal commit would. For now we bail out if |
| 2790 | ** told to handle a symlink because there would seem to be no(?) |
| 2791 | ** sensible way to handle a symlink add/checkin without a |
| 2792 | ** checkout. |
| @@ -2900,12 +2901,12 @@ | |
| 2901 | ** |
| 2902 | ** Returns true on success. If pRid is not NULL, the RID of the |
| 2903 | ** resulting manifest is written to *pRid. |
| 2904 | ** |
| 2905 | ** ckin1Flags is a bitmask of optional flags from fossil_ckin1_flags |
| 2906 | ** enum. See that enum for the docs for each flag. Pass 0 for no |
| 2907 | ** flags. |
| 2908 | */ |
| 2909 | static int checkin_one_file( CheckinOneFileInfo * pCI, int *pRid, |
| 2910 | int ckin1Flags, Blob * pErr ){ |
| 2911 | Blob mf = empty_blob; /* output manifest */ |
| 2912 | int rid = 0, frid = 0; /* various RIDs */ |
| @@ -2943,20 +2944,22 @@ | |
| 2944 | } |
| 2945 | /* Potential TODOs include: |
| 2946 | ** |
| 2947 | ** - Commit allows an empty checkin only with a flag, but we |
| 2948 | ** currently disallow it entirely. Conform with commit? |
| 2949 | ** |
| 2950 | ** - Check for a commit lock would require auto-sync, which this |
| 2951 | ** code cannot do if it's going to be run via a web page. |
| 2952 | */ |
| 2953 | |
| 2954 | /* |
| 2955 | ** Confirm that pCI->zFilename can be found in pCI->pParent. If |
| 2956 | ** not, fail. This is admittedly an artificial limitation, not |
| 2957 | ** strictly necessary. We do it to hopefully reduce the chance of an |
| 2958 | ** "oops" where file X/Y/z gets committed as X/Y/Z due to a typo or |
| 2959 | ** case-sensitivity mismatch between the user/repo/filesystem, or |
| 2960 | ** some such. |
| 2961 | */ |
| 2962 | manifest_file_rewind(pCI->pParent); |
| 2963 | zFile = manifest_file_seek(pCI->pParent, pCI->zFilename, 0); |
| 2964 | if(!zFile){ |
| 2965 | ci_err((pErr,"File [%s] not found in manifest [%S]. " |
| 2966 |