Fossil SCM

option to separate filenames w/ NULL instead of whitespace. Eases operations w/ whitespace-containing filenames

bch 2020-03-07 22:14 trunk
Commit 6e88c64bb28eb48b8d8e6c793be63da3ed91aba59b264837da6f2cf4078755f0
1 file changed +11 -2
+11 -2
--- src/checkin.c
+++ src/checkin.c
@@ -675,25 +675,30 @@
675675
** --age Show when each file was committed.
676676
** -v|--verbose Provide extra information about each file.
677677
** -t Sort output in time order.
678678
** -r VERSION The specific check-in to list.
679679
** -R|--repository FILE Extract info from repository FILE.
680
+** -0 Use NULL instead of whitespace to separate
681
+** filenames
680682
**
681683
** See also: changes, extras, status
682684
*/
683685
void ls_cmd(void){
684686
int vid;
685687
Stmt q;
686688
int verboseFlag;
689
+ int nullSeparateFlag;
690
+ char separator = '\n';
687691
int showAge;
688692
int timeOrder;
689693
char *zOrderBy = "pathname";
690694
Blob where;
691695
int i;
692696
const char *zName;
693697
const char *zRev;
694698
699
+ nullSeparateFlag = find_option("0", "0", 0)!=0;
695700
verboseFlag = find_option("verbose","v", 0)!=0;
696701
if( !verboseFlag ){
697702
verboseFlag = find_option("l","l", 0)!=0; /* deprecated */
698703
}
699704
showAge = find_option("age",0,0)!=0;
@@ -792,14 +797,18 @@
792797
type = "RENAMED ";
793798
}else{
794799
type = "UNCHANGED ";
795800
}
796801
}
802
+ if (nullSeparateFlag)
803
+ separator='\0';
797804
if( showAge ){
798
- fossil_print("%s%s %s\n", type, db_column_text(&q, 5), zPathname);
805
+ fossil_print("%s%s %s%c", type, db_column_text(&q, 5), zPathname, separator);
806
+ if (nullSeparateFlag) putchar('\0');
799807
}else{
800
- fossil_print("%s%s\n", type, zPathname);
808
+ fossil_print("%s%s%c", type, zPathname, separator);
809
+ if (nullSeparateFlag) putchar('\0');
801810
}
802811
free(zFullName);
803812
}
804813
db_finalize(&q);
805814
}
806815
--- src/checkin.c
+++ src/checkin.c
@@ -675,25 +675,30 @@
675 ** --age Show when each file was committed.
676 ** -v|--verbose Provide extra information about each file.
677 ** -t Sort output in time order.
678 ** -r VERSION The specific check-in to list.
679 ** -R|--repository FILE Extract info from repository FILE.
 
 
680 **
681 ** See also: changes, extras, status
682 */
683 void ls_cmd(void){
684 int vid;
685 Stmt q;
686 int verboseFlag;
 
 
687 int showAge;
688 int timeOrder;
689 char *zOrderBy = "pathname";
690 Blob where;
691 int i;
692 const char *zName;
693 const char *zRev;
694
 
695 verboseFlag = find_option("verbose","v", 0)!=0;
696 if( !verboseFlag ){
697 verboseFlag = find_option("l","l", 0)!=0; /* deprecated */
698 }
699 showAge = find_option("age",0,0)!=0;
@@ -792,14 +797,18 @@
792 type = "RENAMED ";
793 }else{
794 type = "UNCHANGED ";
795 }
796 }
 
 
797 if( showAge ){
798 fossil_print("%s%s %s\n", type, db_column_text(&q, 5), zPathname);
 
799 }else{
800 fossil_print("%s%s\n", type, zPathname);
 
801 }
802 free(zFullName);
803 }
804 db_finalize(&q);
805 }
806
--- src/checkin.c
+++ src/checkin.c
@@ -675,25 +675,30 @@
675 ** --age Show when each file was committed.
676 ** -v|--verbose Provide extra information about each file.
677 ** -t Sort output in time order.
678 ** -r VERSION The specific check-in to list.
679 ** -R|--repository FILE Extract info from repository FILE.
680 ** -0 Use NULL instead of whitespace to separate
681 ** filenames
682 **
683 ** See also: changes, extras, status
684 */
685 void ls_cmd(void){
686 int vid;
687 Stmt q;
688 int verboseFlag;
689 int nullSeparateFlag;
690 char separator = '\n';
691 int showAge;
692 int timeOrder;
693 char *zOrderBy = "pathname";
694 Blob where;
695 int i;
696 const char *zName;
697 const char *zRev;
698
699 nullSeparateFlag = find_option("0", "0", 0)!=0;
700 verboseFlag = find_option("verbose","v", 0)!=0;
701 if( !verboseFlag ){
702 verboseFlag = find_option("l","l", 0)!=0; /* deprecated */
703 }
704 showAge = find_option("age",0,0)!=0;
@@ -792,14 +797,18 @@
797 type = "RENAMED ";
798 }else{
799 type = "UNCHANGED ";
800 }
801 }
802 if (nullSeparateFlag)
803 separator='\0';
804 if( showAge ){
805 fossil_print("%s%s %s%c", type, db_column_text(&q, 5), zPathname, separator);
806 if (nullSeparateFlag) putchar('\0');
807 }else{
808 fossil_print("%s%s%c", type, zPathname, separator);
809 if (nullSeparateFlag) putchar('\0');
810 }
811 free(zFullName);
812 }
813 db_finalize(&q);
814 }
815

Keyboard Shortcuts

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