@matheusbsbs / matheus-bagliano / commits / 20a3847d8a
Fork 0

fetch: Misc output cleanup

In particular it removes duplicate information, uses short hashes (as git-log and company) and uses .. for fast forwarding commits and ... for not-fast-forwarding commits (shorter, easier to copy&paste). It also reformat the output as: 1. the ones we store in our local ref (either branches or tags): 1a) fast-forward * refs/heads/origin: fast forward to branch 'master' of ../git/ old..new: 1ad7a06..bc1a580 1b) same (only shown under -v) * refs/heads/next: same as branch 'origin/next' of ../git/ commit: ce47b9f 1c) non-fast-forward, forced * refs/heads/pu: forcing update to non-fast forward branch 'pu' of ../git/ old...new: 7c733a8...5faa935 1d) non-fast-forward, did not update because not forced * refs/heads/po: not updating to non-fast forward branch 'po' of ../git/ old...new: 7c733a8...5faa935 1e) creating a new local ref to store * refs/tags/v1.4.2-rc4: storing tag 'v1.4.2-rc4' of ../git/ tag: 8c7a107 * refs/heads/next: storing branch 'next' of ../git/ commit: f8a20ae 2. the ones we do not store in our local ref (only shown under -v): * fetched branch 'master' of ../git commit: 695dffe * fetched tag 'v1.4.2-rc4' of ../git tag: 8c7a107 Signed-off-by: Santi B.ANijar <sbejar@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>

Santi B,Ai(Bjar committed Oct 1, 2006 at 05:33 UTC 20a3847d8a5032ce41f90dcc68abfb36e6fee9b1
1 file changed +25 -16
git-fetch.sh
+25 -16
@@ -129,22 +129,25 @@ append_fetch_head () {
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/*)
@@ -154,13 +157,16 @@ fast_forward_local () {
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 ;;
@@ -178,31 +184,34 @@ fast_forward_local () {
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 ;;