From 2092a1fefdacf9839332202fa62165e2ac91c899 Mon Sep 17 00:00:00 2001
From: Junio C Hamano <junkio@cox.net>
Date: Sun, 11 Feb 2007 22:05:36 -0800
Subject: Teach git-am to pass -p option down to git-apply

This is originally from Andy Parkins whose patch used --patchdepth; let's
use -p which is more in line with the underlying git-apply.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 Documentation/git-am.txt | 7 ++++---
 git-am.sh                | 7 ++-----
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/Documentation/git-am.txt b/Documentation/git-am.txt
index 77ef103b21..4fb1d84413 100644
--- a/Documentation/git-am.txt
+++ b/Documentation/git-am.txt
@@ -10,7 +10,8 @@ SYNOPSIS
 --------
 [verse]
 'git-am' [--signoff] [--dotest=<dir>] [--utf8 | --no-utf8] [--binary] [--3way]
-         [--interactive] [--whitespace=<option>] <mbox>...
+         [--interactive] [--whitespace=<option>] [-C<n>] [-p<n>]
+	 <mbox>...
 'git-am' [--skip | --resolved]
 
 DESCRIPTION
@@ -68,8 +69,8 @@ default.   You could use `--no-utf8` to override this.
 	This flag is passed to the `git-apply` program that applies
 	the patch.
 
--C<n>::
-	This flag is passed to the `git-apply` program that applies
+-C<n>, -p<n>::
+	These flag are passed to the `git-apply` program that applies
 	the patch.
 
 --interactive::
diff --git a/git-am.sh b/git-am.sh
index 9a6123437e..6db9cb503a 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -3,7 +3,7 @@
 # Copyright (c) 2005, 2006 Junio C Hamano
 
 USAGE='[--signoff] [--dotest=<dir>] [--utf8 | --no-utf8] [--binary] [--3way]
-  [--interactive] [--whitespace=<option>] [-CNUM] <mbox>...
+  [--interactive] [--whitespace=<option>] [-C<n>] [-p<n>] <mbox>...
   or, when resuming [--skip | --resolved]'
 . git-sh-setup
 set_reflog_action am
@@ -142,10 +142,7 @@ do
 	--sk|--ski|--skip)
 	skip=t; shift ;;
 
-	--whitespace=*)
-	git_apply_opt="$git_apply_opt $1"; shift ;;
-
-	-C*)
+	--whitespace=*|-C*|-p*)
 	git_apply_opt="$git_apply_opt $1"; shift ;;
 
 	--resolvemsg=*)
-- 
cgit v1.2.1