{"thread":{"id":"2587","subject":"Make \"git fetch\" less verbose by default","startedAt":"2005-11-18T16:31:55Z","lastAt":"2005-11-18T16:31:55Z","messageCount":1,"participants":["Linus Torvalds"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"12228","messageId":"Pine.LNX.4.64.0511180820130.13959@g5.osdl.org","threadId":"2587","inReplyTo":null,"subject":"Make \"git fetch\" less verbose by default","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-11-18T16:31:55Z","receivedAt":"2005-11-18T16:31:55Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\nWhen doing something like\n\n\tgit fetch --tags origin\n\nthe excessively verbose output of git fetch makes the result totally \nunreadable. It's impossible to tell if it actually fetched anything new or \nnot, since the screen will fill up with an endless supply of\n\n   ...\n   * committish: 9165ec17fde255a1770886189359897dbb541012\n     tag 'v0.99.7c' of master.kernel.org:/pub/scm/git/git\n   * refs/tags/v0.99.7c: same as tag 'v0.99.7c' of master.kernel.org:/pub/scm/git/git\n   ...\n\nand any new tags that got fetched will be totally hidden.\n\nSo add a new \"--verbose\" flag to \"git fetch\" to enable this verbose mode, \nbut make the default be quiet.\n\nNOTE! The quiet mode will still report about new or changed heads, so if \nyou are really fetching a new head, you'll see something like this:\n\n   [torvalds@g5 git]$ git fetch --tags parent\n   Packing 6 objects\n   Unpacking 6 objects\n    100% (6/6) done\n   * refs/tags/v1.0rc2: storing tag 'v1.0rc2' of master.kernel.org:/pub/scm/git/git\n   * refs/tags/v1.0rc3: storing tag 'v1.0rc3' of master.kernel.org:/pub/scm/git/git\n   * refs/tags/v1.0rc1: storing tag 'v1.0rc1' of master.kernel.org:/pub/scm/git/git\n\nwhich actually tells you something useful that isn't hidden by all the \nuseless crud that you already had.\n\nExtensively tested (hey, for me, this _is_ extensive) by doing a\n\n   rm .git/refs/tags/v1.0rc*\n\nand re-fetching with both --verbose and without. \n\nNOTE! This means that if the fetch didn't actually fetch anything at all, \ngit fetch will be totally quiet. I think that's much better than being so \nverbose that you can't even tell whether something was fetched or not, but \nsome people might prefer to get a \"nothing to fetch\" message in that case.\n\nSigned-off-by: Linus Torvalds <torvalds@osdl.org>\n---\ndiff --git a/git-fetch.sh b/git-fetch.sh\nindex 8564cbf..6586e77 100755\n--- a/git-fetch.sh\n+++ b/git-fetch.sh\n@@ -12,6 +12,7 @@ IFS=\"$LF\"\n tags=\n append=\n force=\n+verbose=\n update_head_ok=\n while case \"$#\" in 0) break ;; esac\n do\n@@ -30,6 +31,9 @@ do\n \t--update-head-o|--update-head-ok)\n \t\tupdate_head_ok=t\n \t\t;;\n+\t-v|--verbose)\n+\t\tverbose=Yes\n+\t\t;;\n \t*)\n \t\tbreak\n \t\t;;\n@@ -91,12 +95,12 @@ 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-\techo >&2 \"* committish: $head_\"\n-\techo >&2 \"  $note_\"\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-\techo >&2 \"* non-commit: $head_\"\n-\techo >&2 \"  $note_\"\n+\t[ \"$verbose\" ] && echo >&2 \"* non-commit: $head_\"\n+\t[ \"$verbose\" ] && echo >&2 \"  $note_\"\n     fi\n     if test \"$local_name_\" != \"\"\n     then\n@@ -116,7 +120,7 @@ fast_forward_local () {\n \tthen\n \t\tif now_=$(cat \"$GIT_DIR/$1\") && test \"$now_\" = \"$2\"\n \t\tthen\n-\t\t\techo >&2 \"* $1: same as $3\"\n+\t\t\t[ \"$verbose\" ] && echo >&2 \"* $1: same as $3\"\n \t\telse\n \t\t\techo >&2 \"* $1: updating with $3\"\n \t\tfi\n"}]}