diff options
author | Junio C Hamano <gitster@pobox.com> | 2008-03-04 00:25:04 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-03-05 10:52:56 -0800 |
commit | bb034f839a396cf0660024a59bbff61f8ef0c5af (patch) | |
tree | acfd0231258b4f300848f92ca0fbf73795b69cd3 /git-am.sh | |
parent | 79b1138e7894ea048008f6b99908f5cd36e94949 (diff) | |
download | git-bb034f839a396cf0660024a59bbff61f8ef0c5af.tar.gz git-bb034f839a396cf0660024a59bbff61f8ef0c5af.tar.xz |
am: read from the right mailbox when started from a subdirectory
An earlier commit c149184 (allow git-am to run in a subdirectory) taught
git-am to start from a subdirectory by going up to the root of the work
tree byitself, but it did not adjust the path to read the mbox from when
it did so.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-am.sh')
-rwxr-xr-x | git-am.sh | 25 |
1 files changed, 23 insertions, 2 deletions
@@ -24,6 +24,7 @@ r,resolved to be used after a patch failure skip skip the current patch" . git-sh-setup +prefix=$(git rev-parse --show-prefix) set_reflog_action am require_work_tree cd_to_toplevel @@ -124,7 +125,8 @@ reread_subject () { } prec=4 -dotest=.dotest sign= utf8=t keep= skip= interactive= resolved= binary= +dotest="${prefix}.dotest" +sign= utf8=t keep= skip= interactive= resolved= binary= resolvemsg= resume= git_apply_opt= @@ -150,7 +152,8 @@ do --skip) skip=t ;; -d|--dotest) - shift; dotest=$1;; + shift + case "$1" in /*) dotest=$1;; *) dotest="$prefix$1" ;; esac ;; --resolvemsg) shift; resolvemsg=$1 ;; --whitespace) @@ -206,6 +209,24 @@ else # Start afresh. 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" || { rm -fr "$dotest" exit 1 |