Overview
SHA1 Hash: | 4fff36610997f7f3b222d981b30d9ae99f177e5d |
---|---|
Date: | 2009-04-19 05:48:45 |
User: | bch |
Comment: | branch, start committing hacking that will hopefully yield fix to this problem: one is allowed to checkout "artifacts" that should not be checkout-able (ie: changes to tickets); trying to check this out is permitted, but results in a segfault |
Timelines: | ancestors | descendants | both | fix artifact checkout |
Other Links: | files | ZIP archive | manifest |
Tags And Properties
- bgcolor=#ffaa22 propagates to descendants
- branch=fix artifact checkout propagates to descendants
- sym-fix artifact checkout propagates to descendants
-
sym-trunkcancelled
Changes
[hide diffs]Modified src/checkout.c from [24593c59e3] to [bf8e9beb01].
@@ -45,10 +45,40 @@ return db_exists("SELECT 1 FROM vfile WHERE chnged" " OR coalesce(origname!=pathname,0)"); } /* +** Check to see if the requested co is in fact "checkout-able" +** Return values: +** 0: Not checkout-able (does not exist, or is not an on-disk artifact) +** 1: Is checkout-able. +*/ +int checkoutable(const char *zName){ + int rc=1; /* assuming is checkout-able */ + Blob uuid; + const char *rid=(char *)NULL; + Stmt q; // db query + char *zSQL; //build-up sql + + // zSQL = mprintf(); + + // [create sql statement] + // db_prepare(&q,sqlstmt); + + blob_init(&uuid, zName, -1); + if( name_to_uuid(&uuid, 1) ){ + fossil_panic(g.zErrMsg); + } + + /* nParent=db_text(0,"select rid from blob where uuid=%s",uuid.nameofobj); */ + + /* int nParent = db_column_int(q, somenum); */ + return rc; +} + + +/* ** Undo the current check-out. Unlink all files from the disk. ** Clear the VFILE table. */ void uncheckout(int vid){ if( vid==0 ) return; @@ -156,10 +186,13 @@ forceFlag = find_option("force","f",0)!=0; noWrite = find_option("dontwrite",0,0)!=0; if( g.argc!=3 ) usage("?--force? VERSION"); if( !forceFlag && unsaved_changes()==1 ){ fossil_fatal("there are unsaved changes in the current checkout"); + } + if(!checkoutable()){ + fossil_fatal("the VERSION you requested is not a checkout-able artifact"); } if( forceFlag ){ db_multi_exec("DELETE FROM vfile"); prior = 0; }else{