author | Junio C Hamano <junkio@cox.net> | |
Tue, 20 Feb 2007 01:58:58 +0000 (17:58 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Tue, 20 Feb 2007 02:44:21 +0000 (18:44 -0800) | ||
commit | aea1945744214bf84908586af8be1c098a6f346d | |
tree | 3a984cf1901e2f888feca1de255517c526531bf0 | tree | snapshot |
parent | 700ea47936e393a217f4174f80a19aa01f698b56 | commit | diff |
git-apply: do not lose cwd when run from a subdirectory.
When a patch modifies (not deletes) the last file in a
directory, because we treat a modification just as deletion
followed by creation, and deleting the last file in a directory
automatically rmdir(2)'s that directory, we ended up removing
the directory, which can potentially be the cwd, and then
recreating the same directory to create the patch result.
Avoid the rmdir step when remove_file() is called only because
we are replacing it with the result by later calling
create_file().
Signed-off-by: Junio C Hamano <junkio@cox.net>
When a patch modifies (not deletes) the last file in a
directory, because we treat a modification just as deletion
followed by creation, and deleting the last file in a directory
automatically rmdir(2)'s that directory, we ended up removing
the directory, which can potentially be the cwd, and then
recreating the same directory to create the patch result.
Avoid the rmdir step when remove_file() is called only because
we are replacing it with the result by later calling
create_file().
Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-apply.c | diff | blob | history |