run-command.c: print env vars in trace_run_command()
[git.git] / contrib / convert-grafts-to-replace-refs.sh
blob0cbc917b8cf5d63668eb562cda2d32b721d3b01a
1 #!/bin/sh
3 # You should execute this script in the repository where you
4 # want to convert grafts to replace refs.
6 GRAFTS_FILE="${GIT_DIR:-.git}/info/grafts"
8 . $(git --exec-path)/git-sh-setup
10 test -f "$GRAFTS_FILE" || die "Could not find graft file: '$GRAFTS_FILE'"
12 grep '^[^# ]' "$GRAFTS_FILE" |
13 while read definition
15 if test -n "$definition"
16 then
17 echo "Converting: $definition"
18 git replace --graft $definition ||
19 die "Conversion failed for: $definition"
21 done
23 mv "$GRAFTS_FILE" "$GRAFTS_FILE.bak" ||
24 die "Could not rename '$GRAFTS_FILE' to '$GRAFTS_FILE.bak'"
26 echo "Success!"
27 echo "All the grafts in '$GRAFTS_FILE' have been converted to replace refs!"
28 echo "The grafts file '$GRAFTS_FILE' has been renamed: '$GRAFTS_FILE.bak'"