{"thread":{"id":"5772","subject":"[PATCH 1/2] fetch: Misc output cleanup","startedAt":"2006-10-01T03:33:05Z","lastAt":"2006-10-01T03:33:05Z","messageCount":1,"participants":["Santi Béjar"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"28051","messageId":"87y7s0677y.fsf@gmail.com","threadId":"5772","inReplyTo":null,"subject":"[PATCH 1/2] fetch: Misc output cleanup","fromName":"Santi Béjar","fromEmail":"sbejar@gmail.com","sentAt":"2006-10-01T03:33:05Z","receivedAt":"2006-10-01T03:33:05Z","isPatch":true,"sender":{"key":"santi@agolina.net","avatar":null},"body":"\nIn particular it removes duplicate information, uses short hashes (as\ngit-log and company) and uses .. for fast forwarding commits and ... for\nnot-fast-forwarding commits (shorter, easier to copy&paste). It also\nreformat the output as:\n\n1. the ones we store in our local ref (either branches or tags):\n\n 1a) fast-forward\n\n * refs/heads/origin: fast forward to branch 'master' of ../git/\n   old..new: 1ad7a06..bc1a580\n\n 1b) same (only shown under -v)\n\n * refs/heads/next: same as branch 'origin/next' of ../git/\n   commit: ce47b9f\n\n 1c) non-fast-forward, forced\n\n * refs/heads/pu: forcing update to not fast forwarding branch 'pu' of ../git/\n   old...new: 7c733a8...5faa935\n\n 1d) non-fast-forward, did not update because not forced\n\n * refs/heads/po: not updating to not fast forwarding branch 'po' of ../git/\n   old...new: 7c733a8...5faa935\n\n 1e) creating a new local ref to store\n\n * refs/tags/v1.4.2-rc4: storing tag 'v1.4.2-rc4' of ../git/\n   tag: 8c7a107\n * refs/heads/next: storing branch 'next' of ../git/\n   commit: f8a20ae\n\n2. the ones we do not store in our local ref (only shown under -v):\n\n * fetched branch 'master' of ../git\n   commit: 695dffe\n * fetched tag 'v1.4.2-rc4' of ../git\n   tag: 8c7a107\n\nWith the help of Junio.\n\nSigned-off-by: Santi Béjar <sbejar@gmail.com>\n---\n git-fetch.sh |   41 +++++++++++++++++++++++++----------------\n 1 files changed, 25 insertions(+), 16 deletions(-)\n\ndiff --git a/git-fetch.sh b/git-fetch.sh\nindex f1522bd..60ae552 100755\n--- a/git-fetch.sh\n+++ b/git-fetch.sh\n@@ -129,22 +129,25 @@ append_fetch_head () {\n     then\n \theadc_=$(git-rev-parse --verify \"$head_^0\") || exit\n \techo \"$headc_\t$not_for_merge_\t$note_\" >>\"$GIT_DIR/FETCH_HEAD\"\n-\t[ \"$verbose\" ] && echo >&2 \"* committish: $head_\"\n-\t[ \"$verbose\" ] && echo >&2 \"  $note_\"\n     else\n \techo \"$head_\tnot-for-merge\t$note_\" >>\"$GIT_DIR/FETCH_HEAD\"\n-\t[ \"$verbose\" ] && echo >&2 \"* non-commit: $head_\"\n-\t[ \"$verbose\" ] && echo >&2 \"  $note_\"\n-    fi\n-    if test \"$local_name_\" != \"\"\n-    then\n-\t# We are storing the head locally.  Make sure that it is\n-\t# a fast forward (aka \"reverse push\").\n-\tfast_forward_local \"$local_name_\" \"$head_\" \"$note_\"\n     fi\n+\n+    update_local_ref \"$local_name_\" \"$head_\" \"$note_\"\n }\n \n-fast_forward_local () {\n+update_local_ref () {\n+    # If we are storing the head locally make sure that it is\n+    # a fast forward (aka \"reverse push\").\n+\n+    label_=$(git-cat-file -t $2)\n+    newshort_=$(git-rev-parse --short $2)\n+    if test -z \"$1\" ; then\n+\t[ \"$verbose\" ] && echo >&2 \"* fetched $3\"\n+\t[ \"$verbose\" ] && echo >&2 \"  $label_: $newshort_\"\n+\treturn 0\n+    fi\n+    oldshort_=$(git-rev-parse --short \"$1\" 2>/dev/null)\n     mkdir -p \"$(dirname \"$GIT_DIR/$1\")\"\n     case \"$1\" in\n     refs/tags/*)\n@@ -154,13 +157,16 @@ fast_forward_local () {\n \tthen\n \t\tif now_=$(cat \"$GIT_DIR/$1\") && test \"$now_\" = \"$2\"\n \t\tthen\n-\t\t\t[ \"$verbose\" ] && echo >&2 \"* $1: same as $3\" ||:\n+\t\t\t[ \"$verbose\" ] && echo >&2 \"* $1: same as $3\"\n+\t\t\t[ \"$verbose\" ] && echo >&2 \"  $label_: $newshort_\" ||:\n \t\telse\n \t\t\techo >&2 \"* $1: updating with $3\"\n+\t\t\techo >&2 \"  $label_: $newshort_\"\n \t\t\tgit-update-ref -m \"$rloga: updating tag\" \"$1\" \"$2\"\n \t\tfi\n \telse\n \t\techo >&2 \"* $1: storing $3\"\n+\t\techo >&2 \"  $label_: $newshort_\"\n \t\tgit-update-ref -m \"$rloga: storing tag\" \"$1\" \"$2\"\n \tfi\n \t;;\n@@ -178,31 +184,34 @@ fast_forward_local () {\n \t        if test -n \"$verbose\"\n \t\tthen\n \t\t\techo >&2 \"* $1: same as $3\"\n+\t\t\techo >&2 \"  $label_: $newshort_\"\n \t\tfi\n \t\t;;\n \t    *,$local)\n \t\techo >&2 \"* $1: fast forward to $3\"\n-\t\techo >&2 \"  from $local to $2\"\n+\t\techo >&2 \"  old..new: $oldshort_..$newshort_\"\n \t\tgit-update-ref -m \"$rloga: fast-forward\" \"$1\" \"$2\" \"$local\"\n \t\t;;\n \t    *)\n \t\tfalse\n \t\t;;\n \t    esac || {\n-\t\techo >&2 \"* $1: does not fast forward to $3;\"\n \t\tcase \",$force,$single_force,\" in\n \t\t*,t,*)\n-\t\t\techo >&2 \"  forcing update.\"\n+\t\t\techo >&2 \"* $1: forcing update to not fast forwarding $3\"\n+\t\t\techo >&2 \"  old...new: $oldshort_...$newshort_\"\n \t\t\tgit-update-ref -m \"$rloga: forced-update\" \"$1\" \"$2\" \"$local\"\n \t\t\t;;\n \t\t*)\n-\t\t\techo >&2 \"  not updating.\"\n+\t\t\techo >&2 \"* $1: not updating to not fast forwarding $3\"\n+\t\t\techo >&2 \"  old...new: $oldshort_...$newshort_\"\n \t\t\texit 1\n \t\t\t;;\n \t\tesac\n \t    }\n \telse\n \t    echo >&2 \"* $1: storing $3\"\n+\t    echo >&2 \"  $label_: $newshort_\"\n \t    git-update-ref -m \"$rloga: storing head\" \"$1\" \"$2\"\n \tfi\n \t;;\n-- \n1.4.2.1.g38049\n"}]}