Hi,
update-cache seems to ignore paths containing path components
starting with a dot:
pi% update-cache --add ./test.c
Ignoring path ./test.c
pi% update-cache --add test.c
pi%
This is slightly annoying as 'find -type f | xargs update-cache --add'
doesn't work because of this. ('find * -type f | ...` does.) Instead
of ignoring the file, can we just strip off the leading "./" ?
--L
This is slightly annoying as 'find -type f | xargs update-cache --add'
doesn't work because of this. ('find * -type f | ...` does.) Instead
of ignoring the file, can we just strip off the leading "./" ?
just use a shell script to obtain that:
find -type f | sed "s#^./##" | xargs update-cache --add
Greetings,
Thomas
This is slightly annoying as 'find -type f | xargs update-cache --add'
doesn't work because of this. ('find * -type f | ...` does.) Instead
of ignoring the file, can we just strip off the leading "./" ?
just use a shell script to obtain that:
find -type f | sed "s#^./##" | xargs update-cache --add
This also works:
find * -type f | xargs update-cache --add
But that wasn't quite the point :) It makes sense that update-cache
doesn't like ambiguous path names, but it's easier for update-cache to
detect and strip "^./" than for me to remember to type sed "s#^./##"
every time.
--L
On Sun, May 01, 2005 at 10:54:27AM +0200, Lennert Buytenhek wrote:
But that wasn't quite the point :) It makes sense that update-cache
doesn't like ambiguous path names, but it's easier for update-cache to
detect and strip "^./" than for me to remember to type sed "s#^./##"
every time.
@@ -358,12 +359,15 @@}die("unknown option %s",path);}-if(!verify_path(path)){+_path=path;+if(!strncmp(_path,"./",2))+_path+=2;+if(!verify_path(_path)){fprintf(stderr,"Ignoring path %s\n",argv[i]);continue;}-if(add_file_to_cache(path))-die("Unable to add %s to database",path);+if(add_file_to_cache(_path))+die("Unable to add %s to database",_path);}if(write_cache(newfd,active_cache,active_nr)||rename(lockfile,indexfile))die("Unable to write new cachefile");
for (i = 1 ; i < argc; i++) {
char *path = argv[i];
+ char *_path;
I think there is no need to introduce an extra variable. Just increase
path by two. I knew that it is easy to fix in the code, but I think the
'logic' should go into the frontend not in the backend. But this one is
really easy to fix. Maybe regenerate a patch and sign it off, maybe it
will be included.
Greetings,
Thomas
From: David Greaves <hidden> Date: 2016-06-15 22:41:55
Lennert Buytenhek wrote:
Hi,
update-cache seems to ignore paths containing path components
starting with a dot:
pi% update-cache --add ./test.c
Ignoring path ./test.c
pi% update-cache --add test.c
pi%
This is slightly annoying as 'find -type f | xargs update-cache --add'
doesn't work because of this. ('find * -type f | ...` does.) Instead
of ignoring the file, can we just strip off the leading "./"
This is documented behaviour:
<file>
Files to act on.
Note that files begining with '.' are discarded. This includes
"./file" and "dir/./file". If you don't want this, then use
cleaner names.
The same applies to directories ending '/' and paths with '//'
"Where?" you ask...
Well, Linus hasn't accepted the docs for some reason - you have to
search the archives...
Sorry about that...
David
PS Changing this behaviour was discussed and dismissed for the core tools.
If the problem appears in Cogito however, then it's worth patching...