1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-09 02:33:11 +01:00
git/t/t4120-apply-popt.sh
Shawn O. Pearce 79ee194e52 Honor -p<n> when applying git diffs
If the user is trying to apply a Git generated diff file and they
have specified a -p<n> option, where <n> is not 1, the user probably
has a good reason for doing this.  Such as they are me, trying to
apply a patch generated in git.git for the git-gui subdirectory to
the git-gui.git repository, where there is no git-gui subdirectory
present.

Users shouldn't supply -p2 unless they mean it.  But if they are
supplying it, they probably have thought about how to make this
patch apply to their working directory, and want to risk whatever
results may come from that.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-05 15:06:58 -07:00

25 lines
386 B
Bash
Executable file

#!/bin/sh
#
# Copyright (c) 2007 Shawn O. Pearce
#
test_description='git-apply -p handling.'
. ./test-lib.sh
test_expect_success setup '
mkdir sub &&
echo A >sub/file1 &&
cp sub/file1 file1 &&
git add sub/file1 &&
echo B >sub/file1 &&
git diff >patch.file &&
rm sub/file1 &&
rmdir sub
'
test_expect_success 'apply git diff with -p2' '
git apply -p2 patch.file
'
test_done