5 # 28-Jan-2009 Clemens Buchacher <clemens.buchacher@infineon.com>
11 # If two files have the same target, or if files 'a', 'b', are renamed to
12 # 'b', 'c', respectively, in the wrong order. The file may be overwritten.
14 # o subentry conflicts
16 # If both a directory and its contained files are moved, this can have
24 echo -n "$prog: error: "
28 OPT
=`getopt -o f -- "$@"` ||
exit 1
33 while test "$1" != "--"
37 *) echo "unkown option: $1"; exit 1;;
50 echo `echo $1 | git hash-object --stdin` $1
56 echo "# This program is under development. Use at your own risk!";
57 echo "# Remove all content to abort";
60 if ! $EDITOR "$newnames"
67 while read sha1 newname
69 if test -z "$sha1" ||
expr "$sha1" : "\s*#.*" >/dev
/null
73 if ! expr "$sha1" : '[0-9a-f]\{40\}$' >/dev
/null
75 error
"invalid hash: $sha1"
78 sed -n "s/^$sha1 //p" "$orignames" > $oldlines
83 error
"duplicate hash: $sha1"
89 error
"invalid hash: $sha1"
91 if test "$oldname" != "$newname"
93 echo "$oldname -> $newname"
94 if test -z "$force" && test -e "$newname"
96 error
"rename would overwrite existing file: $newname"
98 mv -f "$oldname" "$newname"