Fossil SCM

Fix "fossil commit" when specifying a directory on the command line which doesn't exist.

jan.nijtmans 2013-07-09 08:51 trunk
Commit 062b82c8b030bbea67179ffad7a07e6e0f57fcca
1 file changed +5 -15
+5 -15
--- src/checkin.c
+++ src/checkin.c
@@ -749,11 +749,10 @@
749749
int result = 0;
750750
assert( g.aCommitFile==0 );
751751
if( g.argc>2 ){
752752
int ii, jj=0;
753753
Blob fname;
754
- int isDir;
755754
Stmt q;
756755
const char *zCollate;
757756
Bag toCommit;
758757
759758
zCollate = filename_collation();
@@ -764,24 +763,15 @@
764763
file_tree_name(g.argv[ii], &fname, 1);
765764
if( fossil_strcmp(blob_str(&fname),".")==0 ){
766765
bag_clear(&toCommit);
767766
return result;
768767
}
769
- isDir = file_isdir(g.argv[ii]);
770
- if( isDir==1 ){
771
- db_prepare(&q,
772
- "SELECT id FROM vfile WHERE pathname>'%q/' %s AND pathname<'%q0' %s",
773
- blob_str(&fname), zCollate, blob_str(&fname), zCollate);
774
- }else if( isDir==2 ){
775
- db_prepare(&q,
776
- "SELECT id FROM vfile WHERE pathname=%Q %s",
777
- blob_str(&fname), zCollate);
778
- }else{
779
- fossil_warning("not found: %s", g.argv[ii]);
780
- result = 1;
781
- continue;
782
- }
768
+ db_prepare(&q,
769
+ "SELECT id FROM vfile WHERE pathname=%Q %s"
770
+ " OR (pathname>'%q/' %s AND pathname<'%q0' %s)",
771
+ blob_str(&fname), zCollate, blob_str(&fname),
772
+ zCollate, blob_str(&fname), zCollate);
783773
while( db_step(&q)==SQLITE_ROW ){
784774
cnt++;
785775
bag_insert(&toCommit, db_column_int(&q, 0));
786776
}
787777
db_finalize(&q);
788778
--- src/checkin.c
+++ src/checkin.c
@@ -749,11 +749,10 @@
749 int result = 0;
750 assert( g.aCommitFile==0 );
751 if( g.argc>2 ){
752 int ii, jj=0;
753 Blob fname;
754 int isDir;
755 Stmt q;
756 const char *zCollate;
757 Bag toCommit;
758
759 zCollate = filename_collation();
@@ -764,24 +763,15 @@
764 file_tree_name(g.argv[ii], &fname, 1);
765 if( fossil_strcmp(blob_str(&fname),".")==0 ){
766 bag_clear(&toCommit);
767 return result;
768 }
769 isDir = file_isdir(g.argv[ii]);
770 if( isDir==1 ){
771 db_prepare(&q,
772 "SELECT id FROM vfile WHERE pathname>'%q/' %s AND pathname<'%q0' %s",
773 blob_str(&fname), zCollate, blob_str(&fname), zCollate);
774 }else if( isDir==2 ){
775 db_prepare(&q,
776 "SELECT id FROM vfile WHERE pathname=%Q %s",
777 blob_str(&fname), zCollate);
778 }else{
779 fossil_warning("not found: %s", g.argv[ii]);
780 result = 1;
781 continue;
782 }
783 while( db_step(&q)==SQLITE_ROW ){
784 cnt++;
785 bag_insert(&toCommit, db_column_int(&q, 0));
786 }
787 db_finalize(&q);
788
--- src/checkin.c
+++ src/checkin.c
@@ -749,11 +749,10 @@
749 int result = 0;
750 assert( g.aCommitFile==0 );
751 if( g.argc>2 ){
752 int ii, jj=0;
753 Blob fname;
 
754 Stmt q;
755 const char *zCollate;
756 Bag toCommit;
757
758 zCollate = filename_collation();
@@ -764,24 +763,15 @@
763 file_tree_name(g.argv[ii], &fname, 1);
764 if( fossil_strcmp(blob_str(&fname),".")==0 ){
765 bag_clear(&toCommit);
766 return result;
767 }
768 db_prepare(&q,
769 "SELECT id FROM vfile WHERE pathname=%Q %s"
770 " OR (pathname>'%q/' %s AND pathname<'%q0' %s)",
771 blob_str(&fname), zCollate, blob_str(&fname),
772 zCollate, blob_str(&fname), zCollate);
 
 
 
 
 
 
 
 
 
773 while( db_step(&q)==SQLITE_ROW ){
774 cnt++;
775 bag_insert(&toCommit, db_column_int(&q, 0));
776 }
777 db_finalize(&q);
778

Keyboard Shortcuts

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