From 20a3847d8a5032ce41f90dcc68abfb36e6fee9b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Santi=20B=1B=2CAi=1B=28Bjar?= Date: Sun, 1 Oct 2006 05:33:05 +0200 Subject: fetch: Misc output cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Junio C Hamano diff --git a/git-fetch.sh b/git-fetch.sh index f1522bd..85e96a1 100755 --- a/git-fetch.sh +++ b/git-fetch.sh @@ -129,22 +129,25 @@ append_fetch_head () { then headc_=$(git-rev-parse --verify "$head_^0") || exit echo "$headc_ $not_for_merge_ $note_" >>"$GIT_DIR/FETCH_HEAD" - [ "$verbose" ] && echo >&2 "* committish: $head_" - [ "$verbose" ] && echo >&2 " $note_" else echo "$head_ not-for-merge $note_" >>"$GIT_DIR/FETCH_HEAD" - [ "$verbose" ] && echo >&2 "* non-commit: $head_" - [ "$verbose" ] && echo >&2 " $note_" - fi - if test "$local_name_" != "" - then - # We are storing the head locally. Make sure that it is - # a fast forward (aka "reverse push"). - fast_forward_local "$local_name_" "$head_" "$note_" fi + + update_local_ref "$local_name_" "$head_" "$note_" } -fast_forward_local () { +update_local_ref () { + # If we are storing the head locally make sure that it is + # a fast forward (aka "reverse push"). + + label_=$(git-cat-file -t $2) + newshort_=$(git-rev-parse --short $2) + if test -z "$1" ; then + [ "$verbose" ] && echo >&2 "* fetched $3" + [ "$verbose" ] && echo >&2 " $label_: $newshort_" + return 0 + fi + oldshort_=$(git-rev-parse --short "$1" 2>/dev/null) mkdir -p "$(dirname "$GIT_DIR/$1")" case "$1" in refs/tags/*) @@ -154,13 +157,16 @@ fast_forward_local () { then if now_=$(cat "$GIT_DIR/$1") && test "$now_" = "$2" then - [ "$verbose" ] && echo >&2 "* $1: same as $3" ||: + [ "$verbose" ] && echo >&2 "* $1: same as $3" + [ "$verbose" ] && echo >&2 " $label_: $newshort_" ||: else echo >&2 "* $1: updating with $3" + echo >&2 " $label_: $newshort_" git-update-ref -m "$rloga: updating tag" "$1" "$2" fi else echo >&2 "* $1: storing $3" + echo >&2 " $label_: $newshort_" git-update-ref -m "$rloga: storing tag" "$1" "$2" fi ;; @@ -178,31 +184,34 @@ fast_forward_local () { if test -n "$verbose" then echo >&2 "* $1: same as $3" + echo >&2 " $label_: $newshort_" fi ;; *,$local) echo >&2 "* $1: fast forward to $3" - echo >&2 " from $local to $2" + echo >&2 " old..new: $oldshort_..$newshort_" git-update-ref -m "$rloga: fast-forward" "$1" "$2" "$local" ;; *) false ;; esac || { - echo >&2 "* $1: does not fast forward to $3;" case ",$force,$single_force," in *,t,*) - echo >&2 " forcing update." + echo >&2 "* $1: forcing update to non-fast forward $3" + echo >&2 " old...new: $oldshort_...$newshort_" git-update-ref -m "$rloga: forced-update" "$1" "$2" "$local" ;; *) - echo >&2 " not updating." + echo >&2 "* $1: not updating to non-fast forward $3" + echo >&2 " old...new: $oldshort_...$newshort_" exit 1 ;; esac } else echo >&2 "* $1: storing $3" + echo >&2 " $label_: $newshort_" git-update-ref -m "$rloga: storing head" "$1" "$2" fi ;; -- cgit v0.10.2-6-g49f6 From ba0ac36ec5708820e670731001f7ab35351c6c48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Santi=20B=C3=A9jar?= Date: Sun, 1 Oct 2006 05:34:17 +0200 Subject: merge and resolve: Output short hashes and .. in "Updating ..." MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Santi BĂ©jar Signed-off-by: Junio C Hamano diff --git a/git-merge.sh b/git-merge.sh index 5b34b4d..49c46d5 100755 --- a/git-merge.sh +++ b/git-merge.sh @@ -197,7 +197,7 @@ f,*) ;; ?,1,"$head",*) # Again the most common case of merging one remote. - echo "Updating from $head to $1" + echo "Updating $(git-rev-parse --short $head)..$(git-rev-parse --short $1)" git-update-index --refresh 2>/dev/null new_head=$(git-rev-parse --verify "$1^0") && git-read-tree -u -v -m $head "$new_head" && diff --git a/git-resolve.sh b/git-resolve.sh index 729ec65..36b90e3 100755 --- a/git-resolve.sh +++ b/git-resolve.sh @@ -46,7 +46,7 @@ case "$common" in exit 0 ;; "$head") - echo "Updating from $head to $merge" + echo "Updating $(git-rev-parse --short $head)..$(git-rev-parse --short $merge)" git-read-tree -u -m $head $merge || exit 1 git-update-ref -m "resolve $merge_name: Fast forward" \ HEAD "$merge" "$head" -- cgit v0.10.2-6-g49f6