Merge branch 'jc/am'
* jc/am: am: --rebasing am: remove support for -d .dotest am: read from the right mailbox when started from a subdirectory
This commit is contained in:
@ -9,7 +9,7 @@ git-am - Apply a series of patches from a mailbox
|
|||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
[verse]
|
[verse]
|
||||||
'git-am' [--signoff] [--dotest=<dir>] [--keep] [--utf8 | --no-utf8]
|
'git-am' [--signoff] [--keep] [--utf8 | --no-utf8]
|
||||||
[--3way] [--interactive] [--binary]
|
[--3way] [--interactive] [--binary]
|
||||||
[--whitespace=<option>] [-C<n>] [-p<n>]
|
[--whitespace=<option>] [-C<n>] [-p<n>]
|
||||||
<mbox>|<Maildir>...
|
<mbox>|<Maildir>...
|
||||||
@ -32,10 +32,6 @@ OPTIONS
|
|||||||
Add `Signed-off-by:` line to the commit message, using
|
Add `Signed-off-by:` line to the commit message, using
|
||||||
the committer identity of yourself.
|
the committer identity of yourself.
|
||||||
|
|
||||||
-d=<dir>, --dotest=<dir>::
|
|
||||||
Instead of `.dotest` directory, use <dir> as a working
|
|
||||||
area to store extracted patches.
|
|
||||||
|
|
||||||
-k, --keep::
|
-k, --keep::
|
||||||
Pass `-k` flag to `git-mailinfo` (see linkgit:git-mailinfo[1]).
|
Pass `-k` flag to `git-mailinfo` (see linkgit:git-mailinfo[1]).
|
||||||
|
|
||||||
|
@ -70,7 +70,15 @@ __git_ps1 ()
|
|||||||
local b
|
local b
|
||||||
if [ -d "$g/../.dotest" ]
|
if [ -d "$g/../.dotest" ]
|
||||||
then
|
then
|
||||||
r="|AM/REBASE"
|
if test -f "$g/../.dotest/rebasing"
|
||||||
|
then
|
||||||
|
r="|REBASE"
|
||||||
|
elif test -f "$g/../.dotest/applying"
|
||||||
|
then
|
||||||
|
r="|AM"
|
||||||
|
else
|
||||||
|
r="|AM/REBASE"
|
||||||
|
fi
|
||||||
b="$(git symbolic-ref HEAD 2>/dev/null)"
|
b="$(git symbolic-ref HEAD 2>/dev/null)"
|
||||||
elif [ -f "$g/.dotest-merge/interactive" ]
|
elif [ -f "$g/.dotest-merge/interactive" ]
|
||||||
then
|
then
|
||||||
|
44
git-am.sh
44
git-am.sh
@ -9,7 +9,7 @@ git-am [options] <mbox>|<Maildir>...
|
|||||||
git-am [options] --resolved
|
git-am [options] --resolved
|
||||||
git-am [options] --skip
|
git-am [options] --skip
|
||||||
--
|
--
|
||||||
d,dotest= use <dir> and not .dotest
|
d,dotest= (removed -- do not use)
|
||||||
i,interactive run interactively
|
i,interactive run interactively
|
||||||
b,binary pass --allo-binary-replacement to git-apply
|
b,binary pass --allo-binary-replacement to git-apply
|
||||||
3,3way allow fall back on 3way merging if needed
|
3,3way allow fall back on 3way merging if needed
|
||||||
@ -21,9 +21,11 @@ C= pass it through git-apply
|
|||||||
p= pass it through git-apply
|
p= pass it through git-apply
|
||||||
resolvemsg= override error message when patch failure occurs
|
resolvemsg= override error message when patch failure occurs
|
||||||
r,resolved to be used after a patch failure
|
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
|
. git-sh-setup
|
||||||
|
prefix=$(git rev-parse --show-prefix)
|
||||||
set_reflog_action am
|
set_reflog_action am
|
||||||
require_work_tree
|
require_work_tree
|
||||||
cd_to_toplevel
|
cd_to_toplevel
|
||||||
@ -49,10 +51,6 @@ stop_here_user_resolve () {
|
|||||||
then
|
then
|
||||||
cmdline="$cmdline -3"
|
cmdline="$cmdline -3"
|
||||||
fi
|
fi
|
||||||
if test '.dotest' != "$dotest"
|
|
||||||
then
|
|
||||||
cmdline="$cmdline -d=$dotest"
|
|
||||||
fi
|
|
||||||
echo "When you have resolved this problem run \"$cmdline --resolved\"."
|
echo "When you have resolved this problem run \"$cmdline --resolved\"."
|
||||||
echo "If you would prefer to skip this patch, instead run \"$cmdline --skip\"."
|
echo "If you would prefer to skip this patch, instead run \"$cmdline --skip\"."
|
||||||
|
|
||||||
@ -124,7 +122,8 @@ reread_subject () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
prec=4
|
prec=4
|
||||||
dotest=.dotest sign= utf8=t keep= skip= interactive= resolved= binary=
|
dotest=".dotest"
|
||||||
|
sign= utf8=t keep= skip= interactive= resolved= binary= rebasing=
|
||||||
resolvemsg= resume=
|
resolvemsg= resume=
|
||||||
git_apply_opt=
|
git_apply_opt=
|
||||||
|
|
||||||
@ -149,8 +148,11 @@ do
|
|||||||
resolved=t ;;
|
resolved=t ;;
|
||||||
--skip)
|
--skip)
|
||||||
skip=t ;;
|
skip=t ;;
|
||||||
|
--rebasing)
|
||||||
|
rebasing=t threeway=t keep=t binary=t ;;
|
||||||
-d|--dotest)
|
-d|--dotest)
|
||||||
shift; dotest=$1;;
|
die "-d option is no longer supported. Do not use."
|
||||||
|
;;
|
||||||
--resolvemsg)
|
--resolvemsg)
|
||||||
shift; resolvemsg=$1 ;;
|
shift; resolvemsg=$1 ;;
|
||||||
--whitespace)
|
--whitespace)
|
||||||
@ -186,7 +188,7 @@ then
|
|||||||
0,)
|
0,)
|
||||||
# No file input but without resume parameters; catch
|
# No file input but without resume parameters; catch
|
||||||
# user error to feed us a patch from standard input
|
# user error to feed us a patch from standard input
|
||||||
# when there is already .dotest. This is somewhat
|
# when there is already $dotest. This is somewhat
|
||||||
# unreliable -- stdin could be /dev/null for example
|
# unreliable -- stdin could be /dev/null for example
|
||||||
# and the caller did not intend to feed us a patch but
|
# and the caller did not intend to feed us a patch but
|
||||||
# wanted to continue unattended.
|
# wanted to continue unattended.
|
||||||
@ -206,6 +208,24 @@ else
|
|||||||
# Start afresh.
|
# Start afresh.
|
||||||
mkdir -p "$dotest" || exit
|
mkdir -p "$dotest" || exit
|
||||||
|
|
||||||
|
if test -n "$prefix" && test $# != 0
|
||||||
|
then
|
||||||
|
first=t
|
||||||
|
for arg
|
||||||
|
do
|
||||||
|
test -n "$first" && {
|
||||||
|
set x
|
||||||
|
first=
|
||||||
|
}
|
||||||
|
case "$arg" in
|
||||||
|
/*)
|
||||||
|
set "$@" "$arg" ;;
|
||||||
|
*)
|
||||||
|
set "$@" "$prefix$arg" ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
shift
|
||||||
|
fi
|
||||||
git mailsplit -d"$prec" -o"$dotest" -b -- "$@" > "$dotest/last" || {
|
git mailsplit -d"$prec" -o"$dotest" -b -- "$@" > "$dotest/last" || {
|
||||||
rm -fr "$dotest"
|
rm -fr "$dotest"
|
||||||
exit 1
|
exit 1
|
||||||
@ -220,6 +240,12 @@ else
|
|||||||
echo "$utf8" >"$dotest/utf8"
|
echo "$utf8" >"$dotest/utf8"
|
||||||
echo "$keep" >"$dotest/keep"
|
echo "$keep" >"$dotest/keep"
|
||||||
echo 1 >"$dotest/next"
|
echo 1 >"$dotest/next"
|
||||||
|
if test -n "$rebasing"
|
||||||
|
then
|
||||||
|
: >"$dotest/rebasing"
|
||||||
|
else
|
||||||
|
: >"$dotest/applying"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$resolved" in
|
case "$resolved" in
|
||||||
|
@ -376,7 +376,7 @@ fi
|
|||||||
if test -z "$do_merge"
|
if test -z "$do_merge"
|
||||||
then
|
then
|
||||||
git format-patch -k --stdout --full-index --ignore-if-in-upstream "$upstream"..ORIG_HEAD |
|
git format-patch -k --stdout --full-index --ignore-if-in-upstream "$upstream"..ORIG_HEAD |
|
||||||
git am $git_am_opt --binary -3 -k --resolvemsg="$RESOLVEMSG" &&
|
git am $git_am_opt --rebasing --resolvemsg="$RESOLVEMSG" &&
|
||||||
move_to_original_branch
|
move_to_original_branch
|
||||||
ret=$?
|
ret=$?
|
||||||
test 0 != $ret -a -d .dotest &&
|
test 0 != $ret -a -d .dotest &&
|
||||||
|
72
t/t4150-am-subdir.sh
Executable file
72
t/t4150-am-subdir.sh
Executable file
@ -0,0 +1,72 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
test_description='git am running from a subdirectory'
|
||||||
|
|
||||||
|
. ./test-lib.sh
|
||||||
|
|
||||||
|
test_expect_success setup '
|
||||||
|
echo hello >world &&
|
||||||
|
git add world &&
|
||||||
|
test_tick &&
|
||||||
|
git commit -m initial &&
|
||||||
|
git tag initial &&
|
||||||
|
echo goodbye >world &&
|
||||||
|
git add world &&
|
||||||
|
test_tick &&
|
||||||
|
git commit -m second &&
|
||||||
|
git format-patch --stdout HEAD^ >patchfile &&
|
||||||
|
: >expect
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'am regularly from stdin' '
|
||||||
|
git checkout initial &&
|
||||||
|
git am <patchfile &&
|
||||||
|
git diff master >actual &&
|
||||||
|
diff -u expect actual
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'am regularly from file' '
|
||||||
|
git checkout initial &&
|
||||||
|
git am patchfile &&
|
||||||
|
git diff master >actual &&
|
||||||
|
diff -u expect actual
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'am regularly from stdin in subdirectory' '
|
||||||
|
rm -fr subdir &&
|
||||||
|
git checkout initial &&
|
||||||
|
(
|
||||||
|
mkdir -p subdir &&
|
||||||
|
cd subdir &&
|
||||||
|
git am <../patchfile
|
||||||
|
) &&
|
||||||
|
git diff master>actual &&
|
||||||
|
diff -u expect actual
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'am regularly from file in subdirectory' '
|
||||||
|
rm -fr subdir &&
|
||||||
|
git checkout initial &&
|
||||||
|
(
|
||||||
|
mkdir -p subdir &&
|
||||||
|
cd subdir &&
|
||||||
|
git am ../patchfile
|
||||||
|
) &&
|
||||||
|
git diff master >actual &&
|
||||||
|
diff -u expect actual
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'am regularly from file in subdirectory with full path' '
|
||||||
|
rm -fr subdir &&
|
||||||
|
git checkout initial &&
|
||||||
|
P=$(pwd) &&
|
||||||
|
(
|
||||||
|
mkdir -p subdir &&
|
||||||
|
cd subdir &&
|
||||||
|
git am "$P/patchfile"
|
||||||
|
) &&
|
||||||
|
git diff master >actual &&
|
||||||
|
diff -u expect actual
|
||||||
|
'
|
||||||
|
|
||||||
|
test_done
|
Reference in New Issue
Block a user