am: --rebasing

The new option --rebasing is used internally for rebase to tell am that
it is being used for its purpose.  This would leave .dotest/rebasing to
help "completion" scripts tell if the ongoing operation is am or rebase.

Also the option at the same time stands for --binary, -3 and -k which
are always given when rebase drives am as its backend.

Using the information "am" leaves, git-completion.bash tells ongoing
rebase and am apart.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff --git a/git-am.sh b/git-am.sh
index 1846876..1f6b5e0 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -21,7 +21,8 @@
 p=              pass it through git-apply
 resolvemsg=     override error message when patch failure occurs
 r,resolved      to be used after a patch failure
-skip            skip the current patch"
+skip            skip the current patch
+rebasing        (internal use for git-rebase)"
 
 . git-sh-setup
 prefix=$(git rev-parse --show-prefix)
@@ -122,7 +123,7 @@
 
 prec=4
 dotest=".dotest"
-sign= utf8=t keep= skip= interactive= resolved= binary=
+sign= utf8=t keep= skip= interactive= resolved= binary= rebasing=
 resolvemsg= resume=
 git_apply_opt=
 
@@ -147,6 +148,8 @@
 		resolved=t ;;
 	--skip)
 		skip=t ;;
+	--rebasing)
+		rebasing=t threeway=t keep=t binary=t ;;
 	-d|--dotest)
 		die "-d option is no longer supported.  Do not use."
 		;;
@@ -237,6 +240,12 @@
 	echo "$utf8" >"$dotest/utf8"
 	echo "$keep" >"$dotest/keep"
 	echo 1 >"$dotest/next"
+	if test -n "$rebasing"
+	then
+		: >"$dotest/rebasing"
+	else
+		: >"$dotest/applying"
+	fi
 fi
 
 case "$resolved" in