Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Function file_tree_name() should respect case-sensitive setting. Add --case-sensitive option to test-tree-name. |
|---|---|
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
0df0ce8025c6b883050783d00a164495 |
| User & Date: | jan.nijtmans 2013-05-14 14:15:22.139 |
Context
|
2013-05-15
| ||
| 07:02 | Doc update: ignore-glob setting should be used to prevent *.log files from being added. check-in: 1162df8e41 user: jan.nijtmans tags: trunk | |
|
2013-05-14
| ||
| 14:58 | When trying to "fossil add" files which are expected to be ignored, ask for confirmation first. Add option -f|--force to override that. check-in: 24effbc370 user: jan.nijtmans tags: prevent-adding-ignored-files | |
| 14:15 | Function file_tree_name() should respect case-sensitive setting. Add --case-sensitive option to test-tree-name. check-in: 0df0ce8025 user: jan.nijtmans tags: trunk | |
| 11:36 | doc fixes. check-in: a38fa0b80b user: jan.nijtmans tags: trunk | |
Changes
Changes to src/file.c.
| ︙ | ︙ | |||
939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 |
int file_tree_name(const char *zOrigName, Blob *pOut, int errFatal){
Blob localRoot;
int nLocalRoot;
char *zLocalRoot;
Blob full;
int nFull;
char *zFull;
blob_zero(pOut);
db_must_be_within_tree();
file_canonical_name(g.zLocalRoot, &localRoot, 1);
nLocalRoot = blob_size(&localRoot);
zLocalRoot = blob_buffer(&localRoot);
assert( nLocalRoot>0 && zLocalRoot[nLocalRoot-1]=='/' );
file_canonical_name(zOrigName, &full, 0);
nFull = blob_size(&full);
zFull = blob_buffer(&full);
| > > > > > | > | | > > > > > | 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 |
int file_tree_name(const char *zOrigName, Blob *pOut, int errFatal){
Blob localRoot;
int nLocalRoot;
char *zLocalRoot;
Blob full;
int nFull;
char *zFull;
int (*xCmp)(const char*,const char*,int);
blob_zero(pOut);
db_must_be_within_tree();
file_canonical_name(g.zLocalRoot, &localRoot, 1);
nLocalRoot = blob_size(&localRoot);
zLocalRoot = blob_buffer(&localRoot);
assert( nLocalRoot>0 && zLocalRoot[nLocalRoot-1]=='/' );
file_canonical_name(zOrigName, &full, 0);
nFull = blob_size(&full);
zFull = blob_buffer(&full);
if( filenames_are_case_sensitive() ){
xCmp = fossil_strncmp;
}else{
xCmp = fossil_strnicmp;
}
/* Special case. zOrigName refers to g.zLocalRoot directory. */
if( nFull==nLocalRoot-1 && xCmp(zLocalRoot, zFull, nFull)==0 ){
blob_append(pOut, ".", 1);
blob_reset(&localRoot);
blob_reset(&full);
return 1;
}
if( nFull<=nLocalRoot || xCmp(zLocalRoot, zFull, nLocalRoot) ){
blob_reset(&localRoot);
blob_reset(&full);
if( errFatal ){
fossil_fatal("file outside of checkout tree: %s", zOrigName);
}
return 0;
}
blob_append(pOut, &zFull[nLocalRoot], nFull-nLocalRoot);
blob_reset(&localRoot);
blob_reset(&full);
return 1;
}
/*
** COMMAND: test-tree-name
**
** Test the operation of the tree name generator.
**
** Options:
** --case-sensitive B Enable or disable case-sensitive filenames. B is
** a boolean: "yes", "no", "true", "false", etc.
*/
void cmd_test_tree_name(void){
int i;
Blob x;
blob_zero(&x);
capture_case_sensitive_option();
for(i=2; i<g.argc; i++){
if( file_tree_name(g.argv[i], &x, 1) ){
fossil_print("%s\n", blob_buffer(&x));
blob_reset(&x);
}
}
}
|
| ︙ | ︙ |