{"thread":{"id":"7343","subject":"[PATCH] improve checkout message when asking for same branch","startedAt":"2007-03-21T02:26:47Z","lastAt":"2007-03-21T02:26:47Z","messageCount":1,"participants":["Nicolas Pitre"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"37651","messageId":"alpine.LFD.0.83.0703202222280.18328@xanadu.home","threadId":"7343","inReplyTo":null,"subject":"[PATCH] improve checkout message when asking for same branch","fromName":"Nicolas Pitre","fromEmail":"nico@cam.org","sentAt":"2007-03-21T02:26:47Z","receivedAt":"2007-03-21T02:26:47Z","isPatch":true,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"Change the feedback message if doing 'git checkout foo' when already on\nbranch \"foo\".\n\nSigned-off-by: Nicolas Pitre <nico@cam.org>\n---\n\ndiff --git a/git-checkout.sh b/git-checkout.sh\nindex 39ffa8b..3c9b1bb 100755\n--- a/git-checkout.sh\n+++ b/git-checkout.sh\n@@ -250,8 +250,13 @@ if [ \"$?\" -eq 0 ]; then\n \tif test -n \"$branch\"\n \tthen\n \t\tGIT_DIR=\"$GIT_DIR\" git-symbolic-ref -m \"checkout: moving to $branch\" HEAD \"refs/heads/$branch\"\n-\t\tif test -z \"$quiet\"\n+\t\tif test -n \"$quiet\"\n \t\tthen\n+\t\t\ttrue\t# nothing\n+\t\telif test \"refs/heads/$branch\" = \"$oldbranch\"\n+\t\tthen\n+\t\t\techo >&2 \"Already on branch \\\"$branch\\\"\"\n+\t\telse\n \t\t\techo >&2 \"Switched to${newbranch:+ a new} branch \\\"$branch\\\"\"\n \t\tfi\n \telif test -n \"$detached\"\n"}]}