Fossil SCM

Fix the "tag add" command to report an error if given an invalid UUID argument.

drh 2008-04-10 12:24 trunk
Commit 0d9abccbb6bb25b01f25c3deb78a016999afb835
1 file changed +5 -2
+5 -2
--- src/tag.c
+++ src/tag.c
@@ -266,13 +266,16 @@
266266
Blob cksum;
267267
static const char zTagtype[] = { '-', '+', '*' };
268268
269269
assert( tagtype>=0 && tagtype<=2 );
270270
user_select();
271
- rid = name_to_rid(zObjName);
272271
blob_zero(&uuid);
273
- db_blob(&uuid, "SELECT uuid FROM blob WHERE rid=%d", rid);
272
+ blob_append(&uuid, zObjName, -1);
273
+ if( name_to_uuid(&uuid, 9) ){
274
+ return;
275
+ }
276
+ rid = name_to_rid(blob_str(&uuid));
274277
blob_zero(&ctrl);
275278
276279
if( validate16(zTagname, strlen(zTagname)) ){
277280
fossil_fatal("invalid tag name \"%s\" - might be confused with a UUID",
278281
zTagname);
279282
--- src/tag.c
+++ src/tag.c
@@ -266,13 +266,16 @@
266 Blob cksum;
267 static const char zTagtype[] = { '-', '+', '*' };
268
269 assert( tagtype>=0 && tagtype<=2 );
270 user_select();
271 rid = name_to_rid(zObjName);
272 blob_zero(&uuid);
273 db_blob(&uuid, "SELECT uuid FROM blob WHERE rid=%d", rid);
 
 
 
 
274 blob_zero(&ctrl);
275
276 if( validate16(zTagname, strlen(zTagname)) ){
277 fossil_fatal("invalid tag name \"%s\" - might be confused with a UUID",
278 zTagname);
279
--- src/tag.c
+++ src/tag.c
@@ -266,13 +266,16 @@
266 Blob cksum;
267 static const char zTagtype[] = { '-', '+', '*' };
268
269 assert( tagtype>=0 && tagtype<=2 );
270 user_select();
 
271 blob_zero(&uuid);
272 blob_append(&uuid, zObjName, -1);
273 if( name_to_uuid(&uuid, 9) ){
274 return;
275 }
276 rid = name_to_rid(blob_str(&uuid));
277 blob_zero(&ctrl);
278
279 if( validate16(zTagname, strlen(zTagname)) ){
280 fossil_fatal("invalid tag name \"%s\" - might be confused with a UUID",
281 zTagname);
282

Keyboard Shortcuts

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