Shell utilities: Guard against expr' magic tokens.
[git/git.git] / git-commit.sh
CommitLineData
a3e870f2 1#!/bin/sh
5fec3ef1
JH
2#
3# Copyright (c) 2005 Linus Torvalds
130fcca6
JH
4# Copyright (c) 2006 Junio C Hamano
5
b4019f04 6USAGE='[-a] [-s] [-v] [--no-verify] [-m <message> | -F <logfile> | (-C|-c) <commit>) [--amend] [-e] [--author <author>] [[-i | -o] <path>...]'
130fcca6 7SUBDIRECTORY_OK=Yes
ae2b0f15 8. git-sh-setup
b33e9666 9
cf7bb589
JH
10git-rev-parse --verify HEAD >/dev/null 2>&1 || initial_commit=t
11branch=$(GIT_DIR="$GIT_DIR" git-symbolic-ref HEAD)
12
13case "$0" in
14*status)
15 status_only=t
16 unmerged_ok_if_status=--unmerged ;;
17*commit)
18 status_only=
19 unmerged_ok_if_status= ;;
20esac
130fcca6
JH
21
22refuse_partial () {
23 echo >&2 "$1"
130fcca6
JH
24 echo >&2 "You might have meant to say 'git commit -i paths...', perhaps?"
25 exit 1
26}
27
cf7bb589
JH
28THIS_INDEX="$GIT_DIR/index"
29NEXT_INDEX="$GIT_DIR/next-index$$"
30rm -f "$NEXT_INDEX"
5a798fb5 31save_index () {
cf7bb589
JH
32 cp "$THIS_INDEX" "$NEXT_INDEX"
33}
34
35report () {
36 header="#
37# $1:
38# ($2)
39#
40"
41 trailer=""
42 while read status name newname
43 do
44 printf '%s' "$header"
45 header=""
46 trailer="#
47"
48 case "$status" in
49 M ) echo "# modified: $name";;
50 D*) echo "# deleted: $name";;
51 T ) echo "# typechange: $name";;
52 C*) echo "# copied: $name -> $newname";;
53 R*) echo "# renamed: $name -> $newname";;
54 A*) echo "# new file: $name";;
55 U ) echo "# unmerged: $name";;
56 esac
57 done
58 printf '%s' "$trailer"
59 [ "$header" ]
5a798fb5
JH
60}
61
62run_status () {
cf7bb589
JH
63 (
64 # We always show status for the whole tree.
65 cd "$TOP"
66
b4019f04
JH
67 IS_INITIAL="$initial_commit"
68 REFERENCE=HEAD
69 case "$amend" in
70 t)
71 # If we are amending the initial commit, there
72 # is no HEAD^1.
73 if git-rev-parse --verify "HEAD^1" >/dev/null 2>&1
74 then
75 REFERENCE="HEAD^1"
76 IS_INITIAL=
77 else
78 IS_INITIAL=t
79 fi
80 ;;
81 esac
82
cf7bb589
JH
83 # If TMP_INDEX is defined, that means we are doing
84 # "--only" partial commit, and that index file is used
85 # to build the tree for the commit. Otherwise, if
86 # NEXT_INDEX exists, that is the index file used to
87 # make the commit. Otherwise we are using as-is commit
88 # so the regular index file is what we use to compare.
89 if test '' != "$TMP_INDEX"
90 then
91 GIT_INDEX_FILE="$TMP_INDEX"
92 export GIT_INDEX_FILE
93 elif test -f "$NEXT_INDEX"
94 then
95 GIT_INDEX_FILE="$NEXT_INDEX"
96 export GIT_INDEX_FILE
97 fi
98
99 case "$branch" in
100 refs/heads/master) ;;
101 *) echo "# On branch $branch" ;;
102 esac
103
b4019f04 104 if test -z "$IS_INITIAL"
cf7bb589 105 then
9ae6be80 106 git-diff-index -M --cached --name-status \
b4019f04 107 --diff-filter=MDTCRA $REFERENCE |
9ae6be80
JH
108 sed -e '
109 s/\\/\\\\/g
110 s/ /\\ /g
111 ' |
112 report "Updated but not checked in" "will commit"
cf7bb589
JH
113 committable="$?"
114 else
115 echo '#
116# Initial commit
117#'
118 git-ls-files |
119 sed -e '
120 s/\\/\\\\/g
121 s/ /\\ /g
122 s/^/A /
123 ' |
124 report "Updated but not checked in" "will commit"
125
126 committable="$?"
127 fi
128
129 git-diff-files --name-status |
130 sed -e '
131 s/\\/\\\\/g
132 s/ /\\ /g
133 ' |
134 report "Changed but not updated" \
135 "use git-update-index to mark for commit"
136
137 if test -f "$GIT_DIR/info/exclude"
138 then
139 git-ls-files -z --others --directory \
140 --exclude-from="$GIT_DIR/info/exclude" \
141 --exclude-per-directory=.gitignore
142 else
143 git-ls-files -z --others --directory \
144 --exclude-per-directory=.gitignore
145 fi |
146 perl -e '$/ = "\0";
147 my $shown = 0;
148 while (<>) {
149 chomp;
150 s|\\|\\\\|g;
151 s|\t|\\t|g;
152 s|\n|\\n|g;
153 s/^/# /;
154 if (!$shown) {
155 print "#\n# Untracked files:\n";
156 print "# (use \"git add\" to add to commit)\n";
157 print "#\n";
158 $shown = 1;
159 }
160 print "$_\n";
161 }
162 '
9ae6be80 163
1fa7a68f 164 if test -n "$verbose" -a -z "$IS_INITIAL"
9ae6be80 165 then
b4019f04 166 git-diff-index --cached -M -p --diff-filter=MDTCRA $REFERENCE
9ae6be80 167 fi
cf7bb589
JH
168 case "$committable" in
169 0)
170 echo "nothing to commit"
171 exit 1
172 esac
173 exit 0
174 )
5a798fb5
JH
175}
176
cf7bb589
JH
177trap '
178 test -z "$TMP_INDEX" || {
179 test -f "$TMP_INDEX" && rm -f "$TMP_INDEX"
180 }
181 rm -f "$NEXT_INDEX"
182' 0
183
184################################################################
185# Command line argument parsing and sanity checking
186
130fcca6
JH
187all=
188also=
5a798fb5 189only=
130fcca6
JH
190logfile=
191use_commit=
b4019f04 192amend=
130fcca6
JH
193no_edit=
194log_given=
195log_message=
196verify=t
cf7bb589 197verbose=
130fcca6
JH
198signoff=
199force_author=
bba319b5 200only_include_assumed=
0c091296 201while case "$#" in 0) break;; esac
5fec3ef1 202do
0c091296 203 case "$1" in
130fcca6
JH
204 -F|--F|-f|--f|--fi|--fil|--file)
205 case "$#" in 1) usage ;; esac
206 shift
207 no_edit=t
208 log_given=t$log_given
209 logfile="$1"
210 shift
211 ;;
212 -F*|-f*)
213 no_edit=t
214 log_given=t$log_given
215 logfile=`expr "$1" : '-[Ff]\(.*\)'`
216 shift
217 ;;
218 --F=*|--f=*|--fi=*|--fil=*|--file=*)
219 no_edit=t
220 log_given=t$log_given
221 logfile=`expr "$1" : '-[^=]*=\(.*\)'`
222 shift
223 ;;
0c091296 224 -a|--a|--al|--all)
130fcca6
JH
225 all=t
226 shift
227 ;;
228 --au=*|--aut=*|--auth=*|--autho=*|--author=*)
229 force_author=`expr "$1" : '-[^=]*=\(.*\)'`
230 shift
231 ;;
232 --au|--aut|--auth|--autho|--author)
233 case "$#" in 1) usage ;; esac
234 shift
235 force_author="$1"
236 shift
237 ;;
238 -e|--e|--ed|--edi|--edit)
239 no_edit=
240 shift
241 ;;
242 -i|--i|--in|--inc|--incl|--inclu|--includ|--include)
243 also=t
244 shift
245 ;;
5a798fb5
JH
246 -o|--o|--on|--onl|--only)
247 only=t
248 shift
249 ;;
0c091296 250 -m|--m|--me|--mes|--mess|--messa|--messag|--message)
130fcca6
JH
251 case "$#" in 1) usage ;; esac
252 shift
253 log_given=t$log_given
254 log_message="$1"
255 no_edit=t
256 shift
257 ;;
258 -m*)
259 log_given=t$log_given
260 log_message=`expr "$1" : '-m\(.*\)'`
261 no_edit=t
262 shift
263 ;;
264 --m=*|--me=*|--mes=*|--mess=*|--messa=*|--messag=*|--message=*)
265 log_given=t$log_given
266 log_message=`expr "$1" : '-[^=]*=\(.*\)'`
267 no_edit=t
268 shift
269 ;;
270 -n|--n|--no|--no-|--no-v|--no-ve|--no-ver|--no-veri|--no-verif|--no-verify)
271 verify=
272 shift
273 ;;
b4019f04
JH
274 --a|--am|--ame|--amen|--amend)
275 amend=t
276 log_given=t$log_given
277 use_commit=HEAD
278 shift
279 ;;
130fcca6
JH
280 -c)
281 case "$#" in 1) usage ;; esac
282 shift
283 log_given=t$log_given
284 use_commit="$1"
285 no_edit=
286 shift
287 ;;
288 --ree=*|--reed=*|--reedi=*|--reedit=*|--reedit-=*|--reedit-m=*|\
0c091296
JH
289 --reedit-me=*|--reedit-mes=*|--reedit-mess=*|--reedit-messa=*|\
290 --reedit-messag=*|--reedit-message=*)
130fcca6
JH
291 log_given=t$log_given
292 use_commit=`expr "$1" : '-[^=]*=\(.*\)'`
293 no_edit=
294 shift
295 ;;
296 --ree|--reed|--reedi|--reedit|--reedit-|--reedit-m|--reedit-me|\
0c091296 297 --reedit-mes|--reedit-mess|--reedit-messa|--reedit-messag|--reedit-message)
130fcca6
JH
298 case "$#" in 1) usage ;; esac
299 shift
300 log_given=t$log_given
301 use_commit="$1"
302 no_edit=
303 shift
304 ;;
305 -C)
306 case "$#" in 1) usage ;; esac
307 shift
308 log_given=t$log_given
309 use_commit="$1"
310 no_edit=t
311 shift
312 ;;
313 --reu=*|--reus=*|--reuse=*|--reuse-=*|--reuse-m=*|--reuse-me=*|\
0c091296
JH
314 --reuse-mes=*|--reuse-mess=*|--reuse-messa=*|--reuse-messag=*|\
315 --reuse-message=*)
130fcca6
JH
316 log_given=t$log_given
317 use_commit=`expr "$1" : '-[^=]*=\(.*\)'`
318 no_edit=t
319 shift
320 ;;
321 --reu|--reus|--reuse|--reuse-|--reuse-m|--reuse-me|--reuse-mes|\
0c091296 322 --reuse-mess|--reuse-messa|--reuse-messag|--reuse-message)
130fcca6
JH
323 case "$#" in 1) usage ;; esac
324 shift
325 log_given=t$log_given
326 use_commit="$1"
327 no_edit=t
328 shift
329 ;;
0cfe1d30 330 -s|--s|--si|--sig|--sign|--signo|--signof|--signoff)
130fcca6
JH
331 signoff=t
332 shift
333 ;;
cf7bb589
JH
334 -v|--v|--ve|--ver|--verb|--verbo|--verbos|--verbose)
335 verbose=t
336 shift
130fcca6 337 ;;
0c091296 338 --)
130fcca6
JH
339 shift
340 break
341 ;;
0c091296 342 -*)
130fcca6
JH
343 usage
344 ;;
0c091296 345 *)
130fcca6
JH
346 break
347 ;;
0c091296 348 esac
5fec3ef1
JH
349done
350
cf7bb589
JH
351################################################################
352# Sanity check options
353
b4019f04
JH
354case "$amend,$initial_commit" in
355t,t)
356 die "You do not have anything to amend." ;;
357t,)
358 if [ -f "$GIT_DIR/MERGE_HEAD" ]; then
359 die "You are in the middle of a merge -- cannot amend."
360 fi ;;
361esac
362
0c091296
JH
363case "$log_given" in
364tt*)
365 die "Only one of -c/-C/-F/-m can be used." ;;
366esac
367
5a798fb5
JH
368case "$#,$also$only" in
369*,tt)
370 die "Only one of --include/--only can be used." ;;
3710,t)
372 die "No paths with --include/--only does not make sense." ;;
3730,)
374 ;;
375*,)
756e3ee0 376 only_include_assumed="# Explicit paths specified without -i nor -o; assuming --only paths..."
4170a195 377 also=
5a798fb5
JH
378 ;;
379esac
380unset only
cf7bb589
JH
381case "$all,$also,$#" in
382t,t,*)
383 die "Cannot use -a and -i at the same time." ;;
384t,,[1-9]*)
385 die "Paths with -a does not make sense." ;;
386,t,0)
387 die "No paths with -i does not make sense." ;;
388esac
389
390################################################################
391# Prepare index to have a tree to be committed
5a798fb5 392
130fcca6 393TOP=`git-rev-parse --show-cdup`
5a798fb5
JH
394if test -z "$TOP"
395then
396 TOP=./
397fi
130fcca6
JH
398
399case "$all,$also" in
130fcca6 400t,)
5a798fb5 401 save_index &&
130fcca6 402 (
5a798fb5 403 cd "$TOP"
cf7bb589
JH
404 GIT_INDEX_FILE="$NEXT_INDEX"
405 export GIT_INDEX_FILE
130fcca6
JH
406 git-diff-files --name-only -z |
407 git-update-index --remove -z --stdin
408 )
6a0049c0 409 ;;
130fcca6 410,t)
5a798fb5 411 save_index &&
bba319b5
JH
412 git-ls-files --error-unmatch -- "$@" >/dev/null || exit
413
130fcca6 414 git-diff-files --name-only -z -- "$@" |
cf7bb589
JH
415 (
416 cd "$TOP"
417 GIT_INDEX_FILE="$NEXT_INDEX"
418 export GIT_INDEX_FILE
419 git-update-index --remove -z --stdin
420 )
22cff6a5 421 ;;
130fcca6
JH
422,)
423 case "$#" in
424 0)
425 ;; # commit as-is
426 *)
427 if test -f "$GIT_DIR/MERGE_HEAD"
428 then
429 refuse_partial "Cannot do a partial commit during a merge."
430 fi
431 TMP_INDEX="$GIT_DIR/tmp-index$$"
432 if test -z "$initial_commit"
433 then
434 # make sure index is clean at the specified paths, or
435 # they are additions.
436 dirty_in_index=`git-diff-index --cached --name-status \
5a798fb5 437 --diff-filter=DMTU HEAD -- "$@"`
130fcca6 438 test -z "$dirty_in_index" ||
5a798fb5 439 refuse_partial "Different in index and the last commit:
130fcca6
JH
440$dirty_in_index"
441 fi
bba319b5 442 commit_only=`git-ls-files --error-unmatch -- "$@"` || exit
cf7bb589
JH
443
444 # Build the temporary index and update the real index
445 # the same way.
446 if test -z "$initial_commit"
447 then
448 cp "$THIS_INDEX" "$TMP_INDEX"
449 GIT_INDEX_FILE="$TMP_INDEX" git-read-tree -m HEAD
450 else
451 rm -f "$TMP_INDEX"
452 fi || exit
453
454 echo "$commit_only" |
455 GIT_INDEX_FILE="$TMP_INDEX" \
456 git-update-index --add --remove --stdin &&
457
458 save_index &&
459 echo "$commit_only" |
460 (
461 GIT_INDEX_FILE="$NEXT_INDEX"
462 export GIT_INDEX_FILE
463 git-update-index --remove --stdin
464 ) || exit
465 ;;
130fcca6
JH
466 esac
467 ;;
468esac
469
cf7bb589
JH
470################################################################
471# If we do as-is commit, the index file will be THIS_INDEX,
472# otherwise NEXT_INDEX after we make this commit. We leave
473# the index as is if we abort.
130fcca6 474
cf7bb589 475if test -f "$NEXT_INDEX"
130fcca6 476then
cf7bb589
JH
477 USE_INDEX="$NEXT_INDEX"
478else
479 USE_INDEX="$THIS_INDEX"
130fcca6
JH
480fi
481
cf7bb589
JH
482GIT_INDEX_FILE="$USE_INDEX" \
483 git-update-index -q $unmerged_ok_if_status --refresh || exit
484
485################################################################
486# If the request is status, just show it and exit.
487
488case "$0" in
489*status)
490 run_status
491 exit $?
492esac
493
494################################################################
495# Grab commit message, write out tree and make commit.
496
130fcca6
JH
497if test t = "$verify" && test -x "$GIT_DIR"/hooks/pre-commit
498then
499 if test "$TMP_INDEX"
500 then
501 GIT_INDEX_FILE="$TMP_INDEX" "$GIT_DIR"/hooks/pre-commit
502 else
cf7bb589 503 GIT_INDEX_FILE="$USE_INDEX" "$GIT_DIR"/hooks/pre-commit
130fcca6
JH
504 fi || exit
505fi
0cfe1d30 506
aba2da13
JH
507if test "$log_message" != ''
508then
509 echo "$log_message"
510elif test "$logfile" != ""
511then
512 if test "$logfile" = -
513 then
514 test -t 0 &&
515 echo >&2 "(reading log message from standard input)"
516 cat
517 else
518 cat <"$logfile"
519 fi
520elif test "$use_commit" != ""
521then
522 git-cat-file commit "$use_commit" | sed -e '1,/^$/d'
e5215804
JH
523elif test -f "$GIT_DIR/MERGE_HEAD" && test -f "$GIT_DIR/MERGE_MSG"
524then
525 cat "$GIT_DIR/MERGE_MSG"
f8e2c54c 526fi | git-stripspace >"$GIT_DIR"/COMMIT_EDITMSG
2d569933
JH
527
528case "$signoff" in
529t)
f6413391
JH
530 {
531 echo
532 git-var GIT_COMMITTER_IDENT | sed -e '
533 s/>.*/>/
534 s/^/Signed-off-by: /
535 '
f8e2c54c 536 } >>"$GIT_DIR"/COMMIT_EDITMSG
2d569933
JH
537 ;;
538esac
539
475443c8 540if test -f "$GIT_DIR/MERGE_HEAD" && test -z "$no_edit"; then
2d569933 541 echo "#"
b6ae5409 542 echo "# It looks like you may be committing a MERGE."
2d569933
JH
543 echo "# If this is not correct, please remove the file"
544 echo "# $GIT_DIR/MERGE_HEAD"
545 echo "# and try again"
546 echo "#"
f8e2c54c 547fi >>"$GIT_DIR"/COMMIT_EDITMSG
aba2da13 548
130fcca6 549# Author
5a798fb5
JH
550if test '' != "$force_author"
551then
f327dbce
MW
552 GIT_AUTHOR_NAME=`expr "z$force_author" : 'z\(.*[^ ]\) *<.*'` &&
553 GIT_AUTHOR_EMAIL=`expr "z$force_author" : '.*\(<.*\)'` &&
5a798fb5
JH
554 test '' != "$GIT_AUTHOR_NAME" &&
555 test '' != "$GIT_AUTHOR_EMAIL" ||
556 die "malformatted --author parameter"
557 export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL
558elif test '' != "$use_commit"
130fcca6
JH
559then
560 pick_author_script='
561 /^author /{
562 s/'\''/'\''\\'\'\''/g
563 h
564 s/^author \([^<]*\) <[^>]*> .*$/\1/
565 s/'\''/'\''\'\'\''/g
566 s/.*/GIT_AUTHOR_NAME='\''&'\''/p
567
568 g
569 s/^author [^<]* <\([^>]*\)> .*$/\1/
570 s/'\''/'\''\'\'\''/g
571 s/.*/GIT_AUTHOR_EMAIL='\''&'\''/p
572
573 g
574 s/^author [^<]* <[^>]*> \(.*\)$/\1/
575 s/'\''/'\''\'\'\''/g
576 s/.*/GIT_AUTHOR_DATE='\''&'\''/p
577
578 q
579 }
580 '
581 set_author_env=`git-cat-file commit "$use_commit" |
582 LANG=C LC_ALL=C sed -ne "$pick_author_script"`
583 eval "$set_author_env"
584 export GIT_AUTHOR_NAME
585 export GIT_AUTHOR_EMAIL
586 export GIT_AUTHOR_DATE
130fcca6
JH
587fi
588
96069cf0 589PARENTS="-p HEAD"
130fcca6 590if test -z "$initial_commit"
8098a178 591then
5fec3ef1 592 if [ -f "$GIT_DIR/MERGE_HEAD" ]; then
91063bbc 593 PARENTS="-p HEAD "`sed -e 's/^/-p /' "$GIT_DIR/MERGE_HEAD"`
b4019f04
JH
594 elif test -n "$amend"; then
595 PARENTS=$(git-cat-file commit HEAD |
596 sed -n -e '/^$/q' -e 's/^parent /-p /p')
aba2da13 597 fi
b8310152 598 current=$(git-rev-parse --verify HEAD)
8098a178
JH
599else
600 if [ -z "$(git-ls-files)" ]; then
5a798fb5 601 echo >&2 Nothing to commit
8098a178
JH
602 exit 1
603 fi
604 PARENTS=""
b8310152 605 current=
96069cf0 606fi
130fcca6 607
475443c8
JH
608if test -z "$no_edit"
609then
610 {
611 test -z "$only_include_assumed" || echo "$only_include_assumed"
612 run_status
613 } >>"$GIT_DIR"/COMMIT_EDITMSG
614else
615 # we need to check if there is anything to commit
616 run_status >/dev/null
617fi
8588452c 618if [ "$?" != "0" -a ! -f "$GIT_DIR/MERGE_HEAD" -a -z "$amend" ]
a3e870f2 619then
f8e2c54c 620 rm -f "$GIT_DIR/COMMIT_EDITMSG"
5a798fb5 621 run_status
a3e870f2
LT
622 exit 1
623fi
475443c8 624
0c091296 625case "$no_edit" in
5fec3ef1 626'')
7334f06c
JH
627 case "${VISUAL:-$EDITOR},$TERM" in
628 ,dumb)
629 echo >&2 "Terminal is dumb but no VISUAL nor EDITOR defined."
630 echo >&2 "Please supply the commit log message using either"
631 echo >&2 "-m or -F option. A boilerplate log message has"
632 echo >&2 "been prepared in $GIT_DIR/COMMIT_EDITMSG"
130fcca6
JH
633 exit 1
634 ;;
7334f06c 635 esac
f8e2c54c 636 ${VISUAL:-${EDITOR:-vi}} "$GIT_DIR/COMMIT_EDITMSG"
5fec3ef1
JH
637 ;;
638esac
89e2c5f1
JH
639
640case "$verify" in
641t)
642 if test -x "$GIT_DIR"/hooks/commit-msg
643 then
f8e2c54c 644 "$GIT_DIR"/hooks/commit-msg "$GIT_DIR"/COMMIT_EDITMSG || exit
89e2c5f1
JH
645 fi
646esac
647
cf7bb589 648sed -e '
9ae6be80
JH
649 /^diff --git a\/.*/{
650 s///
651 q
652 }
653 /^#/d
cf7bb589
JH
654' "$GIT_DIR"/COMMIT_EDITMSG |
655git-stripspace >"$GIT_DIR"/COMMIT_MSG
f8e2c54c
SB
656
657if cnt=`grep -v -i '^Signed-off-by' "$GIT_DIR"/COMMIT_MSG |
658 git-stripspace |
659 wc -l` &&
660 test 0 -lt $cnt
0c091296 661then
130fcca6
JH
662 if test -z "$TMP_INDEX"
663 then
cf7bb589 664 tree=$(GIT_INDEX_FILE="$USE_INDEX" git-write-tree)
130fcca6
JH
665 else
666 tree=$(GIT_INDEX_FILE="$TMP_INDEX" git-write-tree) &&
667 rm -f "$TMP_INDEX"
668 fi &&
f8e2c54c 669 commit=$(cat "$GIT_DIR"/COMMIT_MSG | git-commit-tree $tree $PARENTS) &&
bf7960eb 670 git-update-ref HEAD $commit $current &&
cf7bb589
JH
671 rm -f -- "$GIT_DIR/MERGE_HEAD" &&
672 if test -f "$NEXT_INDEX"
673 then
674 mv "$NEXT_INDEX" "$THIS_INDEX"
675 else
676 : ;# happy
677 fi
0c091296
JH
678else
679 echo >&2 "* no commit message? aborting commit."
680 false
681fi
170241b7 682ret="$?"
f8e2c54c 683rm -f "$GIT_DIR/COMMIT_MSG" "$GIT_DIR/COMMIT_EDITMSG"
1536dd9c
JH
684if test -d "$GIT_DIR/rr-cache"
685then
686 git-rerere
687fi
89e2c5f1
JH
688
689if test -x "$GIT_DIR"/hooks/post-commit && test "$ret" = 0
690then
691 "$GIT_DIR"/hooks/post-commit
692fi
170241b7 693exit "$ret"