@matheusbsbs / matheus-bagliano / commits / 59c8e2cb2a
Fork 0

Remove git-applypatch

The previous one removed git-applymbox, which was the sole user of this tool. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed May 24, 2007 at 19:25 UTC 59c8e2cb2aee2e4eb75007602b264bc4e7928bc0
9 files changed +10 -280
.gitignore
-1
@@ -7,7 +7,6 @@ git-add--interactive
7 git-am
8 git-annotate
9 git-apply
10 -git-applypatch
10 git-archimport
11 git-archive
12 git-bisect
Documentation/SubmittingPatches
+2 -2
@@ -239,7 +239,7 @@ One test you could do yourself if your MUA is set up correctly is:
239 $ git fetch http://kernel.org/pub/scm/git/git.git master:test-apply
240 $ git checkout test-apply
241 $ git reset --hard
242 - $ git applymbox a.patch
242 + $ git am a.patch
243
244 If it does not apply correctly, there can be various reasons.
245
@@ -247,7 +247,7 @@ If it does not apply correctly, there can be various reasons.
247 does not have much to do with your MUA. Please rebase the
248 patch appropriately.
249
250 -* Your MUA corrupted your patch; applymbox would complain that
250 +* Your MUA corrupted your patch; "am" would complain that
251 the patch does not apply. Look at .dotest/ subdirectory and
252 see what 'patch' file contains and check for the common
253 corruption patterns mentioned above.
Documentation/cmd-list.perl
-1
@@ -72,7 +72,6 @@ __DATA__
72 git-add mainporcelain
73 git-am mainporcelain
74 git-annotate ancillaryinterrogators
75 -git-applypatch purehelpers
75 git-apply plumbingmanipulators
76 git-archimport foreignscminterface
77 git-archive mainporcelain
Documentation/git-am.txt
+1 -1
@@ -145,7 +145,7 @@ names.
145
146 SEE ALSO
147 --------
148 -gitlink:git-applypatch[1], gitlink:git-apply[1].
148 +gitlink:git-apply[1].
149
150
151 Author
Documentation/git-applypatch.txt deleted
-53
@@ -1,53 +0,0 @@
1 -git-applypatch(1)
2 -=================
3 -
4 -NAME
5 -----
6 -git-applypatch - Apply one patch extracted from an e-mail
7 -
8 -
9 -SYNOPSIS
10 ---------
11 -'git-applypatch' <msg> <patch> <info> [<signoff>]
12 -
13 -DESCRIPTION
14 ------------
15 -This is usually not what an end user wants to run directly. See
16 -gitlink:git-am[1] instead.
17 -
18 -Takes three files <msg>, <patch>, and <info> prepared from an
19 -e-mail message by 'git-mailinfo', and creates a commit. It is
20 -usually not necessary to use this command directly.
21 -
22 -This command can run `applypatch-msg`, `pre-applypatch`, and
23 -`post-applypatch` hooks. See link:hooks.html[hooks] for more
24 -information.
25 -
26 -
27 -OPTIONS
28 --------
29 -<msg>::
30 - Commit log message (sans the first line, which comes
31 - from e-mail Subject stored in <info>).
32 -
33 -<patch>::
34 - The patch to apply.
35 -
36 -<info>::
37 - Author and subject information extracted from e-mail,
38 - used on "author" line and as the first line of the
39 - commit log message.
40 -
41 -
42 -Author
43 -------
44 -Written by Linus Torvalds <torvalds@osdl.org>
45 -
46 -Documentation
47 ---------------
48 -Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
49 -
50 -GIT
51 ----
52 -Part of the gitlink:git[7] suite
53 -
Documentation/git-mailinfo.txt
+1 -1
@@ -16,7 +16,7 @@ DESCRIPTION
16 Reading a single e-mail message from the standard input, and
17 writes the commit log message in <msg> file, and the patches in
18 <patch> file. The author name, e-mail and e-mail subject are
19 -written out to the standard output to be used by git-applypatch
19 +written out to the standard output to be used by git-am
20 to create a commit. It is usually not necessary to use this
21 command directly. See gitlink:git-am[1] instead.
22
Documentation/hooks.txt
+5 -8
@@ -12,11 +12,10 @@ This document describes the currently defined hooks.
12 applypatch-msg
13 --------------
14
15 -This hook is invoked by `git-applypatch` script, which is
16 -typically invoked by `git-am`. It takes a single
15 +This hook is invoked by `git-am` script. It takes a single
16 parameter, the name of the file that holds the proposed commit
17 log message. Exiting with non-zero status causes
19 -`git-applypatch` to abort before applying the patch.
18 +`git-am` to abort before applying the patch.
19
20 The hook is allowed to edit the message file in place, and can
21 be used to normalize the message into some project standard
@@ -29,8 +28,7 @@ The default 'applypatch-msg' hook, when enabled, runs the
28 pre-applypatch
29 --------------
30
32 -This hook is invoked by `git-applypatch` script, which is
33 -typically invoked by `git-am`. It takes no parameter,
31 +This hook is invoked by `git-am`. It takes no parameter,
32 and is invoked after the patch is applied, but before a commit
33 is made. Exiting with non-zero status causes the working tree
34 after application of the patch not committed.
@@ -44,12 +42,11 @@ The default 'pre-applypatch' hook, when enabled, runs the
42 post-applypatch
43 ---------------
44
47 -This hook is invoked by `git-applypatch` script, which is
48 -typically invoked by `git-am`. It takes no parameter,
45 +This hook is invoked by `git-am`. It takes no parameter,
46 and is invoked after the patch is applied and a commit is made.
47
48 This hook is meant primarily for notification, and cannot affect
52 -the outcome of `git-applypatch`.
49 +the outcome of `git-am`.
50
51 pre-commit
52 ----------
Makefile
+1 -1
@@ -206,7 +206,7 @@ SCRIPT_SH = \
206 git-repack.sh git-request-pull.sh git-reset.sh \
207 git-sh-setup.sh \
208 git-tag.sh git-verify-tag.sh \
209 - git-applypatch.sh git-am.sh \
209 + git-am.sh \
210 git-merge.sh git-merge-stupid.sh git-merge-octopus.sh \
211 git-merge-resolve.sh git-merge-ours.sh \
212 git-lost-found.sh git-quiltimport.sh
git-applypatch.sh deleted
-212
@@ -1,212 +0,0 @@
1 -#!/bin/sh
2 -##
3 -## applypatch takes four file arguments, and uses those to
4 -## apply the unpacked patch (surprise surprise) that they
5 -## represent to the current tree.
6 -##
7 -## The arguments are:
8 -## $1 - file with commit message
9 -## $2 - file with the actual patch
10 -## $3 - "info" file with Author, email and subject
11 -## $4 - optional file containing signoff to add
12 -##
13 -
14 -USAGE='<msg> <patch> <info> [<signoff>]'
15 -. git-sh-setup
16 -
17 -case "$#" in 3|4) ;; *) usage ;; esac
18 -
19 -final=.dotest/final-commit
20 -##
21 -## If this file exists, we ask before applying
22 -##
23 -query_apply=.dotest/.query_apply
24 -
25 -## We do not munge the first line of the commit message too much
26 -## if this file exists.
27 -keep_subject=.dotest/.keep_subject
28 -
29 -## We do not attempt the 3-way merge fallback unless this file exists.
30 -fall_back_3way=.dotest/.3way
31 -
32 -MSGFILE=$1
33 -PATCHFILE=$2
34 -INFO=$3
35 -SIGNOFF=$4
36 -EDIT=${VISUAL:-${EDITOR:-vi}}
37 -
38 -export GIT_AUTHOR_NAME="$(sed -n '/^Author/ s/Author: //p' "$INFO")"
39 -export GIT_AUTHOR_EMAIL="$(sed -n '/^Email/ s/Email: //p' "$INFO")"
40 -export GIT_AUTHOR_DATE="$(sed -n '/^Date/ s/Date: //p' "$INFO")"
41 -export SUBJECT="$(sed -n '/^Subject/ s/Subject: //p' "$INFO")"
42 -
43 -if test '' != "$SIGNOFF"
44 -then
45 - if test -f "$SIGNOFF"
46 - then
47 - SIGNOFF=`cat "$SIGNOFF"` || exit
48 - elif case "$SIGNOFF" in yes | true | me | please) : ;; *) false ;; esac
49 - then
50 - SIGNOFF=`git-var GIT_COMMITTER_IDENT | sed -e '
51 - s/>.*/>/
52 - s/^/Signed-off-by: /'
53 - `
54 - else
55 - SIGNOFF=
56 - fi
57 - if test '' != "$SIGNOFF"
58 - then
59 - LAST_SIGNED_OFF_BY=`
60 - sed -ne '/^Signed-off-by: /p' "$MSGFILE" |
61 - tail -n 1
62 - `
63 - test "$LAST_SIGNED_OFF_BY" = "$SIGNOFF" || {
64 - test '' = "$LAST_SIGNED_OFF_BY" && echo
65 - echo "$SIGNOFF"
66 - } >>"$MSGFILE"
67 - fi
68 -fi
69 -
70 -patch_header=
71 -test -f "$keep_subject" || patch_header='[PATCH] '
72 -
73 -{
74 - echo "$patch_header$SUBJECT"
75 - if test -s "$MSGFILE"
76 - then
77 - echo
78 - cat "$MSGFILE"
79 - fi
80 -} >"$final"
81 -
82 -interactive=yes
83 -test -f "$query_apply" || interactive=no
84 -
85 -while [ "$interactive" = yes ]; do
86 - echo "Commit Body is:"
87 - echo "--------------------------"
88 - cat "$final"
89 - echo "--------------------------"
90 - printf "Apply? [y]es/[n]o/[e]dit/[a]ccept all "
91 - read reply
92 - case "$reply" in
93 - y|Y) interactive=no;;
94 - n|N) exit 2;; # special value to tell dotest to keep going
95 - e|E) "$EDIT" "$final";;
96 - a|A) rm -f "$query_apply"
97 - interactive=no ;;
98 - esac
99 -done
100 -
101 -if test -x "$GIT_DIR"/hooks/applypatch-msg
102 -then
103 - "$GIT_DIR"/hooks/applypatch-msg "$final" || exit
104 -fi
105 -
106 -echo
107 -echo Applying "'$SUBJECT'"
108 -echo
109 -
110 -git-apply --index "$PATCHFILE" || {
111 -
112 - # git-apply exits with status 1 when the patch does not apply,
113 - # but it die()s with other failures, most notably upon corrupt
114 - # patch. In the latter case, there is no point to try applying
115 - # it to another tree and do 3-way merge.
116 - test $? = 1 || exit 1
117 -
118 - test -f "$fall_back_3way" || exit 1
119 -
120 - # Here if we know which revision the patch applies to,
121 - # we create a temporary working tree and index, apply the
122 - # patch, and attempt 3-way merge with the resulting tree.
123 -
124 - O_OBJECT=`cd "$GIT_OBJECT_DIRECTORY" && pwd`
125 - rm -fr .patch-merge-*
126 -
127 - if git-apply -z --index-info "$PATCHFILE" \
128 - >.patch-merge-index-info 2>/dev/null &&
129 - GIT_INDEX_FILE=.patch-merge-tmp-index \
130 - git-update-index -z --index-info <.patch-merge-index-info &&
131 - GIT_INDEX_FILE=.patch-merge-tmp-index \
132 - git-write-tree >.patch-merge-tmp-base &&
133 - (
134 - mkdir .patch-merge-tmp-dir &&
135 - cd .patch-merge-tmp-dir &&
136 - GIT_INDEX_FILE="../.patch-merge-tmp-index" \
137 - GIT_OBJECT_DIRECTORY="$O_OBJECT" \
138 - git-apply $binary --index
139 - ) <"$PATCHFILE"
140 - then
141 - echo Using index info to reconstruct a base tree...
142 - mv .patch-merge-tmp-base .patch-merge-base
143 - mv .patch-merge-tmp-index .patch-merge-index
144 - else
145 - (
146 - N=10
147 -
148 - # Otherwise, try nearby trees that can be used to apply the
149 - # patch.
150 - git-rev-list --max-count=$N HEAD
151 -
152 - # or hoping the patch is against known tags...
153 - git-ls-remote --tags .
154 - ) |
155 - while read base junk
156 - do
157 - # Try it if we have it as a tree.
158 - git-cat-file tree "$base" >/dev/null 2>&1 || continue
159 -
160 - rm -fr .patch-merge-tmp-* &&
161 - mkdir .patch-merge-tmp-dir || break
162 - (
163 - cd .patch-merge-tmp-dir &&
164 - GIT_INDEX_FILE=../.patch-merge-tmp-index &&
165 - GIT_OBJECT_DIRECTORY="$O_OBJECT" &&
166 - export GIT_INDEX_FILE GIT_OBJECT_DIRECTORY &&
167 - git-read-tree "$base" &&
168 - git-apply --index &&
169 - mv ../.patch-merge-tmp-index ../.patch-merge-index &&
170 - echo "$base" >../.patch-merge-base
171 - ) <"$PATCHFILE" 2>/dev/null && break
172 - done
173 - fi
174 -
175 - test -f .patch-merge-index &&
176 - his_tree=$(GIT_INDEX_FILE=.patch-merge-index git-write-tree) &&
177 - orig_tree=$(cat .patch-merge-base) &&
178 - rm -fr .patch-merge-* || exit 1
179 -
180 - echo Falling back to patching base and 3-way merge using $orig_tree...
181 -
182 - # This is not so wrong. Depending on which base we picked,
183 - # orig_tree may be wildly different from ours, but his_tree
184 - # has the same set of wildly different changes in parts the
185 - # patch did not touch, so resolve ends up canceling them,
186 - # saying that we reverted all those changes.
187 -
188 - if git-merge-resolve $orig_tree -- HEAD $his_tree
189 - then
190 - echo Done.
191 - else
192 - echo Failed to merge in the changes.
193 - exit 1
194 - fi
195 -}
196 -
197 -if test -x "$GIT_DIR"/hooks/pre-applypatch
198 -then
199 - "$GIT_DIR"/hooks/pre-applypatch || exit
200 -fi
201 -
202 -tree=$(git-write-tree) || exit 1
203 -echo Wrote tree $tree
204 -parent=$(git-rev-parse --verify HEAD) &&
205 -commit=$(git-commit-tree $tree -p $parent <"$final") || exit 1
206 -echo Committed: $commit
207 -git-update-ref -m "applypatch: $SUBJECT" HEAD $commit $parent || exit
208 -
209 -if test -x "$GIT_DIR"/hooks/post-applypatch
210 -then
211 - "$GIT_DIR"/hooks/post-applypatch
212 -fi