129
then
130
headc_=$(git-rev-parse --verify "$head_^0") || exit
131
echo "$headc_ $not_for_merge_ $note_" >>"$GIT_DIR/FETCH_HEAD"
132
- [ "$verbose" ] && echo >&2 "* committish: $head_"
133
- [ "$verbose" ] && echo >&2 " $note_"
132
else
133
echo "$head_ not-for-merge $note_" >>"$GIT_DIR/FETCH_HEAD"
136
- [ "$verbose" ] && echo >&2 "* non-commit: $head_"
137
- [ "$verbose" ] && echo >&2 " $note_"
138
- fi
139
- if test "$local_name_" != ""
140
- then
141
- # We are storing the head locally. Make sure that it is
142
- # a fast forward (aka "reverse push").
143
- fast_forward_local "$local_name_" "$head_" "$note_"
134
fi
135
+
136
+ update_local_ref "$local_name_" "$head_" "$note_"
137
}
138
147
-fast_forward_local () {
139
+update_local_ref () {
140
+ # If we are storing the head locally make sure that it is
141
+ # a fast forward (aka "reverse push").
142
+
143
+ label_=$(git-cat-file -t $2)
144
+ newshort_=$(git-rev-parse --short $2)
145
+ if test -z "$1" ; then
146
+ [ "$verbose" ] && echo >&2 "* fetched $3"
147
+ [ "$verbose" ] && echo >&2 " $label_: $newshort_"
148
+ return 0
149
+ fi
150
+ oldshort_=$(git-rev-parse --short "$1" 2>/dev/null)
151
mkdir -p "$(dirname "$GIT_DIR/$1")"
152
case "$1" in
153
refs/tags/*)
157
then
158
if now_=$(cat "$GIT_DIR/$1") && test "$now_" = "$2"
159
then
157
- [ "$verbose" ] && echo >&2 "* $1: same as $3" ||:
160
+ [ "$verbose" ] && echo >&2 "* $1: same as $3"
161
+ [ "$verbose" ] && echo >&2 " $label_: $newshort_" ||:
162
else
163
echo >&2 "* $1: updating with $3"
164
+ echo >&2 " $label_: $newshort_"
165
git-update-ref -m "$rloga: updating tag" "$1" "$2"
166
fi
167
else
168
echo >&2 "* $1: storing $3"
169
+ echo >&2 " $label_: $newshort_"
170
git-update-ref -m "$rloga: storing tag" "$1" "$2"
171
fi
172
;;
184
if test -n "$verbose"
185
then
186
echo >&2 "* $1: same as $3"
187
+ echo >&2 " $label_: $newshort_"
188
fi
189
;;
190
*,$local)
191
echo >&2 "* $1: fast forward to $3"
185
- echo >&2 " from $local to $2"
192
+ echo >&2 " old..new: $oldshort_..$newshort_"
193
git-update-ref -m "$rloga: fast-forward" "$1" "$2" "$local"
194
;;
195
*)
196
false
197
;;
198
esac || {
192
- echo >&2 "* $1: does not fast forward to $3;"
199
case ",$force,$single_force," in
200
*,t,*)
195
- echo >&2 " forcing update."
201
+ echo >&2 "* $1: forcing update to non-fast forward $3"
202
+ echo >&2 " old...new: $oldshort_...$newshort_"
203
git-update-ref -m "$rloga: forced-update" "$1" "$2" "$local"
204
;;
205
*)
199
- echo >&2 " not updating."
206
+ echo >&2 "* $1: not updating to non-fast forward $3"
207
+ echo >&2 " old...new: $oldshort_...$newshort_"
208
exit 1
209
;;
210
esac
211
}
212
else
213
echo >&2 "* $1: storing $3"
214
+ echo >&2 " $label_: $newshort_"
215
git-update-ref -m "$rloga: storing head" "$1" "$2"
216
fi
217
;;