On Mon, 19 Feb 2007, Junio C Hamano wrote: > > Hmm. I am puzzled. Are you suggesting to change behaviour of > "git apply" with --index? Yeah. Or at least _verify_ that the patch is within the subdirectory we are in right now. Right now, we do neither, and it will actually change files outside that subdirectory, which I think is a bit dangerous. > git generated patch, or patches on the kernel list that are not > generated with git are always relative to the top-level, so I > think the current --index behaviour makes tons of sense. I agree that it is sensible, but it's sensible only within the context of purely self-generated patches, where the patch itself was generated not just with git, but with that exact project. Imagine somebody sending you a patch to a set of files, and they didn't use git to generate that patch. What would it look right? Right, it might well look like diff -u file.c.orig file.c --- file.c.orig +++ file.c @@ -29,6 +29,7 @@ ... and it happens to be in some subdirectory. What would you do? I'd use "git apply". And I would be really upset *if* git-apply actually applied the patch to some *other* subdirectory than the one I was in. (Again, "Makefile" is a common case, since you often have it at multiple levels - maybe it would try to apply the changes to the top-level Makefile, even though I was in the drivers/usb/ subdirectory). Now, I personally actually always work in the top-level directory, so I don't actually much care. I'm so used to editing the patches themselves that that is what I always end up doing, but I do believe that I'm odd in that. Few enough people have worked with unified diffs for over 15 years, and are perfectly happy to edit not just the headers, but the actual contents too, and fixing up the line numbers to make it all come out right. I do that regularly (not daily, but I probably do it almost once a month - I decide that I like somebody's patch and want to apply it, but fix up some whitespace issue in the patch where he had the opening brace of an "if"-statement on the wrong line etc). So while I *personally* would probably never be impacted, just because I alway work in the top directory anyway, I do that partly exactly because I'm the top-level maintainer. Somebody who maintains drivers/usb/ might well get patches to a driver that only edits the xyzzy.c and xyzzy.h files within that subdirectory, and it really does make sense that he be able to do "git apply < patch" in that situation. Linus - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html