@matheusbsbs / matheus-bagliano / commits / fd9500eef2
Fork 0

We now copy the other stuff about a commit (changelog, author, etc).

Avery Pennarun committed Apr 24, 2009 at 14:45 UTC fd9500eef2eba7e8f66f984c924a11282daaa870
1 file changed +21 -4
git-subtree.sh
+21 -4
@@ -77,7 +77,6 @@ cache_setup()
77 rm -rf "$cachedir" || die "Can't delete old cachedir: $cachedir"
78 mkdir -p "$cachedir" || die "Can't create new cachedir: $cachedir"
79 debug "Using cachedir: $cachedir" >&2
80 - echo "$cachedir"
80 }
81
82 cache_get()
@@ -100,6 +99,24 @@ cache_set()
99 echo "$newrev" >"$cachedir/$oldrev"
100 }
101
102 +copy_commit()
103 +{
104 + # We're doing to set some environment vars here, so
105 + # do it in a subshell to get rid of them safely later
106 + git log -1 --pretty=format:'%an%n%ae%n%ad%n%cn%n%ce%n%cd%n%s%n%n%b' "$1" |
107 + (
108 + read GIT_AUTHOR_NAME
109 + read GIT_AUTHOR_EMAIL
110 + read GIT_AUTHOR_DATE
111 + read GIT_COMMITTER_NAME
112 + read GIT_COMMITTER_EMAIL
113 + read GIT_COMMITTER_DATE
114 + export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_AUTHOR_DATE
115 + export GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL GIT_COMMITTER_DATE
116 + git commit-tree "$2" $3 # reads the rest of stdin
117 + ) || die "Can't copy commit $1"
118 +}
119 +
120 cmd_split()
121 {
122 debug "Splitting $dir..."
@@ -119,9 +136,9 @@ cmd_split()
136 for parent in $newparents; do
137 p="$p -p $parent"
138 done
122 - newrev=$(echo synthetic | git commit-tree $tree $p) \
123 - || die "Can't create new commit for $rev / $tree"
124 - echo " newrev is: $newrev"
139 +
140 + newrev=$(copy_commit $rev $tree "$p") || exit $?
141 + debug " newrev is: $newrev"
142 cache_set $rev $newrev
143 done || exit $?
144 done || exit $?