From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jonas Fonseca Subject: [PATCH] git-apply: document remaining options in the man page Date: Fri, 18 Aug 2006 10:45:45 +0200 Message-ID: <20060818084545.GB4717@diku.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-From: git-owner@vger.kernel.org Fri Aug 18 10:46:22 2006 Return-path: Envelope-to: gcvg-git@gmane.org Received: from vger.kernel.org ([209.132.176.167]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GDzzU-0004Bb-2R for gcvg-git@gmane.org; Fri, 18 Aug 2006 10:46:08 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751213AbWHRIqE (ORCPT ); Fri, 18 Aug 2006 04:46:04 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751217AbWHRIqE (ORCPT ); Fri, 18 Aug 2006 04:46:04 -0400 Received: from [130.225.96.91] ([130.225.96.91]:24507 "EHLO mgw1.diku.dk") by vger.kernel.org with ESMTP id S1751213AbWHRIqC (ORCPT ); Fri, 18 Aug 2006 04:46:02 -0400 Received: from localhost (localhost [127.0.0.1]) by mgw1.diku.dk (Postfix) with ESMTP id D88B97700C8 for ; Fri, 18 Aug 2006 10:45:49 +0200 (CEST) Received: from mgw1.diku.dk ([127.0.0.1]) by localhost (mgw1.diku.dk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 01017-05 for ; Fri, 18 Aug 2006 10:45:47 +0200 (CEST) Received: from nhugin.diku.dk (nhugin.diku.dk [130.225.96.140]) by mgw1.diku.dk (Postfix) with ESMTP id 7A5507700CD for ; Fri, 18 Aug 2006 10:45:45 +0200 (CEST) Received: from ask.diku.dk (ask.diku.dk [130.225.96.225]) by nhugin.diku.dk (Postfix) with ESMTP id C7FD66DF835 for ; Fri, 18 Aug 2006 10:44:35 +0200 (CEST) Received: by ask.diku.dk (Postfix, from userid 3873) id 5E091629F5; Fri, 18 Aug 2006 10:45:45 +0200 (CEST) To: git@vger.kernel.org Content-Disposition: inline User-Agent: Mutt/1.5.6i X-Virus-Scanned: amavisd-new at diku.dk Sender: git-owner@vger.kernel.org Precedence: bulk X-Mailing-List: git@vger.kernel.org Archived-At: 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