Fossil SCM
Removed some irrelevant comments.
Commit
7243aea14a7cde83f589009e2170e725497cb8915ed30ba9339df8be3124f582
Parent
6f749dfbc8ec5d3…
1 file changed
+16
-22
+16
-22
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -2699,10 +2699,13 @@ | ||
| 2699 | 2699 | |
| 2700 | 2700 | /* |
| 2701 | 2701 | ** State for the "mini-checkin" infrastructure, which enables the |
| 2702 | 2702 | ** ability to commit changes to a single file without a checkout |
| 2703 | 2703 | ** db, e.g. for use via an HTTP request. |
| 2704 | +** | |
| 2705 | +** Use CheckinMiniInfo_init() to cleanly initialize one to a known | |
| 2706 | +** valid/empty default state. | |
| 2704 | 2707 | ** |
| 2705 | 2708 | ** Memory for all non-const (char *) members is owned by the |
| 2706 | 2709 | ** CheckinMiniInfo instance and is freed by CheckinMiniInfo_cleanup(). |
| 2707 | 2710 | */ |
| 2708 | 2711 | struct CheckinMiniInfo { |
| @@ -3566,11 +3569,10 @@ | ||
| 3566 | 3569 | char * zGlobs = db_get("fileedit-glob",0); |
| 3567 | 3570 | once = 1; |
| 3568 | 3571 | if(0==zGlobs) return 0; |
| 3569 | 3572 | pGlobs = glob_create(zGlobs); |
| 3570 | 3573 | fossil_free(zGlobs); |
| 3571 | - once = 1; | |
| 3572 | 3574 | } |
| 3573 | 3575 | return glob_match(pGlobs, zFilename); |
| 3574 | 3576 | } |
| 3575 | 3577 | |
| 3576 | 3578 | static void fileedit_emit_script(int phase){ |
| @@ -3647,22 +3649,17 @@ | ||
| 3647 | 3649 | ** EXPERIMENTAL and subject to change and removal at any time. The goal |
| 3648 | 3650 | ** is to allow online edits of files. |
| 3649 | 3651 | ** |
| 3650 | 3652 | ** Query parameters: |
| 3651 | 3653 | ** |
| 3652 | -** file=FILE Repo-relative path to the file. | |
| 3653 | -** r=VERSION Checkin version | |
| 3654 | -** | |
| 3655 | -** Parameters intended to be passed in only via the editor's own form: | |
| 3656 | -** | |
| 3657 | -** diff If true, show diff from prev version. | |
| 3658 | -** preview If true, preview (how depends on mimetype). | |
| 3659 | -** content File content. | |
| 3660 | -** comment Checkin comment. | |
| 3661 | -** n Optional comment mimetype ("n" as in N-card). | |
| 3662 | -** | |
| 3663 | -** | |
| 3654 | +** file=FILENAME Repo-relative path to the file. | |
| 3655 | +** r=VERSION Checkin version, using any unambiguous | |
| 3656 | +** supported symbolic version name. | |
| 3657 | +** | |
| 3658 | +** All other parameters are for internal use only, submitted via the | |
| 3659 | +** form-submission process, and may change with any given revision of | |
| 3660 | +** this code. | |
| 3664 | 3661 | */ |
| 3665 | 3662 | void fileedit_page(){ |
| 3666 | 3663 | const char * zFilename = PD("file",P("name")); /* filename */ |
| 3667 | 3664 | const char * zRev = P("r"); /* checkin version */ |
| 3668 | 3665 | const char * zContent = P("content"); /* file content */ |
| @@ -3697,19 +3694,16 @@ | ||
| 3697 | 3694 | if(zFlagCheck){ |
| 3698 | 3695 | cimi.zMimetype = mprintf("%s",zFlagCheck); |
| 3699 | 3696 | zFlagCheck = 0; |
| 3700 | 3697 | } |
| 3701 | 3698 | cimi.zUser = mprintf("%s",g.zLogin); |
| 3702 | - /* | |
| 3703 | - ** TODOs include, but are not limited to: | |
| 3704 | - ** | |
| 3705 | - ** - Preview button + view | |
| 3706 | - ** | |
| 3707 | - ** - Diff button + view | |
| 3708 | - ** | |
| 3709 | - */ | |
| 3699 | + | |
| 3710 | 3700 | style_header("File Editor"); |
| 3701 | + /* As of this point, don't use return or fossil_fatal(), use | |
| 3702 | + ** fail((&err,...)) instead so that we can be sure to do any | |
| 3703 | + ** cleanup and end the transaction cleanly. | |
| 3704 | + */ | |
| 3711 | 3705 | if(!zRev || !*zRev || !zFilename || !*zFilename){ |
| 3712 | 3706 | fail((&err,"Missing required URL parameters.")); |
| 3713 | 3707 | } |
| 3714 | 3708 | if(0==fileedit_is_editable(zFilename)){ |
| 3715 | 3709 | fail((&err,"Filename <code>%h</code> is disallowed " |
| @@ -3762,11 +3756,11 @@ | ||
| 3762 | 3756 | /* ^^^ Appologies, Richard, but the @ form plays havoc with emacs */ |
| 3763 | 3757 | |
| 3764 | 3758 | fp("<h1>Editing:</h1>"); |
| 3765 | 3759 | fp("<p class='fileedit-hint'>"); |
| 3766 | 3760 | fp("File: <code>%h</code><br>" |
| 3767 | - "Version: <code id='r-label'>%s</code><br>", | |
| 3761 | + "Checkin Version: <code id='r-label'>%s</code><br>", | |
| 3768 | 3762 | zFilename, cimi.zParentUuid); |
| 3769 | 3763 | fp("Permalink: <code>" |
| 3770 | 3764 | "<a id='permalink' href='%R/fileedit?file=%T&r=%!S'>" |
| 3771 | 3765 | "/fileedit?file=%T&r=%!S</a></code><br>" |
| 3772 | 3766 | "(Clicking the permalink will reload the page and discard " |
| 3773 | 3767 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -2699,10 +2699,13 @@ | |
| 2699 | |
| 2700 | /* |
| 2701 | ** State for the "mini-checkin" infrastructure, which enables the |
| 2702 | ** ability to commit changes to a single file without a checkout |
| 2703 | ** db, e.g. for use via an HTTP request. |
| 2704 | ** |
| 2705 | ** Memory for all non-const (char *) members is owned by the |
| 2706 | ** CheckinMiniInfo instance and is freed by CheckinMiniInfo_cleanup(). |
| 2707 | */ |
| 2708 | struct CheckinMiniInfo { |
| @@ -3566,11 +3569,10 @@ | |
| 3566 | char * zGlobs = db_get("fileedit-glob",0); |
| 3567 | once = 1; |
| 3568 | if(0==zGlobs) return 0; |
| 3569 | pGlobs = glob_create(zGlobs); |
| 3570 | fossil_free(zGlobs); |
| 3571 | once = 1; |
| 3572 | } |
| 3573 | return glob_match(pGlobs, zFilename); |
| 3574 | } |
| 3575 | |
| 3576 | static void fileedit_emit_script(int phase){ |
| @@ -3647,22 +3649,17 @@ | |
| 3647 | ** EXPERIMENTAL and subject to change and removal at any time. The goal |
| 3648 | ** is to allow online edits of files. |
| 3649 | ** |
| 3650 | ** Query parameters: |
| 3651 | ** |
| 3652 | ** file=FILE Repo-relative path to the file. |
| 3653 | ** r=VERSION Checkin version |
| 3654 | ** |
| 3655 | ** Parameters intended to be passed in only via the editor's own form: |
| 3656 | ** |
| 3657 | ** diff If true, show diff from prev version. |
| 3658 | ** preview If true, preview (how depends on mimetype). |
| 3659 | ** content File content. |
| 3660 | ** comment Checkin comment. |
| 3661 | ** n Optional comment mimetype ("n" as in N-card). |
| 3662 | ** |
| 3663 | ** |
| 3664 | */ |
| 3665 | void fileedit_page(){ |
| 3666 | const char * zFilename = PD("file",P("name")); /* filename */ |
| 3667 | const char * zRev = P("r"); /* checkin version */ |
| 3668 | const char * zContent = P("content"); /* file content */ |
| @@ -3697,19 +3694,16 @@ | |
| 3697 | if(zFlagCheck){ |
| 3698 | cimi.zMimetype = mprintf("%s",zFlagCheck); |
| 3699 | zFlagCheck = 0; |
| 3700 | } |
| 3701 | cimi.zUser = mprintf("%s",g.zLogin); |
| 3702 | /* |
| 3703 | ** TODOs include, but are not limited to: |
| 3704 | ** |
| 3705 | ** - Preview button + view |
| 3706 | ** |
| 3707 | ** - Diff button + view |
| 3708 | ** |
| 3709 | */ |
| 3710 | style_header("File Editor"); |
| 3711 | if(!zRev || !*zRev || !zFilename || !*zFilename){ |
| 3712 | fail((&err,"Missing required URL parameters.")); |
| 3713 | } |
| 3714 | if(0==fileedit_is_editable(zFilename)){ |
| 3715 | fail((&err,"Filename <code>%h</code> is disallowed " |
| @@ -3762,11 +3756,11 @@ | |
| 3762 | /* ^^^ Appologies, Richard, but the @ form plays havoc with emacs */ |
| 3763 | |
| 3764 | fp("<h1>Editing:</h1>"); |
| 3765 | fp("<p class='fileedit-hint'>"); |
| 3766 | fp("File: <code>%h</code><br>" |
| 3767 | "Version: <code id='r-label'>%s</code><br>", |
| 3768 | zFilename, cimi.zParentUuid); |
| 3769 | fp("Permalink: <code>" |
| 3770 | "<a id='permalink' href='%R/fileedit?file=%T&r=%!S'>" |
| 3771 | "/fileedit?file=%T&r=%!S</a></code><br>" |
| 3772 | "(Clicking the permalink will reload the page and discard " |
| 3773 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -2699,10 +2699,13 @@ | |
| 2699 | |
| 2700 | /* |
| 2701 | ** State for the "mini-checkin" infrastructure, which enables the |
| 2702 | ** ability to commit changes to a single file without a checkout |
| 2703 | ** db, e.g. for use via an HTTP request. |
| 2704 | ** |
| 2705 | ** Use CheckinMiniInfo_init() to cleanly initialize one to a known |
| 2706 | ** valid/empty default state. |
| 2707 | ** |
| 2708 | ** Memory for all non-const (char *) members is owned by the |
| 2709 | ** CheckinMiniInfo instance and is freed by CheckinMiniInfo_cleanup(). |
| 2710 | */ |
| 2711 | struct CheckinMiniInfo { |
| @@ -3566,11 +3569,10 @@ | |
| 3569 | char * zGlobs = db_get("fileedit-glob",0); |
| 3570 | once = 1; |
| 3571 | if(0==zGlobs) return 0; |
| 3572 | pGlobs = glob_create(zGlobs); |
| 3573 | fossil_free(zGlobs); |
| 3574 | } |
| 3575 | return glob_match(pGlobs, zFilename); |
| 3576 | } |
| 3577 | |
| 3578 | static void fileedit_emit_script(int phase){ |
| @@ -3647,22 +3649,17 @@ | |
| 3649 | ** EXPERIMENTAL and subject to change and removal at any time. The goal |
| 3650 | ** is to allow online edits of files. |
| 3651 | ** |
| 3652 | ** Query parameters: |
| 3653 | ** |
| 3654 | ** file=FILENAME Repo-relative path to the file. |
| 3655 | ** r=VERSION Checkin version, using any unambiguous |
| 3656 | ** supported symbolic version name. |
| 3657 | ** |
| 3658 | ** All other parameters are for internal use only, submitted via the |
| 3659 | ** form-submission process, and may change with any given revision of |
| 3660 | ** this code. |
| 3661 | */ |
| 3662 | void fileedit_page(){ |
| 3663 | const char * zFilename = PD("file",P("name")); /* filename */ |
| 3664 | const char * zRev = P("r"); /* checkin version */ |
| 3665 | const char * zContent = P("content"); /* file content */ |
| @@ -3697,19 +3694,16 @@ | |
| 3694 | if(zFlagCheck){ |
| 3695 | cimi.zMimetype = mprintf("%s",zFlagCheck); |
| 3696 | zFlagCheck = 0; |
| 3697 | } |
| 3698 | cimi.zUser = mprintf("%s",g.zLogin); |
| 3699 | |
| 3700 | style_header("File Editor"); |
| 3701 | /* As of this point, don't use return or fossil_fatal(), use |
| 3702 | ** fail((&err,...)) instead so that we can be sure to do any |
| 3703 | ** cleanup and end the transaction cleanly. |
| 3704 | */ |
| 3705 | if(!zRev || !*zRev || !zFilename || !*zFilename){ |
| 3706 | fail((&err,"Missing required URL parameters.")); |
| 3707 | } |
| 3708 | if(0==fileedit_is_editable(zFilename)){ |
| 3709 | fail((&err,"Filename <code>%h</code> is disallowed " |
| @@ -3762,11 +3756,11 @@ | |
| 3756 | /* ^^^ Appologies, Richard, but the @ form plays havoc with emacs */ |
| 3757 | |
| 3758 | fp("<h1>Editing:</h1>"); |
| 3759 | fp("<p class='fileedit-hint'>"); |
| 3760 | fp("File: <code>%h</code><br>" |
| 3761 | "Checkin Version: <code id='r-label'>%s</code><br>", |
| 3762 | zFilename, cimi.zParentUuid); |
| 3763 | fp("Permalink: <code>" |
| 3764 | "<a id='permalink' href='%R/fileedit?file=%T&r=%!S'>" |
| 3765 | "/fileedit?file=%T&r=%!S</a></code><br>" |
| 3766 | "(Clicking the permalink will reload the page and discard " |
| 3767 |