blob: 6cdd5910db50c96df3d149fba172750cb10c09cb [file] [log] [blame]
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -07001#!/bin/sh
2#
Junio C Hamanod64e6b02006-02-18 20:51:26 -08003# Copyright (c) 2005, 2006 Junio C Hamano
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -07004
Jeff Kingc1491842008-03-01 01:22:55 -05005SUBDIRECTORY_OK=Yes
Pierre Habouzit78443d92007-11-04 11:30:57 +01006OPTIONS_KEEPDASHDASH=
7OPTIONS_SPEC="\
Štěpán Němec0adda932010-10-08 19:31:17 +02008git am [options] [(<mbox>|<Maildir>)...]
Stephan Beyer09f8d052008-07-25 20:22:23 +02009git am [options] (--resolved | --skip | --abort)
Pierre Habouzit78443d92007-11-04 11:30:57 +010010--
Junio C Hamano66006c62007-11-08 23:04:31 -080011i,interactive run interactively
Jay Soffian98ef23b2009-01-28 10:03:10 -050012b,binary* (historical option -- no-op)
Pierre Habouzit78443d92007-11-04 11:30:57 +0100133,3way allow fall back on 3way merging if needed
Stephen Boyd0e987a12009-06-16 15:33:01 -070014q,quiet be quiet
Pierre Habouzit78443d92007-11-04 11:30:57 +010015s,signoff add a Signed-off-by line to the commit message
16u,utf8 recode into utf8 (default)
Jörg Sommerfe1fa942008-02-03 00:58:06 +010017k,keep pass -k flag to git-mailinfo
Stefan-W. Hahnad2c9282010-02-27 15:20:26 +010018keep-cr pass --keep-cr flag to git-mailsplit for mbox format
Stefan-W. Hahne80d4cb2010-02-27 15:20:27 +010019no-keep-cr do not pass --keep-cr flag to git-mailsplit independent of am.keepcr
Junio C Hamano017678b2009-08-26 21:36:05 -070020c,scissors strip everything before a scissors line
Pierre Habouzit78443d92007-11-04 11:30:57 +010021whitespace= pass it through git-apply
Giuseppe Bilotta86c91f92009-08-04 13:16:49 +020022ignore-space-change pass it through git-apply
23ignore-whitespace pass it through git-apply
Junio C Hamanob47dfe92009-01-11 22:21:48 -080024directory= pass it through git-apply
Pierre Habouzit78443d92007-11-04 11:30:57 +010025C= pass it through git-apply
26p= pass it through git-apply
Giuseppe Bilottaa5a67552009-05-27 11:25:16 +020027patch-format= format the patch(es) are in
martin f. krafftb80da422009-01-23 11:31:21 +110028reject pass it through git-apply
Pierre Habouzit78443d92007-11-04 11:30:57 +010029resolvemsg= override error message when patch failure occurs
Jeff Kingc8089af2010-02-11 17:27:14 -050030continue continue applying patches after resolving a conflict
31r,resolved synonyms for --continue
Junio C Hamano3041c322008-03-04 00:25:06 -080032skip skip the current patch
Nanako Shiraishi3e5057a2008-07-16 19:39:10 +090033abort restore the original branch and abort the patching operation.
Junio C Hamano3f01ad62009-01-22 16:14:58 -080034committer-date-is-author-date lie about committer date
Nanako Shiraishia79ec622009-01-24 10:18:02 +090035ignore-date use current timestamp for author date
Junio C Hamanocb6020b2009-12-04 00:20:48 -080036rerere-autoupdate update the index with reused conflict resolution if possible
Jay Soffian98ef23b2009-01-28 10:03:10 -050037rebasing* (internal use for git-rebase)"
Pierre Habouzit78443d92007-11-04 11:30:57 +010038
freku045@student.liu.secf1fe882005-12-13 23:30:31 +010039. git-sh-setup
Junio C Hamanobb034f82008-03-04 00:25:04 -080040prefix=$(git rev-parse --show-prefix)
Shawn O. Pearcef9474132006-12-28 02:34:48 -050041set_reflog_action am
Shawn O. Pearce7eff28a2006-12-30 23:32:38 -050042require_work_tree
Jeff Kingc1491842008-03-01 01:22:55 -050043cd_to_toplevel
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -070044
Stephan Beyer460abee2008-07-12 17:46:59 +020045git var GIT_COMMITTER_IDENT >/dev/null ||
46 die "You need to set your committer info first"
Junio C Hamanod64e6b02006-02-18 20:51:26 -080047
Nanako Shiraishif79d4c82009-04-10 09:34:42 +090048if git rev-parse --verify -q HEAD >/dev/null
49then
50 HAS_HEAD=yes
51else
52 HAS_HEAD=
53fi
54
Ramkumar Ramachandrad2c46312010-06-02 10:33:35 +020055cmdline="git am"
56if test '' != "$interactive"
57then
58 cmdline="$cmdline -i"
59fi
60if test '' != "$threeway"
61then
62 cmdline="$cmdline -3"
63fi
64
Junio C Hamanob47dfe92009-01-11 22:21:48 -080065sq () {
Christian Couder47c97392009-04-24 08:29:01 +020066 git rev-parse --sq-quote "$@"
Junio C Hamanob47dfe92009-01-11 22:21:48 -080067}
68
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -070069stop_here () {
70 echo "$1" >"$dotest/next"
Junio C Hamano7b3b7e32010-12-21 10:35:53 -080071 git rev-parse --verify -q HEAD >"$dotest/abort-safety"
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -070072 exit 1
73}
74
Junio C Hamano7b3b7e32010-12-21 10:35:53 -080075safe_to_abort () {
76 if test -f "$dotest/dirtyindex"
77 then
78 return 1
79 fi
80
81 if ! test -s "$dotest/abort-safety"
82 then
83 return 0
84 fi
85
86 abort_safety=$(cat "$dotest/abort-safety")
87 if test "z$(git rev-parse --verify -q HEAD)" = "z$abort_safety"
88 then
89 return 0
90 fi
91 echo >&2 "You seem to have moved HEAD since the last 'am' failure."
92 echo >&2 "Not rewinding to ORIG_HEAD"
93 return 1
94}
95
Robert Shearmanced94562006-05-02 13:32:43 +010096stop_here_user_resolve () {
Seancc120052006-05-13 23:34:08 -040097 if [ -n "$resolvemsg" ]; then
Jeff Kinga23bfae2007-05-26 00:33:03 -070098 printf '%s\n' "$resolvemsg"
Seancc120052006-05-13 23:34:08 -040099 stop_here $1
100 fi
Robert Shearmanced94562006-05-02 13:32:43 +0100101 echo "When you have resolved this problem run \"$cmdline --resolved\"."
102 echo "If you would prefer to skip this patch, instead run \"$cmdline --skip\"."
Nanako Shiraishi3e5057a2008-07-16 19:39:10 +0900103 echo "To restore the original branch and stop patching run \"$cmdline --abort\"."
Robert Shearmanced94562006-05-02 13:32:43 +0100104
105 stop_here $1
106}
107
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700108go_next () {
109 rm -f "$dotest/$msgnum" "$dotest/msg" "$dotest/msg-clean" \
110 "$dotest/patch" "$dotest/info"
111 echo "$next" >"$dotest/next"
112 this=$next
113}
114
Junio C Hamanofd7bcfb2006-08-12 16:16:47 -0700115cannot_fallback () {
116 echo "$1"
117 echo "Cannot fall back to three-way merge."
118 exit 1
119}
120
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700121fall_back_3way () {
122 O_OBJECT=`cd "$GIT_OBJECT_DIRECTORY" && pwd`
123
124 rm -fr "$dotest"/patch-merge-*
125 mkdir "$dotest/patch-merge-tmp-dir"
126
127 # First see if the patch records the index info that we can use.
Johannes Schindelin7a988692007-09-17 23:34:06 +0100128 git apply --build-fake-ancestor "$dotest/patch-merge-tmp-index" \
129 "$dotest/patch" &&
Junio C Hamanofd7bcfb2006-08-12 16:16:47 -0700130 GIT_INDEX_FILE="$dotest/patch-merge-tmp-index" \
Junio C Hamano5be60072007-07-02 22:52:14 -0700131 git write-tree >"$dotest/patch-merge-base+" ||
Junio C Hamanob1440cc2007-02-24 01:05:27 -0800132 cannot_fallback "Repository lacks necessary blobs to fall back on 3-way merge."
Junio C Hamanofd7bcfb2006-08-12 16:16:47 -0700133
Stephen Boyd0e987a12009-06-16 15:33:01 -0700134 say Using index info to reconstruct a base tree...
Junio C Hamanofd7bcfb2006-08-12 16:16:47 -0700135 if GIT_INDEX_FILE="$dotest/patch-merge-tmp-index" \
Stephan Beyercb3a1602008-08-09 01:28:54 +0200136 git apply --cached <"$dotest/patch"
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700137 then
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700138 mv "$dotest/patch-merge-base+" "$dotest/patch-merge-base"
139 mv "$dotest/patch-merge-tmp-index" "$dotest/patch-merge-index"
Junio C Hamanofd7bcfb2006-08-12 16:16:47 -0700140 else
141 cannot_fallback "Did you hand edit your patch?
142It does not apply to blobs recorded in its index."
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700143 fi
144
145 test -f "$dotest/patch-merge-index" &&
Junio C Hamano5be60072007-07-02 22:52:14 -0700146 his_tree=$(GIT_INDEX_FILE="$dotest/patch-merge-index" git write-tree) &&
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700147 orig_tree=$(cat "$dotest/patch-merge-base") &&
148 rm -fr "$dotest"/patch-merge-* || exit 1
149
Stephen Boyd0e987a12009-06-16 15:33:01 -0700150 say Falling back to patching base and 3-way merge...
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700151
152 # This is not so wrong. Depending on which base we picked,
153 # orig_tree may be wildly different from ours, but his_tree
154 # has the same set of wildly different changes in parts the
Shawn O. Pearce579c9bb2006-12-28 02:35:27 -0500155 # patch did not touch, so recursive ends up canceling them,
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700156 # saying that we reverted all those changes.
157
Linus Torvalds2e6e3e8292008-04-15 12:56:50 -0700158 eval GITHEAD_$his_tree='"$FIRSTLINE"'
Shawn O. Pearce579c9bb2006-12-28 02:35:27 -0500159 export GITHEAD_$his_tree
Stephen Boyd0e987a12009-06-16 15:33:01 -0700160 if test -n "$GIT_QUIET"
161 then
Junio C Hamano69ae92b2010-10-13 11:36:36 -0700162 GIT_MERGE_VERBOSITY=0 && export GIT_MERGE_VERBOSITY
Stephen Boyd0e987a12009-06-16 15:33:01 -0700163 fi
Shawn O. Pearce579c9bb2006-12-28 02:35:27 -0500164 git-merge-recursive $orig_tree -- HEAD $his_tree || {
Junio C Hamanocb6020b2009-12-04 00:20:48 -0800165 git rerere $allow_rerere_autoupdate
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700166 echo Failed to merge in the changes.
167 exit 1
168 }
Shawn O. Pearce579c9bb2006-12-28 02:35:27 -0500169 unset GITHEAD_$his_tree
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700170}
171
Giuseppe Bilotta0cd29a02009-05-27 11:25:19 +0200172clean_abort () {
173 test $# = 0 || echo >&2 "$@"
174 rm -fr "$dotest"
175 exit 1
176}
177
Giuseppe Bilottaa5a67552009-05-27 11:25:16 +0200178patch_format=
179
180check_patch_format () {
181 # early return if patch_format was set from the command line
182 if test -n "$patch_format"
183 then
184 return 0
185 fi
Giuseppe Bilotta15ced752009-05-27 23:20:12 +0200186
187 # we default to mbox format if input is from stdin and for
188 # directories
189 if test $# = 0 || test "x$1" = "x-" || test -d "$1"
190 then
191 patch_format=mbox
192 return 0
193 fi
194
195 # otherwise, check the first few lines of the first patch to try
196 # to detect its format
197 {
198 read l1
199 read l2
200 read l3
201 case "$l1" in
202 "From "* | "From: "*)
203 patch_format=mbox
204 ;;
205 '# This series applies on GIT commit'*)
206 patch_format=stgit-series
207 ;;
208 "# HG changeset patch")
209 patch_format=hg
210 ;;
211 *)
212 # if the second line is empty and the third is
213 # a From, Author or Date entry, this is very
214 # likely an StGIT patch
215 case "$l2,$l3" in
216 ,"From: "* | ,"Author: "* | ,"Date: "*)
217 patch_format=stgit
218 ;;
219 *)
220 ;;
221 esac
222 ;;
223 esac
Junio C Hamano0fcb2ca2009-08-06 20:08:12 -0500224 if test -z "$patch_format" &&
225 test -n "$l1" &&
226 test -n "$l2" &&
227 test -n "$l3"
228 then
229 # This begins with three non-empty lines. Is this a
230 # piece of e-mail a-la RFC2822? Grab all the headers,
231 # discarding the indented remainder of folded lines,
232 # and see if it looks like that they all begin with the
233 # header field names...
Stephen Boyde3f67d32010-01-25 16:33:59 -0800234 tr -d '\015' <"$1" |
235 sed -n -e '/^$/q' -e '/^[ ]/d' -e p |
Junio C Hamanoe1622bf2009-11-23 15:56:32 -0800236 sane_egrep -v '^[!-9;-~]+:' >/dev/null ||
Junio C Hamano0fcb2ca2009-08-06 20:08:12 -0500237 patch_format=mbox
238 fi
Giuseppe Bilotta0cd29a02009-05-27 11:25:19 +0200239 } < "$1" || clean_abort
Giuseppe Bilottaa5a67552009-05-27 11:25:16 +0200240}
241
242split_patches () {
243 case "$patch_format" in
244 mbox)
Stefan-W. Hahne80d4cb2010-02-27 15:20:27 +0100245 if test -n "$rebasing" || test t = "$keepcr"
Stefan-W. Hahnad2c9282010-02-27 15:20:26 +0100246 then
247 keep_cr=--keep-cr
248 else
249 keep_cr=
250 fi
Junio C Hamanoc2ca1d72009-08-04 22:31:59 -0500251 git mailsplit -d"$prec" -o"$dotest" -b $keep_cr -- "$@" > "$dotest/last" ||
Giuseppe Bilotta0cd29a02009-05-27 11:25:19 +0200252 clean_abort
Giuseppe Bilottaa5a67552009-05-27 11:25:16 +0200253 ;;
Giuseppe Bilottac574e682009-05-27 11:25:18 +0200254 stgit-series)
255 if test $# -ne 1
256 then
Giuseppe Bilotta0cd29a02009-05-27 11:25:19 +0200257 clean_abort "Only one StGIT patch series can be applied at once"
Giuseppe Bilottac574e682009-05-27 11:25:18 +0200258 fi
259 series_dir=`dirname "$1"`
260 series_file="$1"
261 shift
262 {
263 set x
264 while read filename
265 do
266 set "$@" "$series_dir/$filename"
267 done
268 # remove the safety x
269 shift
270 # remove the arg coming from the first-line comment
271 shift
Giuseppe Bilotta0cd29a02009-05-27 11:25:19 +0200272 } < "$series_file" || clean_abort
Giuseppe Bilottac574e682009-05-27 11:25:18 +0200273 # set the patch format appropriately
274 patch_format=stgit
275 # now handle the actual StGIT patches
276 split_patches "$@"
277 ;;
278 stgit)
279 this=0
280 for stgit in "$@"
281 do
282 this=`expr "$this" + 1`
283 msgnum=`printf "%0${prec}d" $this`
284 # Perl version of StGIT parse_patch. The first nonemptyline
285 # not starting with Author, From or Date is the
286 # subject, and the body starts with the next nonempty
287 # line not starting with Author, From or Date
288 perl -ne 'BEGIN { $subject = 0 }
289 if ($subject > 1) { print ; }
290 elsif (/^\s+$/) { next ; }
291 elsif (/^Author:/) { print s/Author/From/ ; }
292 elsif (/^(From|Date)/) { print ; }
293 elsif ($subject) {
294 $subject = 2 ;
295 print "\n" ;
296 print ;
297 } else {
298 print "Subject: ", $_ ;
299 $subject = 1;
300 }
Giuseppe Bilotta0cd29a02009-05-27 11:25:19 +0200301 ' < "$stgit" > "$dotest/$msgnum" || clean_abort
Giuseppe Bilottac574e682009-05-27 11:25:18 +0200302 done
303 echo "$this" > "$dotest/last"
304 this=
305 msgnum=
306 ;;
Giuseppe Bilottaa5a67552009-05-27 11:25:16 +0200307 *)
Nicolas Sebrecht46caf502009-08-06 20:08:13 -0500308 if test -n "$parse_patch" ; then
309 clean_abort "Patch format $patch_format is not supported."
310 else
311 clean_abort "Patch format detection failed."
312 fi
Giuseppe Bilottaa5a67552009-05-27 11:25:16 +0200313 ;;
314 esac
315}
316
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700317prec=4
Johannes Schindelin51ef1da2008-07-21 12:51:02 +0200318dotest="$GIT_DIR/rebase-apply"
Stefan-W. Hahnad2c9282010-02-27 15:20:26 +0100319sign= utf8=t keep= keepcr= skip= interactive= resolved= rebasing= abort=
Lukas Sandströmd25e5152009-11-20 17:12:47 +0100320resolvemsg= resume= scissors= no_inbody_headers=
Michael S. Tsirkin67dad682007-02-08 15:57:08 +0200321git_apply_opt=
Junio C Hamano3f01ad62009-01-22 16:14:58 -0800322committer_date_is_author_date=
Nanako Shiraishia79ec622009-01-24 10:18:02 +0900323ignore_date=
Junio C Hamanocb6020b2009-12-04 00:20:48 -0800324allow_rerere_autoupdate=
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700325
Stefan-W. Hahne80d4cb2010-02-27 15:20:27 +0100326if test "$(git config --bool --get am.keepcr)" = true
327then
328 keepcr=t
329fi
330
David Kastrup822f7c72007-09-23 22:42:08 +0200331while test $# != 0
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700332do
333 case "$1" in
Pierre Habouzit78443d92007-11-04 11:30:57 +0100334 -i|--interactive)
335 interactive=t ;;
336 -b|--binary)
Stephan Beyercb3a1602008-08-09 01:28:54 +0200337 : ;;
Pierre Habouzit78443d92007-11-04 11:30:57 +0100338 -3|--3way)
339 threeway=t ;;
Johannes Sixtdfdd7e62007-11-06 21:33:58 +0100340 -s|--signoff)
Pierre Habouzit78443d92007-11-04 11:30:57 +0100341 sign=t ;;
342 -u|--utf8)
343 utf8=t ;; # this is now default
344 --no-utf8)
345 utf8= ;;
346 -k|--keep)
347 keep=t ;;
Junio C Hamano017678b2009-08-26 21:36:05 -0700348 -c|--scissors)
349 scissors=t ;;
350 --no-scissors)
351 scissors=f ;;
Jeff Kingc8089af2010-02-11 17:27:14 -0500352 -r|--resolved|--continue)
Pierre Habouzit78443d92007-11-04 11:30:57 +0100353 resolved=t ;;
354 --skip)
355 skip=t ;;
Nanako Shiraishi3e5057a2008-07-16 19:39:10 +0900356 --abort)
357 abort=t ;;
Junio C Hamano3041c322008-03-04 00:25:06 -0800358 --rebasing)
Lukas Sandströmd25e5152009-11-20 17:12:47 +0100359 rebasing=t threeway=t keep=t scissors=f no_inbody_headers=t ;;
Pierre Habouzit78443d92007-11-04 11:30:57 +0100360 -d|--dotest)
Junio C Hamanoe72c7402008-03-04 00:25:05 -0800361 die "-d option is no longer supported. Do not use."
362 ;;
Pierre Habouzit78443d92007-11-04 11:30:57 +0100363 --resolvemsg)
364 shift; resolvemsg=$1 ;;
Junio C Hamanob47dfe92009-01-11 22:21:48 -0800365 --whitespace|--directory)
366 git_apply_opt="$git_apply_opt $(sq "$1=$2")"; shift ;;
Pierre Habouzit78443d92007-11-04 11:30:57 +0100367 -C|-p)
Junio C Hamanob47dfe92009-01-11 22:21:48 -0800368 git_apply_opt="$git_apply_opt $(sq "$1$2")"; shift ;;
Giuseppe Bilottaa5a67552009-05-27 11:25:16 +0200369 --patch-format)
370 shift ; patch_format="$1" ;;
Giuseppe Bilotta86c91f92009-08-04 13:16:49 +0200371 --reject|--ignore-whitespace|--ignore-space-change)
martin f. krafftb80da422009-01-23 11:31:21 +1100372 git_apply_opt="$git_apply_opt $1" ;;
Junio C Hamano3f01ad62009-01-22 16:14:58 -0800373 --committer-date-is-author-date)
374 committer_date_is_author_date=t ;;
Nanako Shiraishia79ec622009-01-24 10:18:02 +0900375 --ignore-date)
376 ignore_date=t ;;
Junio C Hamanocb6020b2009-12-04 00:20:48 -0800377 --rerere-autoupdate|--no-rerere-autoupdate)
378 allow_rerere_autoupdate="$1" ;;
Stephen Boyd0e987a12009-06-16 15:33:01 -0700379 -q|--quiet)
380 GIT_QUIET=t ;;
Stefan-W. Hahnad2c9282010-02-27 15:20:26 +0100381 --keep-cr)
382 keepcr=t ;;
Stefan-W. Hahne80d4cb2010-02-27 15:20:27 +0100383 --no-keep-cr)
384 keepcr=f ;;
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700385 --)
Pierre Habouzit78443d92007-11-04 11:30:57 +0100386 shift; break ;;
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700387 *)
Pierre Habouzit78443d92007-11-04 11:30:57 +0100388 usage ;;
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700389 esac
Pierre Habouzit78443d92007-11-04 11:30:57 +0100390 shift
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700391done
392
Junio C Hamano0c15cc92005-11-16 00:19:32 -0800393# If the dotest directory exists, but we have finished applying all the
394# patches in them, clear it out.
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700395if test -d "$dotest" &&
396 last=$(cat "$dotest/last") &&
397 next=$(cat "$dotest/next") &&
398 test $# != 0 &&
399 test "$next" -gt "$last"
400then
401 rm -fr "$dotest"
402fi
403
404if test -d "$dotest"
405then
Nanako Shiraishi3e5057a2008-07-16 19:39:10 +0900406 case "$#,$skip$resolved$abort" in
Junio C Hamanoc95b1382006-09-15 23:19:02 -0700407 0,*t*)
408 # Explicit resume command and we do not have file, so
409 # we are happy.
410 : ;;
411 0,)
412 # No file input but without resume parameters; catch
413 # user error to feed us a patch from standard input
Junio C Hamanoe72c7402008-03-04 00:25:05 -0800414 # when there is already $dotest. This is somewhat
Junio C Hamanoc95b1382006-09-15 23:19:02 -0700415 # unreliable -- stdin could be /dev/null for example
416 # and the caller did not intend to feed us a patch but
417 # wanted to continue unattended.
Jay Soffian98ef23b2009-01-28 10:03:10 -0500418 test -t 0
Junio C Hamanoc95b1382006-09-15 23:19:02 -0700419 ;;
420 *)
421 false
422 ;;
423 esac ||
Johannes Schindelin28ed6e72008-07-16 03:33:44 +0200424 die "previous rebase directory $dotest still exists but mbox given."
Junio C Hamano271440e2005-10-25 23:35:37 -0700425 resume=yes
Nanako Shiraishi3e5057a2008-07-16 19:39:10 +0900426
Olivier Marin95f8ebb2008-07-21 15:39:06 +0200427 case "$skip,$abort" in
Junio C Hamano2d56a132009-02-26 11:24:29 -0800428 t,t)
429 die "Please make up your mind. --skip or --abort?"
430 ;;
Olivier Marin95f8ebb2008-07-21 15:39:06 +0200431 t,)
432 git rerere clear
433 git read-tree --reset -u HEAD HEAD
434 orig_head=$(cat "$GIT_DIR/ORIG_HEAD")
435 git reset HEAD
436 git update-ref ORIG_HEAD $orig_head
437 ;;
438 ,t)
Junio C Hamano2d56a132009-02-26 11:24:29 -0800439 if test -f "$dotest/rebasing"
440 then
441 exec git rebase --abort
442 fi
Nanako Shiraishi3e5057a2008-07-16 19:39:10 +0900443 git rerere clear
Junio C Hamano7b3b7e32010-12-21 10:35:53 -0800444 if safe_to_abort
445 then
Michael J Gruberc7671842009-02-26 10:52:53 +0100446 git read-tree --reset -u HEAD ORIG_HEAD
447 git reset ORIG_HEAD
Junio C Hamano7b3b7e32010-12-21 10:35:53 -0800448 fi
Nanako Shiraishi3e5057a2008-07-16 19:39:10 +0900449 rm -fr "$dotest"
450 exit ;;
451 esac
Michael J Gruberc7671842009-02-26 10:52:53 +0100452 rm -f "$dotest/dirtyindex"
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700453else
Nanako Shiraishi3e5057a2008-07-16 19:39:10 +0900454 # Make sure we are not given --skip, --resolved, nor --abort
455 test "$skip$resolved$abort" = "" ||
Seancc120052006-05-13 23:34:08 -0400456 die "Resolve operation not in progress, we are not resuming."
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700457
458 # Start afresh.
459 mkdir -p "$dotest" || exit
460
Junio C Hamanobb034f82008-03-04 00:25:04 -0800461 if test -n "$prefix" && test $# != 0
462 then
463 first=t
464 for arg
465 do
466 test -n "$first" && {
467 set x
468 first=
469 }
Pat Thoyts5e9677c2010-09-30 14:24:07 +0100470 if is_absolute_path "$arg"
471 then
472 set "$@" "$arg"
473 else
474 set "$@" "$prefix$arg"
475 fi
Junio C Hamanobb034f82008-03-04 00:25:04 -0800476 done
477 shift
478 fi
Giuseppe Bilottaa5a67552009-05-27 11:25:16 +0200479
480 check_patch_format "$@"
481
482 split_patches "$@"
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700483
Junio C Hamano017678b2009-08-26 21:36:05 -0700484 # -i can and must be given when resuming; everything
485 # else is kept
Junio C Hamano9b9f5a22008-12-05 11:19:43 -0800486 echo " $git_apply_opt" >"$dotest/apply-opt"
Junio C Hamano22db2402008-12-04 15:38:27 -0800487 echo "$threeway" >"$dotest/threeway"
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700488 echo "$sign" >"$dotest/sign"
489 echo "$utf8" >"$dotest/utf8"
490 echo "$keep" >"$dotest/keep"
Stefan-W. Hahnad2c9282010-02-27 15:20:26 +0100491 echo "$keepcr" >"$dotest/keepcr"
Junio C Hamano017678b2009-08-26 21:36:05 -0700492 echo "$scissors" >"$dotest/scissors"
Lukas Sandströmd25e5152009-11-20 17:12:47 +0100493 echo "$no_inbody_headers" >"$dotest/no_inbody_headers"
Stephen Boyd0e987a12009-06-16 15:33:01 -0700494 echo "$GIT_QUIET" >"$dotest/quiet"
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700495 echo 1 >"$dotest/next"
Junio C Hamano3041c322008-03-04 00:25:06 -0800496 if test -n "$rebasing"
497 then
498 : >"$dotest/rebasing"
499 else
500 : >"$dotest/applying"
Nanako Shiraishif79d4c82009-04-10 09:34:42 +0900501 if test -n "$HAS_HEAD"
502 then
503 git update-ref ORIG_HEAD HEAD
504 else
505 git update-ref -d ORIG_HEAD >/dev/null 2>&1
506 fi
Junio C Hamano3041c322008-03-04 00:25:06 -0800507 fi
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700508fi
509
Junio C Hamano0c15cc92005-11-16 00:19:32 -0800510case "$resolved" in
511'')
Nanako Shiraishif79d4c82009-04-10 09:34:42 +0900512 case "$HAS_HEAD" in
513 '')
514 files=$(git ls-files) ;;
515 ?*)
516 files=$(git diff-index --cached --name-only HEAD --) ;;
517 esac || exit
Michael J Gruberc7671842009-02-26 10:52:53 +0100518 if test "$files"
519 then
Nanako Shiraishif79d4c82009-04-10 09:34:42 +0900520 test -n "$HAS_HEAD" && : >"$dotest/dirtyindex"
Michael J Gruberc7671842009-02-26 10:52:53 +0100521 die "Dirty index: cannot apply patches (dirty: $files)"
522 fi
Junio C Hamano0c15cc92005-11-16 00:19:32 -0800523esac
524
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700525if test "$(cat "$dotest/utf8")" = t
526then
527 utf8=-u
Junio C Hamanobb1091a2007-01-09 21:31:36 -0800528else
529 utf8=-n
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700530fi
531if test "$(cat "$dotest/keep")" = t
532then
533 keep=-k
534fi
Stefan-W. Hahne80d4cb2010-02-27 15:20:27 +0100535case "$(cat "$dotest/keepcr")" in
536t)
537 keepcr=--keep-cr ;;
538f)
539 keepcr=--no-keep-cr ;;
540esac
Junio C Hamano017678b2009-08-26 21:36:05 -0700541case "$(cat "$dotest/scissors")" in
542t)
543 scissors=--scissors ;;
544f)
545 scissors=--no-scissors ;;
546esac
Lukas Sandströmd25e5152009-11-20 17:12:47 +0100547if test "$(cat "$dotest/no_inbody_headers")" = t
548then
549 no_inbody_headers=--no-inbody-headers
550else
551 no_inbody_headers=
552fi
Stephen Boyd0e987a12009-06-16 15:33:01 -0700553if test "$(cat "$dotest/quiet")" = t
554then
555 GIT_QUIET=t
556fi
Junio C Hamano22db2402008-12-04 15:38:27 -0800557if test "$(cat "$dotest/threeway")" = t
558then
559 threeway=t
560fi
Junio C Hamano9b9f5a22008-12-05 11:19:43 -0800561git_apply_opt=$(cat "$dotest/apply-opt")
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700562if test "$(cat "$dotest/sign")" = t
563then
Todd Zullinger5354a562008-07-30 13:48:33 -0400564 SIGNOFF=`git var GIT_COMMITTER_IDENT | sed -e '
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700565 s/>.*/>/
566 s/^/Signed-off-by: /'
567 `
568else
569 SIGNOFF=
570fi
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700571
572last=`cat "$dotest/last"`
573this=`cat "$dotest/next"`
574if test "$skip" = t
575then
576 this=`expr "$this" + 1`
Jan Harkes69224712005-12-17 01:01:06 -0500577 resume=
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700578fi
579
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700580while test "$this" -le "$last"
581do
582 msgnum=`printf "%0${prec}d" $this`
583 next=`expr "$this" + 1`
584 test -f "$dotest/$msgnum" || {
Jan Harkes69224712005-12-17 01:01:06 -0500585 resume=
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700586 go_next
587 continue
588 }
Junio C Hamano0c15cc92005-11-16 00:19:32 -0800589
590 # If we are not resuming, parse and extract the patch information
591 # into separate files:
592 # - info records the authorship and title
593 # - msg is the rest of commit log message
594 # - patch is the patch body.
595 #
596 # When we are resuming, these files are either already prepared
597 # by the user, or the user can tell us to do so by --resolved flag.
Junio C Hamano271440e2005-10-25 23:35:37 -0700598 case "$resume" in
599 '')
Lukas Sandströmd25e5152009-11-20 17:12:47 +0100600 git mailinfo $keep $no_inbody_headers $scissors $utf8 "$dotest/msg" "$dotest/patch" \
Junio C Hamano271440e2005-10-25 23:35:37 -0700601 <"$dotest/$msgnum" >"$dotest/info" ||
602 stop_here $this
Johannes Schindelinca193cf2007-07-24 01:02:25 +0100603
604 # skip pine's internal folder data
Junio C Hamanoe1622bf2009-11-23 15:56:32 -0800605 sane_grep '^Author: Mail System Internal Data$' \
Johannes Schindelinca193cf2007-07-24 01:02:25 +0100606 <"$dotest"/info >/dev/null &&
607 go_next && continue
608
Johannes Schindelin28ed6e72008-07-16 03:33:44 +0200609 test -s "$dotest/patch" || {
Josh Triplett6777c382007-04-23 17:32:04 -0700610 echo "Patch is empty. Was it split wrong?"
Ramkumar Ramachandradc267b12010-06-02 10:33:36 +0200611 echo "If you would prefer to skip this patch, instead run \"$cmdline --skip\"."
612 echo "To restore the original branch and stop patching run \"$cmdline --abort\"."
Don Zickus87ab7992007-03-12 15:52:04 -0400613 stop_here $this
614 }
Jay Soffian43c23252010-06-16 03:12:40 -0400615 rm -f "$dotest/original-commit" "$dotest/author-script"
Junio C Hamano5e835ca2008-04-16 12:50:48 -0700616 if test -f "$dotest/rebasing" &&
617 commit=$(sed -e 's/^From \([0-9a-f]*\) .*/\1/' \
618 -e q "$dotest/$msgnum") &&
619 test "$(git cat-file -t "$commit")" = commit
620 then
621 git cat-file commit "$commit" |
622 sed -e '1,/^$/d' >"$dotest/msg-clean"
Thomas Rast96e19482010-03-12 18:04:29 +0100623 echo "$commit" > "$dotest/original-commit"
Jay Soffian43c23252010-06-16 03:12:40 -0400624 get_author_ident_from_commit "$commit" > "$dotest/author-script"
Junio C Hamano5e835ca2008-04-16 12:50:48 -0700625 else
Junio C Hamanoc970a6f2009-11-27 15:06:37 -0800626 {
627 sed -n '/^Subject/ s/Subject: //p' "$dotest/info"
628 echo
629 cat "$dotest/msg"
630 } |
631 git stripspace > "$dotest/msg-clean"
Junio C Hamano5e835ca2008-04-16 12:50:48 -0700632 fi
Junio C Hamano271440e2005-10-25 23:35:37 -0700633 ;;
634 esac
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700635
Jay Soffian43c23252010-06-16 03:12:40 -0400636 if test -f "$dotest/author-script"
637 then
638 eval $(cat "$dotest/author-script")
639 else
640 GIT_AUTHOR_NAME="$(sed -n '/^Author/ s/Author: //p' "$dotest/info")"
641 GIT_AUTHOR_EMAIL="$(sed -n '/^Email/ s/Email: //p' "$dotest/info")"
642 GIT_AUTHOR_DATE="$(sed -n '/^Date/ s/Date: //p' "$dotest/info")"
643 fi
Junio C Hamanoe0e3ba22005-12-14 16:31:06 -0800644
Junio C Hamano3b789592007-12-05 13:16:35 -0800645 if test -z "$GIT_AUTHOR_EMAIL"
Junio C Hamanoe0e3ba22005-12-14 16:31:06 -0800646 then
Junio C Hamano3b789592007-12-05 13:16:35 -0800647 echo "Patch does not have a valid e-mail address."
Junio C Hamanoe0e3ba22005-12-14 16:31:06 -0800648 stop_here $this
649 fi
650
Junio C Hamano2c674192005-10-20 22:31:56 -0700651 export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_AUTHOR_DATE
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700652
Junio C Hamano4bfb6b62005-11-08 00:41:37 -0800653 case "$resume" in
654 '')
655 if test '' != "$SIGNOFF"
656 then
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700657 LAST_SIGNED_OFF_BY=`
Junio C Hamano4bfb6b62005-11-08 00:41:37 -0800658 sed -ne '/^Signed-off-by: /p' \
659 "$dotest/msg-clean" |
Jeff Kingb4ce54f2008-03-12 17:34:34 -0400660 sed -ne '$p'
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700661 `
Junio C Hamano4bfb6b62005-11-08 00:41:37 -0800662 ADD_SIGNOFF=`
663 test "$LAST_SIGNED_OFF_BY" = "$SIGNOFF" || {
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700664 test '' = "$LAST_SIGNED_OFF_BY" && echo
665 echo "$SIGNOFF"
Junio C Hamano4bfb6b62005-11-08 00:41:37 -0800666 }`
667 else
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700668 ADD_SIGNOFF=
Junio C Hamano4bfb6b62005-11-08 00:41:37 -0800669 fi
670 {
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700671 if test -s "$dotest/msg-clean"
672 then
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700673 cat "$dotest/msg-clean"
674 fi
675 if test '' != "$ADD_SIGNOFF"
676 then
677 echo "$ADD_SIGNOFF"
678 fi
Junio C Hamano4bfb6b62005-11-08 00:41:37 -0800679 } >"$dotest/final-commit"
680 ;;
Junio C Hamano0c15cc92005-11-16 00:19:32 -0800681 *)
Junio C Hamano6d286442006-02-23 22:14:47 -0800682 case "$resolved$interactive" in
Junio C Hamano0c15cc92005-11-16 00:19:32 -0800683 tt)
684 # This is used only for interactive view option.
Junio C Hamano38762c42007-11-28 16:15:04 -0800685 git diff-index -p --cached HEAD -- >"$dotest/patch"
Junio C Hamano0c15cc92005-11-16 00:19:32 -0800686 ;;
687 esac
Junio C Hamano4bfb6b62005-11-08 00:41:37 -0800688 esac
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700689
Junio C Hamano4bfb6b62005-11-08 00:41:37 -0800690 resume=
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700691 if test "$interactive" = t
692 then
Junio C Hamanoa1451102005-10-12 18:31:41 -0700693 test -t 0 ||
694 die "cannot be interactive without stdin connected to a terminal."
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700695 action=again
696 while test "$action" = again
697 do
698 echo "Commit Body is:"
699 echo "--------------------------"
700 cat "$dotest/final-commit"
701 echo "--------------------------"
Jason Riedy97545632005-12-06 14:21:52 -0800702 printf "Apply? [y]es/[n]o/[e]dit/[v]iew patch/[a]ccept all "
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700703 read reply
704 case "$reply" in
Junio C Hamanof89ad672005-10-25 23:43:59 -0700705 [yY]*) action=yes ;;
706 [aA]*) action=yes interactive= ;;
707 [nN]*) action=skip ;;
Adam Robenef0c2ab2007-07-19 22:09:35 -0700708 [eE]*) git_editor "$dotest/final-commit"
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700709 action=again ;;
Junio C Hamanof89ad672005-10-25 23:43:59 -0700710 [vV]*) action=again
Jonathan Niederf6dff112010-02-14 23:04:13 -0600711 git_pager "$dotest/patch" ;;
Junio C Hamanof89ad672005-10-25 23:43:59 -0700712 *) action=again ;;
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700713 esac
714 done
715 else
716 action=yes
717 fi
Ramkumar Ramachandra92f65e62010-06-02 10:33:37 +0200718
719 if test -f "$dotest/final-commit"
720 then
721 FIRSTLINE=$(sed 1q "$dotest/final-commit")
722 else
723 FIRSTLINE=""
724 fi
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700725
726 if test $action = skip
727 then
728 go_next
729 continue
730 fi
731
732 if test -x "$GIT_DIR"/hooks/applypatch-msg
733 then
734 "$GIT_DIR"/hooks/applypatch-msg "$dotest/final-commit" ||
735 stop_here $this
736 fi
737
Stephen Boyd0e987a12009-06-16 15:33:01 -0700738 say "Applying: $FIRSTLINE"
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700739
Junio C Hamano0c15cc92005-11-16 00:19:32 -0800740 case "$resolved" in
741 '')
Stephen Boyd3ddd1702009-06-16 15:32:58 -0700742 # When we are allowed to fall back to 3-way later, don't give
743 # false errors during the initial attempt.
744 squelch=
745 if test "$threeway" = t
746 then
747 squelch='>/dev/null 2>&1 '
748 fi
749 eval "git apply $squelch$git_apply_opt"' --index "$dotest/patch"'
Junio C Hamano0c15cc92005-11-16 00:19:32 -0800750 apply_status=$?
751 ;;
752 t)
753 # Resolved means the user did all the hard work, and
754 # we do not have to do any patch application. Just
755 # trust what the user has in the index file and the
756 # working tree.
757 resolved=
Junio C Hamano38762c42007-11-28 16:15:04 -0800758 git diff-index --quiet --cached HEAD -- && {
Shawn O. Pearce64646d12006-12-21 21:30:17 -0500759 echo "No changes - did you forget to use 'git add'?"
Jan Krüger05bdcfe2010-05-30 10:19:26 +0200760 echo "If there is nothing left to stage, chances are that something else"
761 echo "already introduced the same changes; you might want to skip this patch."
Robert Shearmanced94562006-05-02 13:32:43 +0100762 stop_here_user_resolve $this
Alex Riesen06aff472007-03-25 01:56:13 +0100763 }
Junio C Hamano5be60072007-07-02 22:52:14 -0700764 unmerged=$(git ls-files -u)
Junio C Hamanoc1d11282006-04-28 02:32:44 -0700765 if test -n "$unmerged"
766 then
767 echo "You still have unmerged paths in your index"
Shawn O. Pearce64646d12006-12-21 21:30:17 -0500768 echo "did you forget to use 'git add'?"
Robert Shearmanced94562006-05-02 13:32:43 +0100769 stop_here_user_resolve $this
Junio C Hamanoc1d11282006-04-28 02:32:44 -0700770 fi
Junio C Hamano0c15cc92005-11-16 00:19:32 -0800771 apply_status=0
Johannes Schindelinb4372ef2007-07-06 13:05:59 +0100772 git rerere
Junio C Hamano0c15cc92005-11-16 00:19:32 -0800773 ;;
774 esac
775
Junio C Hamano0ba17dd2010-04-09 16:58:28 -0700776 if test $apply_status != 0 && test "$threeway" = t
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700777 then
Junio C Hamano73319032005-10-13 11:46:43 -0700778 if (fall_back_3way)
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700779 then
Junio C Hamano73319032005-10-13 11:46:43 -0700780 # Applying the patch to an earlier tree and merging the
781 # result may have produced the same tree as ours.
Junio C Hamano38762c42007-11-28 16:15:04 -0800782 git diff-index --quiet --cached HEAD -- && {
Stephen Boyd0e987a12009-06-16 15:33:01 -0700783 say No changes -- Patch already applied.
Alex Riesen06aff472007-03-25 01:56:13 +0100784 go_next
785 continue
786 }
Junio C Hamano73319032005-10-13 11:46:43 -0700787 # clear apply_status -- we have successfully merged.
788 apply_status=0
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700789 fi
790 fi
791 if test $apply_status != 0
792 then
Junio C Hamano4d2e2832009-01-18 19:34:31 -0800793 printf 'Patch failed at %s %s\n' "$msgnum" "$FIRSTLINE"
Robert Shearmanced94562006-05-02 13:32:43 +0100794 stop_here_user_resolve $this
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700795 fi
796
797 if test -x "$GIT_DIR"/hooks/pre-applypatch
798 then
799 "$GIT_DIR"/hooks/pre-applypatch || stop_here $this
800 fi
801
Junio C Hamano5be60072007-07-02 22:52:14 -0700802 tree=$(git write-tree) &&
Junio C Hamano3f01ad62009-01-22 16:14:58 -0800803 commit=$(
Nanako Shiraishia79ec622009-01-24 10:18:02 +0900804 if test -n "$ignore_date"
805 then
806 GIT_AUTHOR_DATE=
807 fi
Nanako Shiraishif79d4c82009-04-10 09:34:42 +0900808 parent=$(git rev-parse --verify -q HEAD) ||
Stephen Boyd0e987a12009-06-16 15:33:01 -0700809 say >&2 "applying to an empty history"
Nanako Shiraishif79d4c82009-04-10 09:34:42 +0900810
Junio C Hamano3f01ad62009-01-22 16:14:58 -0800811 if test -n "$committer_date_is_author_date"
812 then
813 GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
814 export GIT_COMMITTER_DATE
815 fi &&
Ben Jacksonea10b602009-04-18 20:42:07 -0700816 git commit-tree $tree ${parent:+-p} $parent <"$dotest/final-commit"
Junio C Hamano3f01ad62009-01-22 16:14:58 -0800817 ) &&
Linus Torvalds2e6e3e8292008-04-15 12:56:50 -0700818 git update-ref -m "$GIT_REFLOG_ACTION: $FIRSTLINE" HEAD $commit $parent ||
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700819 stop_here $this
820
Thomas Rast96e19482010-03-12 18:04:29 +0100821 if test -f "$dotest/original-commit"; then
822 echo "$(cat "$dotest/original-commit") $commit" >> "$dotest/rewritten"
823 fi
824
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700825 if test -x "$GIT_DIR"/hooks/post-applypatch
826 then
827 "$GIT_DIR"/hooks/post-applypatch
828 fi
829
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700830 go_next
831done
832
Thomas Rasteb2151b2010-03-12 18:04:33 +0100833if test -s "$dotest"/rewritten; then
834 git notes copy --for-rewrite=rebase < "$dotest"/rewritten
835 if test -x "$GIT_DIR"/hooks/post-rewrite; then
Thomas Rast96e19482010-03-12 18:04:29 +0100836 "$GIT_DIR"/hooks/post-rewrite rebase < "$dotest"/rewritten
Thomas Rasteb2151b2010-03-12 18:04:33 +0100837 fi
Thomas Rast96e19482010-03-12 18:04:29 +0100838fi
839
Junio C Hamanod1c5f2a2005-10-07 03:44:18 -0700840rm -fr "$dotest"
Jonathan Nieder29b67542010-02-22 08:35:46 -0600841git gc --auto