Fossil SCM

Comments and formatting.

stephan 2020-04-28 15:23 checkin-without-checkout
Commit 1b253c23dee54dc2017f87cc99ef6590d9854781876a6d274b2d1ad208cee585
1 file changed +16 -13
+16 -13
--- src/checkin.c
+++ src/checkin.c
@@ -2752,17 +2752,22 @@
27522752
CKIN1_ALLOW_CLOSED_LEAF = 1<<4
27532753
};
27542754
27552755
/*
27562756
** 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.
27592763
*/
2760
-static int create_manifest_one_file( Blob * pOut, CheckinOneFileInfo * pCI,
2764
+static int create_manifest_one_file( Blob * pOut,
2765
+ CheckinOneFileInfo * pCI,
27612766
Blob * pErr){
27622767
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*/
27642769
int cmp = -99; /* filename comparison result */
27652770
int fperm = 0; /* file permissions */
27662771
const char *zPerm = 0; /* permissions for new F-card */
27672772
const char *zFilename = 0; /* filename to use for F-card */
27682773
const char *zUuid = 0; /* UUID for F-card */
@@ -2777,15 +2782,11 @@
27772782
assert(pCI->zUser);
27782783
27792784
#define mf_err(EXPR) if(pErr) blob_appendf EXPR; return 0
27802785
/* Potential TODOs include...
27812786
** - 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.
27852787
** - 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.
27872788
** - Symlinks: if we're really in a checkout, handle commit/add of
27882789
** symlinks like a normal commit would. For now we bail out if
27892790
** told to handle a symlink because there would seem to be no(?)
27902791
** sensible way to handle a symlink add/checkin without a
27912792
** checkout.
@@ -2900,12 +2901,12 @@
29002901
**
29012902
** Returns true on success. If pRid is not NULL, the RID of the
29022903
** resulting manifest is written to *pRid.
29032904
**
29042905
** 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.
29072908
*/
29082909
static int checkin_one_file( CheckinOneFileInfo * pCI, int *pRid,
29092910
int ckin1Flags, Blob * pErr ){
29102911
Blob mf = empty_blob; /* output manifest */
29112912
int rid = 0, frid = 0; /* various RIDs */
@@ -2943,20 +2944,22 @@
29432944
}
29442945
/* Potential TODOs include:
29452946
**
29462947
** - Commit allows an empty checkin only with a flag, but we
29472948
** 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.
29492952
*/
29502953
29512954
/*
29522955
** Confirm that pCI->zFilename can be found in pCI->pParent. If
29532956
** not, fail. This is admittedly an artificial limitation, not
29542957
** strictly necessary. We do it to hopefully reduce the chance of an
29552958
** "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.
29582961
*/
29592962
manifest_file_rewind(pCI->pParent);
29602963
zFile = manifest_file_seek(pCI->pParent, pCI->zFilename, 0);
29612964
if(!zFile){
29622965
ci_err((pErr,"File [%s] not found in manifest [%S]. "
29632966
--- 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

Keyboard Shortcuts

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