]>
Commit | Line | Data |
---|---|---|
1 | #!/bin/sh | |
2 | # | |
3 | # Rewrite revision history | |
4 | # Copyright (c) Petr Baudis, 2006 | |
5 | # Minimal changes to "port" it to core-git (c) Johannes Schindelin, 2007 | |
6 | # | |
7 | # Lets you rewrite the revision history of the current branch, creating | |
8 | # a new branch. You can specify a number of filters to modify the commits, | |
9 | # files and trees. | |
10 | ||
11 | # The following functions will also be available in the commit filter: | |
12 | ||
13 | functions=$(cat << \EOF | |
14 | warn () { | |
15 | echo "$*" >&2 | |
16 | } | |
17 | ||
18 | map() | |
19 | { | |
20 | # if it was not rewritten, take the original | |
21 | if test -r "$workdir/../map/$1" | |
22 | then | |
23 | cat "$workdir/../map/$1" | |
24 | else | |
25 | echo "$1" | |
26 | fi | |
27 | } | |
28 | ||
29 | # if you run 'skip_commit "$@"' in a commit filter, it will print | |
30 | # the (mapped) parents, effectively skipping the commit. | |
31 | ||
32 | skip_commit() | |
33 | { | |
34 | shift; | |
35 | while [ -n "$1" ]; | |
36 | do | |
37 | shift; | |
38 | map "$1"; | |
39 | shift; | |
40 | done; | |
41 | } | |
42 | ||
43 | # if you run 'git_commit_non_empty_tree "$@"' in a commit filter, | |
44 | # it will skip commits that leave the tree untouched, commit the other. | |
45 | git_commit_non_empty_tree() | |
46 | { | |
47 | if test $# = 3 && test "$1" = $(git rev-parse "$3^{tree}"); then | |
48 | map "$3" | |
49 | elif test $# = 1 && test "$1" = 4b825dc642cb6eb9a060e54bf8d69288fbee4904; then | |
50 | : | |
51 | else | |
52 | git commit-tree "$@" | |
53 | fi | |
54 | } | |
55 | # override die(): this version puts in an extra line break, so that | |
56 | # the progress is still visible | |
57 | ||
58 | die() | |
59 | { | |
60 | echo >&2 | |
61 | echo "$*" >&2 | |
62 | exit 1 | |
63 | } | |
64 | EOF | |
65 | ) | |
66 | ||
67 | eval "$functions" | |
68 | ||
69 | finish_ident() { | |
70 | # Ensure non-empty id name. | |
71 | echo "case \"\$GIT_$1_NAME\" in \"\") GIT_$1_NAME=\"\${GIT_$1_EMAIL%%@*}\" && export GIT_$1_NAME;; esac" | |
72 | # And make sure everything is exported. | |
73 | echo "export GIT_$1_NAME" | |
74 | echo "export GIT_$1_EMAIL" | |
75 | echo "export GIT_$1_DATE" | |
76 | } | |
77 | ||
78 | set_ident () { | |
79 | parse_ident_from_commit author AUTHOR committer COMMITTER | |
80 | finish_ident AUTHOR | |
81 | finish_ident COMMITTER | |
82 | } | |
83 | ||
84 | USAGE="[--setup <command>] [--env-filter <command>] | |
85 | [--tree-filter <command>] [--index-filter <command>] | |
86 | [--parent-filter <command>] [--msg-filter <command>] | |
87 | [--commit-filter <command>] [--tag-name-filter <command>] | |
88 | [--subdirectory-filter <directory>] [--original <namespace>] | |
89 | [-d <directory>] [-f | --force] | |
90 | [--] [<rev-list options>...]" | |
91 | ||
92 | OPTIONS_SPEC= | |
93 | . git-sh-setup | |
94 | ||
95 | if [ "$(is_bare_repository)" = false ]; then | |
96 | require_clean_work_tree 'rewrite branches' | |
97 | fi | |
98 | ||
99 | tempdir=.git-rewrite | |
100 | filter_setup= | |
101 | filter_env= | |
102 | filter_tree= | |
103 | filter_index= | |
104 | filter_parent= | |
105 | filter_msg=cat | |
106 | filter_commit= | |
107 | filter_tag_name= | |
108 | filter_subdir= | |
109 | orig_namespace=refs/original/ | |
110 | force= | |
111 | prune_empty= | |
112 | remap_to_ancestor= | |
113 | while : | |
114 | do | |
115 | case "$1" in | |
116 | --) | |
117 | shift | |
118 | break | |
119 | ;; | |
120 | --force|-f) | |
121 | shift | |
122 | force=t | |
123 | continue | |
124 | ;; | |
125 | --remap-to-ancestor) | |
126 | # deprecated ($remap_to_ancestor is set now automatically) | |
127 | shift | |
128 | remap_to_ancestor=t | |
129 | continue | |
130 | ;; | |
131 | --prune-empty) | |
132 | shift | |
133 | prune_empty=t | |
134 | continue | |
135 | ;; | |
136 | -*) | |
137 | ;; | |
138 | *) | |
139 | break; | |
140 | esac | |
141 | ||
142 | # all switches take one argument | |
143 | ARG="$1" | |
144 | case "$#" in 1) usage ;; esac | |
145 | shift | |
146 | OPTARG="$1" | |
147 | shift | |
148 | ||
149 | case "$ARG" in | |
150 | -d) | |
151 | tempdir="$OPTARG" | |
152 | ;; | |
153 | --setup) | |
154 | filter_setup="$OPTARG" | |
155 | ;; | |
156 | --env-filter) | |
157 | filter_env="$OPTARG" | |
158 | ;; | |
159 | --tree-filter) | |
160 | filter_tree="$OPTARG" | |
161 | ;; | |
162 | --index-filter) | |
163 | filter_index="$OPTARG" | |
164 | ;; | |
165 | --parent-filter) | |
166 | filter_parent="$OPTARG" | |
167 | ;; | |
168 | --msg-filter) | |
169 | filter_msg="$OPTARG" | |
170 | ;; | |
171 | --commit-filter) | |
172 | filter_commit="$functions; $OPTARG" | |
173 | ;; | |
174 | --tag-name-filter) | |
175 | filter_tag_name="$OPTARG" | |
176 | ;; | |
177 | --subdirectory-filter) | |
178 | filter_subdir="$OPTARG" | |
179 | remap_to_ancestor=t | |
180 | ;; | |
181 | --original) | |
182 | orig_namespace=$(expr "$OPTARG/" : '\(.*[^/]\)/*$')/ | |
183 | ;; | |
184 | *) | |
185 | usage | |
186 | ;; | |
187 | esac | |
188 | done | |
189 | ||
190 | case "$prune_empty,$filter_commit" in | |
191 | ,) | |
192 | filter_commit='git commit-tree "$@"';; | |
193 | t,) | |
194 | filter_commit="$functions;"' git_commit_non_empty_tree "$@"';; | |
195 | ,*) | |
196 | ;; | |
197 | *) | |
198 | die "Cannot set --prune-empty and --commit-filter at the same time" | |
199 | esac | |
200 | ||
201 | case "$force" in | |
202 | t) | |
203 | rm -rf "$tempdir" | |
204 | ;; | |
205 | '') | |
206 | test -d "$tempdir" && | |
207 | die "$tempdir already exists, please remove it" | |
208 | esac | |
209 | orig_dir=$(pwd) | |
210 | mkdir -p "$tempdir/t" && | |
211 | tempdir="$(cd "$tempdir"; pwd)" && | |
212 | cd "$tempdir/t" && | |
213 | workdir="$(pwd)" || | |
214 | die "" | |
215 | ||
216 | # Remove tempdir on exit | |
217 | trap 'cd "$orig_dir"; rm -rf "$tempdir"' 0 | |
218 | ||
219 | ORIG_GIT_DIR="$GIT_DIR" | |
220 | ORIG_GIT_WORK_TREE="$GIT_WORK_TREE" | |
221 | ORIG_GIT_INDEX_FILE="$GIT_INDEX_FILE" | |
222 | ORIG_GIT_AUTHOR_NAME="$GIT_AUTHOR_NAME" | |
223 | ORIG_GIT_AUTHOR_EMAIL="$GIT_AUTHOR_EMAIL" | |
224 | ORIG_GIT_AUTHOR_DATE="$GIT_AUTHOR_DATE" | |
225 | ORIG_GIT_COMMITTER_NAME="$GIT_COMMITTER_NAME" | |
226 | ORIG_GIT_COMMITTER_EMAIL="$GIT_COMMITTER_EMAIL" | |
227 | ORIG_GIT_COMMITTER_DATE="$GIT_COMMITTER_DATE" | |
228 | ||
229 | GIT_WORK_TREE=. | |
230 | export GIT_DIR GIT_WORK_TREE | |
231 | ||
232 | # Make sure refs/original is empty | |
233 | git for-each-ref > "$tempdir"/backup-refs || exit | |
234 | while read sha1 type name | |
235 | do | |
236 | case "$force,$name" in | |
237 | ,$orig_namespace*) | |
238 | die "Cannot create a new backup. | |
239 | A previous backup already exists in $orig_namespace | |
240 | Force overwriting the backup with -f" | |
241 | ;; | |
242 | t,$orig_namespace*) | |
243 | git update-ref -d "$name" $sha1 | |
244 | ;; | |
245 | esac | |
246 | done < "$tempdir"/backup-refs | |
247 | ||
248 | # The refs should be updated if their heads were rewritten | |
249 | git rev-parse --no-flags --revs-only --symbolic-full-name \ | |
250 | --default HEAD "$@" > "$tempdir"/raw-heads || exit | |
251 | sed -e '/^^/d' "$tempdir"/raw-heads >"$tempdir"/heads | |
252 | ||
253 | test -s "$tempdir"/heads || | |
254 | die "You must specify a ref to rewrite." | |
255 | ||
256 | GIT_INDEX_FILE="$(pwd)/../index" | |
257 | export GIT_INDEX_FILE | |
258 | ||
259 | # map old->new commit ids for rewriting parents | |
260 | mkdir ../map || die "Could not create map/ directory" | |
261 | ||
262 | # we need "--" only if there are no path arguments in $@ | |
263 | nonrevs=$(git rev-parse --no-revs "$@") || exit | |
264 | if test -z "$nonrevs" | |
265 | then | |
266 | dashdash=-- | |
267 | else | |
268 | dashdash= | |
269 | remap_to_ancestor=t | |
270 | fi | |
271 | ||
272 | git rev-parse --revs-only "$@" >../parse | |
273 | ||
274 | case "$filter_subdir" in | |
275 | "") | |
276 | eval set -- "$(git rev-parse --sq --no-revs "$@")" | |
277 | ;; | |
278 | *) | |
279 | eval set -- "$(git rev-parse --sq --no-revs "$@" $dashdash \ | |
280 | "$filter_subdir")" | |
281 | ;; | |
282 | esac | |
283 | ||
284 | git rev-list --reverse --topo-order --default HEAD \ | |
285 | --parents --simplify-merges --stdin "$@" <../parse >../revs || | |
286 | die "Could not get the commits" | |
287 | commits=$(wc -l <../revs | tr -d " ") | |
288 | ||
289 | test $commits -eq 0 && die "Found nothing to rewrite" | |
290 | ||
291 | # Rewrite the commits | |
292 | report_progress () | |
293 | { | |
294 | if test -n "$progress" && | |
295 | test $git_filter_branch__commit_count -gt $next_sample_at | |
296 | then | |
297 | count=$git_filter_branch__commit_count | |
298 | ||
299 | now=$(date +%s) | |
300 | elapsed=$(($now - $start_timestamp)) | |
301 | remaining=$(( ($commits - $count) * $elapsed / $count )) | |
302 | if test $elapsed -gt 0 | |
303 | then | |
304 | next_sample_at=$(( ($elapsed + 1) * $count / $elapsed )) | |
305 | else | |
306 | next_sample_at=$(($next_sample_at + 1)) | |
307 | fi | |
308 | progress=" ($elapsed seconds passed, remaining $remaining predicted)" | |
309 | fi | |
310 | printf "\rRewrite $commit ($count/$commits)$progress " | |
311 | } | |
312 | ||
313 | git_filter_branch__commit_count=0 | |
314 | ||
315 | progress= start_timestamp= | |
316 | if date '+%s' 2>/dev/null | grep -q '^[0-9][0-9]*$' | |
317 | then | |
318 | next_sample_at=0 | |
319 | progress="dummy to ensure this is not empty" | |
320 | start_timestamp=$(date '+%s') | |
321 | fi | |
322 | ||
323 | if test -n "$filter_index" || | |
324 | test -n "$filter_tree" || | |
325 | test -n "$filter_subdir" | |
326 | then | |
327 | need_index=t | |
328 | else | |
329 | need_index= | |
330 | fi | |
331 | ||
332 | eval "$filter_setup" < /dev/null || | |
333 | die "filter setup failed: $filter_setup" | |
334 | ||
335 | while read commit parents; do | |
336 | git_filter_branch__commit_count=$(($git_filter_branch__commit_count+1)) | |
337 | ||
338 | report_progress | |
339 | ||
340 | case "$filter_subdir" in | |
341 | "") | |
342 | if test -n "$need_index" | |
343 | then | |
344 | GIT_ALLOW_NULL_SHA1=1 git read-tree -i -m $commit | |
345 | fi | |
346 | ;; | |
347 | *) | |
348 | # The commit may not have the subdirectory at all | |
349 | err=$(GIT_ALLOW_NULL_SHA1=1 \ | |
350 | git read-tree -i -m $commit:"$filter_subdir" 2>&1) || { | |
351 | if ! git rev-parse -q --verify $commit:"$filter_subdir" | |
352 | then | |
353 | rm -f "$GIT_INDEX_FILE" | |
354 | else | |
355 | echo >&2 "$err" | |
356 | false | |
357 | fi | |
358 | } | |
359 | esac || die "Could not initialize the index" | |
360 | ||
361 | GIT_COMMIT=$commit | |
362 | export GIT_COMMIT | |
363 | git cat-file commit "$commit" >../commit || | |
364 | die "Cannot read commit $commit" | |
365 | ||
366 | eval "$(set_ident <../commit)" || | |
367 | die "setting author/committer failed for commit $commit" | |
368 | eval "$filter_env" < /dev/null || | |
369 | die "env filter failed: $filter_env" | |
370 | ||
371 | if [ "$filter_tree" ]; then | |
372 | git checkout-index -f -u -a || | |
373 | die "Could not checkout the index" | |
374 | # files that $commit removed are now still in the working tree; | |
375 | # remove them, else they would be added again | |
376 | git clean -d -q -f -x | |
377 | eval "$filter_tree" < /dev/null || | |
378 | die "tree filter failed: $filter_tree" | |
379 | ||
380 | ( | |
381 | git diff-index -r --name-only --ignore-submodules $commit -- && | |
382 | git ls-files --others | |
383 | ) > "$tempdir"/tree-state || exit | |
384 | git update-index --add --replace --remove --stdin \ | |
385 | < "$tempdir"/tree-state || exit | |
386 | fi | |
387 | ||
388 | eval "$filter_index" < /dev/null || | |
389 | die "index filter failed: $filter_index" | |
390 | ||
391 | parentstr= | |
392 | for parent in $parents; do | |
393 | for reparent in $(map "$parent"); do | |
394 | case "$parentstr " in | |
395 | *" -p $reparent "*) | |
396 | ;; | |
397 | *) | |
398 | parentstr="$parentstr -p $reparent" | |
399 | ;; | |
400 | esac | |
401 | done | |
402 | done | |
403 | if [ "$filter_parent" ]; then | |
404 | parentstr="$(echo "$parentstr" | eval "$filter_parent")" || | |
405 | die "parent filter failed: $filter_parent" | |
406 | fi | |
407 | ||
408 | { | |
409 | while IFS='' read -r header_line && test -n "$header_line" | |
410 | do | |
411 | # skip header lines... | |
412 | :; | |
413 | done | |
414 | # and output the actual commit message | |
415 | cat | |
416 | } <../commit | | |
417 | eval "$filter_msg" > ../message || | |
418 | die "msg filter failed: $filter_msg" | |
419 | ||
420 | if test -n "$need_index" | |
421 | then | |
422 | tree=$(git write-tree) | |
423 | else | |
424 | tree=$(git rev-parse "$commit^{tree}") | |
425 | fi | |
426 | workdir=$workdir @SHELL_PATH@ -c "$filter_commit" "git commit-tree" \ | |
427 | "$tree" $parentstr < ../message > ../map/$commit || | |
428 | die "could not write rewritten commit" | |
429 | done <../revs | |
430 | ||
431 | # If we are filtering for paths, as in the case of a subdirectory | |
432 | # filter, it is possible that a specified head is not in the set of | |
433 | # rewritten commits, because it was pruned by the revision walker. | |
434 | # Ancestor remapping fixes this by mapping these heads to the unique | |
435 | # nearest ancestor that survived the pruning. | |
436 | ||
437 | if test "$remap_to_ancestor" = t | |
438 | then | |
439 | while read ref | |
440 | do | |
441 | sha1=$(git rev-parse "$ref"^0) | |
442 | test -f "$workdir"/../map/$sha1 && continue | |
443 | ancestor=$(git rev-list --simplify-merges -1 "$ref" "$@") | |
444 | test "$ancestor" && echo $(map $ancestor) >> "$workdir"/../map/$sha1 | |
445 | done < "$tempdir"/heads | |
446 | fi | |
447 | ||
448 | # Finally update the refs | |
449 | ||
450 | _x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]' | |
451 | _x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40" | |
452 | echo | |
453 | while read ref | |
454 | do | |
455 | # avoid rewriting a ref twice | |
456 | test -f "$orig_namespace$ref" && continue | |
457 | ||
458 | sha1=$(git rev-parse "$ref"^0) | |
459 | rewritten=$(map $sha1) | |
460 | ||
461 | test $sha1 = "$rewritten" && | |
462 | warn "WARNING: Ref '$ref' is unchanged" && | |
463 | continue | |
464 | ||
465 | case "$rewritten" in | |
466 | '') | |
467 | echo "Ref '$ref' was deleted" | |
468 | git update-ref -m "filter-branch: delete" -d "$ref" $sha1 || | |
469 | die "Could not delete $ref" | |
470 | ;; | |
471 | $_x40) | |
472 | echo "Ref '$ref' was rewritten" | |
473 | if ! git update-ref -m "filter-branch: rewrite" \ | |
474 | "$ref" $rewritten $sha1 2>/dev/null; then | |
475 | if test $(git cat-file -t "$ref") = tag; then | |
476 | if test -z "$filter_tag_name"; then | |
477 | warn "WARNING: You said to rewrite tagged commits, but not the corresponding tag." | |
478 | warn "WARNING: Perhaps use '--tag-name-filter cat' to rewrite the tag." | |
479 | fi | |
480 | else | |
481 | die "Could not rewrite $ref" | |
482 | fi | |
483 | fi | |
484 | ;; | |
485 | *) | |
486 | # NEEDSWORK: possibly add -Werror, making this an error | |
487 | warn "WARNING: '$ref' was rewritten into multiple commits:" | |
488 | warn "$rewritten" | |
489 | warn "WARNING: Ref '$ref' points to the first one now." | |
490 | rewritten=$(echo "$rewritten" | head -n 1) | |
491 | git update-ref -m "filter-branch: rewrite to first" \ | |
492 | "$ref" $rewritten $sha1 || | |
493 | die "Could not rewrite $ref" | |
494 | ;; | |
495 | esac | |
496 | git update-ref -m "filter-branch: backup" "$orig_namespace$ref" $sha1 || | |
497 | exit | |
498 | done < "$tempdir"/heads | |
499 | ||
500 | # TODO: This should possibly go, with the semantics that all positive given | |
501 | # refs are updated, and their original heads stored in refs/original/ | |
502 | # Filter tags | |
503 | ||
504 | if [ "$filter_tag_name" ]; then | |
505 | git for-each-ref --format='%(objectname) %(objecttype) %(refname)' refs/tags | | |
506 | while read sha1 type ref; do | |
507 | ref="${ref#refs/tags/}" | |
508 | # XXX: Rewrite tagged trees as well? | |
509 | if [ "$type" != "commit" -a "$type" != "tag" ]; then | |
510 | continue; | |
511 | fi | |
512 | ||
513 | if [ "$type" = "tag" ]; then | |
514 | # Dereference to a commit | |
515 | sha1t="$sha1" | |
516 | sha1="$(git rev-parse -q "$sha1"^{commit})" || continue | |
517 | fi | |
518 | ||
519 | [ -f "../map/$sha1" ] || continue | |
520 | new_sha1="$(cat "../map/$sha1")" | |
521 | GIT_COMMIT="$sha1" | |
522 | export GIT_COMMIT | |
523 | new_ref="$(echo "$ref" | eval "$filter_tag_name")" || | |
524 | die "tag name filter failed: $filter_tag_name" | |
525 | ||
526 | echo "$ref -> $new_ref ($sha1 -> $new_sha1)" | |
527 | ||
528 | if [ "$type" = "tag" ]; then | |
529 | new_sha1=$( ( printf 'object %s\ntype commit\ntag %s\n' \ | |
530 | "$new_sha1" "$new_ref" | |
531 | git cat-file tag "$ref" | | |
532 | sed -n \ | |
533 | -e '1,/^$/{ | |
534 | /^object /d | |
535 | /^type /d | |
536 | /^tag /d | |
537 | }' \ | |
538 | -e '/^-----BEGIN PGP SIGNATURE-----/q' \ | |
539 | -e 'p' ) | | |
540 | git mktag) || | |
541 | die "Could not create new tag object for $ref" | |
542 | if git cat-file tag "$ref" | \ | |
543 | sane_grep '^-----BEGIN PGP SIGNATURE-----' >/dev/null 2>&1 | |
544 | then | |
545 | warn "gpg signature stripped from tag object $sha1t" | |
546 | fi | |
547 | fi | |
548 | ||
549 | git update-ref "refs/tags/$new_ref" "$new_sha1" || | |
550 | die "Could not write tag $new_ref" | |
551 | done | |
552 | fi | |
553 | ||
554 | unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE | |
555 | unset GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_AUTHOR_DATE | |
556 | unset GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL GIT_COMMITTER_DATE | |
557 | test -z "$ORIG_GIT_DIR" || { | |
558 | GIT_DIR="$ORIG_GIT_DIR" && export GIT_DIR | |
559 | } | |
560 | test -z "$ORIG_GIT_WORK_TREE" || { | |
561 | GIT_WORK_TREE="$ORIG_GIT_WORK_TREE" && | |
562 | export GIT_WORK_TREE | |
563 | } | |
564 | test -z "$ORIG_GIT_INDEX_FILE" || { | |
565 | GIT_INDEX_FILE="$ORIG_GIT_INDEX_FILE" && | |
566 | export GIT_INDEX_FILE | |
567 | } | |
568 | test -z "$ORIG_GIT_AUTHOR_NAME" || { | |
569 | GIT_AUTHOR_NAME="$ORIG_GIT_AUTHOR_NAME" && | |
570 | export GIT_AUTHOR_NAME | |
571 | } | |
572 | test -z "$ORIG_GIT_AUTHOR_EMAIL" || { | |
573 | GIT_AUTHOR_EMAIL="$ORIG_GIT_AUTHOR_EMAIL" && | |
574 | export GIT_AUTHOR_EMAIL | |
575 | } | |
576 | test -z "$ORIG_GIT_AUTHOR_DATE" || { | |
577 | GIT_AUTHOR_DATE="$ORIG_GIT_AUTHOR_DATE" && | |
578 | export GIT_AUTHOR_DATE | |
579 | } | |
580 | test -z "$ORIG_GIT_COMMITTER_NAME" || { | |
581 | GIT_COMMITTER_NAME="$ORIG_GIT_COMMITTER_NAME" && | |
582 | export GIT_COMMITTER_NAME | |
583 | } | |
584 | test -z "$ORIG_GIT_COMMITTER_EMAIL" || { | |
585 | GIT_COMMITTER_EMAIL="$ORIG_GIT_COMMITTER_EMAIL" && | |
586 | export GIT_COMMITTER_EMAIL | |
587 | } | |
588 | test -z "$ORIG_GIT_COMMITTER_DATE" || { | |
589 | GIT_COMMITTER_DATE="$ORIG_GIT_COMMITTER_DATE" && | |
590 | export GIT_COMMITTER_DATE | |
591 | } | |
592 | ||
593 | cd "$orig_dir" | |
594 | rm -rf "$tempdir" | |
595 | ||
596 | trap - 0 | |
597 | ||
598 | if [ "$(is_bare_repository)" = false ]; then | |
599 | git read-tree -u -m HEAD || exit | |
600 | fi | |
601 | ||
602 | exit 0 |