summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8ee4a6c)
raw | patch | inline | side by side (parent: 8ee4a6c)
author | Junio C Hamano <gitster@pobox.com> | |
Mon, 7 Jul 2008 01:36:01 +0000 (18:36 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 7 Jul 2008 02:33:08 +0000 (19:33 -0700) |
Applying a patch in the directory that is different from what the patch
records is done with --directory option in GNU diff. The --root option we
introduced previously does the same, and we can call it the same way to
give users more familiar feel.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
records is done with --directory option in GNU diff. The --root option we
introduced previously does the same, and we can call it the same way to
give users more familiar feel.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-apply.txt | patch | blob | history | |
builtin-apply.c | patch | blob | history | |
t/t4128-apply-root.sh | patch | blob | history |
index 63fce53690e35f28ebb4db049dec553fd094083f..3cd3179ff17f45ec0c0cbd3687fdf8020cd8e5f4 100644 (file)
[--allow-binary-replacement | --binary] [--reject] [-z]
[-pNUM] [-CNUM] [--inaccurate-eof] [--cached]
[--whitespace=<nowarn|warn|fix|error|error-all>]
- [--exclude=PATH] [--root=<root>] [--verbose] [<patch>...]
+ [--exclude=PATH] [--directory=<root>] [--verbose] [<patch>...]
DESCRIPTION
-----------
current patch being applied will be printed. This option will cause
additional information to be reported.
---root=<root>::
+--directory=<root>::
Prepend <root> to all filenames. If a "-p" argument was passed, too,
it is applied before prepending the new root.
++
+For example, a patch that talks about updating `a/git-gui.sh` to `b/git-gui.sh`
+can be applied to the file in the working tree `modules/git-gui/git-gui.sh` by
+running `git apply --directory=modules/git-gui`.
Configuration
-------------
diff --git a/builtin-apply.c b/builtin-apply.c
index 6c3db60b659533c612d17852f93fd4ae99519ad6..c242bbd83bd0f154ccf5d4a8be7f85386216cebc 100644 (file)
--- a/builtin-apply.c
+++ b/builtin-apply.c
inaccurate_eof = 1;
continue;
}
- if (!prefixcmp(arg, "--root=")) {
- arg += strlen("--root=");
+ if (!prefixcmp(arg, "--directory=")) {
+ arg += strlen("--directory=");
root_len = strlen(arg);
if (root_len && arg[root_len - 1] != '/') {
char *new_root;
diff --git a/t/t4128-apply-root.sh b/t/t4128-apply-root.sh
index b6502454556feaf026ad358e18b7c09a62a0c765..2dd0c75f964b690977e40a3a8235cc324dc6826e 100755 (executable)
--- a/t/t4128-apply-root.sh
+++ b/t/t4128-apply-root.sh
+Bello
EOF
-test_expect_success 'apply --root -p (1)' '
+test_expect_success 'apply --directory -p (1)' '
- git apply --root=some/sub -p3 --index patch &&
+ git apply --directory=some/sub -p3 --index patch &&
test Bello = $(git show :some/sub/dir/file) &&
test Bello = $(cat some/sub/dir/file)
'
-test_expect_success 'apply --root -p (2) ' '
+test_expect_success 'apply --directory -p (2) ' '
git reset --hard initial &&
- git apply --root=some/sub/ -p3 --index patch &&
+ git apply --directory=some/sub/ -p3 --index patch &&
test Bello = $(git show :some/sub/dir/file) &&
test Bello = $(cat some/sub/dir/file)