Re: [PATCH 1/8] git-apply: work from subdirectory.
- From
Linus Torvalds <torvalds@osdl.org>
- Date
- Nov 26, 2005, 17:36 UTC
- Message-ID
- <Pine.LNX.4.64.0511260932080.13959@g5.osdl.org>
- In-Reply-To
- <7viruf68bz.fsf@assigned-by-dhcp.cox.net>
On Sat, 26 Nov 2005, Junio C Hamano wrote:
Show 16 quoted lines
> > This adds three things: > > - prefix_filename() is like prefix_path() but can be used to > name any file on the filesystem, not the files that might go > into the index file. > > - git-apply uses setup_git_directory() to find out the GIT_DIR > and reads configuration file. Later this would allow us to > affect the behaviour of the command from the configuration. > > - When git-apply is run from a subdirectory, it applies the > given patch only to the files under the current directory and > below. > > Signed-off-by: Junio C Hamano <junkio@cox.net>
This breaks git-apply when used to just do a "diffstat", or when used on a non-git repository.
For "git-apply --stat", we definitely don't want to force it inside a git directory. In fact, even _trying_ to find a git directory would be wrong.
The only case where we care about a git directory is the "--index" case. In all other cases we should happily apply it (or stat it).
Linus