Browse Source

make paths relative to CWD, after all

the test suite actually relies on it. it would be possible to adjust it,
but there is not much reason to make paths relative to HOME (as we
support convenient tilde expansion). so use the least invasive approach,
which is simply the old behavior. adjust the documentation accordingly.

This reverts commit da5ce5d8f4.
wip/maildir-uid-dupes-test
Oswald Buddenhagen 12 years ago
parent
commit
15d57b95b7
  1. 2
      src/config.c
  2. 4
      src/mbsync.1
  3. 15
      src/util.c

2
src/config.c

@ -219,7 +219,7 @@ getopt_helper( conffile_t *cfile, int *cops, int ops[], char **sync_state )
while ((arg = get_arg( cfile, ARG_OPTIONAL, 0 ))); while ((arg = get_arg( cfile, ARG_OPTIONAL, 0 )));
ops[M] |= XOP_HAVE_CREATE; ops[M] |= XOP_HAVE_CREATE;
} else if (!strcasecmp( "SyncState", cfile->cmd )) } else if (!strcasecmp( "SyncState", cfile->cmd ))
*sync_state = !strcmp( cfile->val, "*" ) ? nfstrdup( "*" ) : expand_strdup( cfile->val ); *sync_state = expand_strdup( cfile->val );
else else
return 0; return 0;
return 1; return 1;

4
src/mbsync.1

@ -90,6 +90,8 @@ Lines starting with a hash mark (\fB#\fR) are comments and are ignored entirely.
Configuration items are keywords followed by one or more arguments; Configuration items are keywords followed by one or more arguments;
arguments containing spaces must be enclosed in double quotes (\fB"\fR). arguments containing spaces must be enclosed in double quotes (\fB"\fR).
All keywords (including those used as arguments) are case-insensitive. All keywords (including those used as arguments) are case-insensitive.
Bash-like home directory expansion using the tilde (\fB~\fR) is supported
in all options which represent local paths.
There are a few global options, the rest applies to particular sections. There are a few global options, the rest applies to particular sections.
Sections are started by a section keyword and are terminated by an empty line Sections are started by a section keyword and are terminated by an empty line
or end of file. or end of file.
@ -177,7 +179,7 @@ Store's \fBTrash\fR. When using this, the remote Store does not need an own
(Default: \fIno\fR) (Default: \fIno\fR)
.. ..
.SS Maildir Stores .SS Maildir Stores
The reference point for relative \fBPath\fRs is $HOME. The reference point for relative \fBPath\fRs is the current working directory.
.P .P
As \fBmbsync\fR needs UIDs, but no standardized UID storage scheme exists for As \fBmbsync\fR needs UIDs, but no standardized UID storage scheme exists for
Maildir, \fBmbsync\fR supports two schemes, each with its pros and cons. Maildir, \fBmbsync\fR supports two schemes, each with its pros and cons.

15
src/util.c

@ -337,35 +337,24 @@ expand_strdup( const char *s )
if (*s == '~') { if (*s == '~') {
s++; s++;
if (!*s) { if (!*s) {
rethome:
p = 0; p = 0;
q = Home; q = Home;
} else if (*s == '/') { } else if (*s == '/') {
p = s + 1; p = s;
q = Home; q = Home;
} else { } else {
if ((p = strchr( s, '/' ))) { if ((p = strchr( s, '/' ))) {
r = my_strndup( s, (int)(p - s) ); r = my_strndup( s, (int)(p - s) );
pw = getpwnam( r ); pw = getpwnam( r );
free( r ); free( r );
p++;
} else } else
pw = getpwnam( s ); pw = getpwnam( s );
if (!pw) if (!pw)
return 0; return 0;
q = pw->pw_dir; q = pw->pw_dir;
} }
if (!p) nfasprintf( &r, "%s%s", q, p ? p : "" );
return nfstrdup( q );
retjoin:
nfasprintf( &r, "%s/%s", q, p );
return r; return r;
} else if (*s != '/') {
if (*s == '.' && !s[1])
goto rethome;
p = s;
q = Home;
goto retjoin;
} else } else
return nfstrdup( s ); return nfstrdup( s );
} }

Loading…
Cancel
Save