From: Jonas Fonseca Date: Fri, 18 Aug 2006 08:45:45 GMT Subject: [PATCH] git-apply: document remaining options in the man page Message-ID: <20060818084545.GB4717@diku.dk> Signed-off-by: Jonas Fonseca --- [ On top of next if that matters. ] I'm not sure if I got the --exclude note right, which says that running apply from a subdirectory automatically excludes files outside the subdirectory. As I mention below it looks like this excluding is only done when --index or --cached is specified. It led me to investigate a bit further and I think I might have found an issue or two. I was playing with the prefix checking in use_patch() to try and see if I could break it. I noticed that the patch filename will be prefixed with the prefix, but not the paths in the patch. This means that if I apply a patch created with a non-git diff for a file in a directory with a name longer than the changed file it will not be applied, e.g. git-am.txt in Documentation. So v1.4.2-g169bec6:git/Documentation > git apply --index git-am.diff will silently drop the change. Or maybe it is just me who doesn't know how to see diffs in the index (git-diff-index reports no change to Documentation/git-am.txt). The code from use_patch(): if (0 < prefix_length) { /* strlen("Documentation") = 13 */ int pathlen = strlen("git-am.txt"); /* = 10 */ if (pathlen <= prefix_length || memcmp(prefix, pathname, prefix_length)) return 0; } Anyway, the prefix check is only ever performed when using --index or --cached. These options doesn't seem to support being run from a subdirectories if the patch is given on stdin: v1.4.2-g169bec6:git/Documentation > git apply --cached < git-am.diff fatal: unable to create '.git/index': No such file or directory I can make a follow-up patch if this is the way it's supposed to work. In that case a better error message might be good to clearify things. Lastly, `log -S