@matheusbsbs / matheus-bagliano / commits / 5721685699
Fork 0

improve checkout message when asking for same branch

Change the feedback message if doing 'git checkout foo' when already on branch "foo". Signed-off-by: Nicolas Pitre <nico@cam.org> Signed-off-by: Junio C Hamano <junkio@cox.net>

Nicolas Pitre committed Mar 20, 2007 at 22:26 UTC 57216856999babf6f90235cf6c41dfcef98a3dab
1 file changed +6 -1
git-checkout.sh
+6 -1
@@ -250,8 +250,13 @@ if [ "$?" -eq 0 ]; then
250 if test -n "$branch"
251 then
252 GIT_DIR="$GIT_DIR" git-symbolic-ref -m "checkout: moving to $branch" HEAD "refs/heads/$branch"
253 - if test -z "$quiet"
253 + if test -n "$quiet"
254 then
255 + true # nothing
256 + elif test "refs/heads/$branch" = "$oldbranch"
257 + then
258 + echo >&2 "Already on branch \"$branch\""
259 + else
260 echo >&2 "Switched to${newbranch:+ a new} branch \"$branch\""
261 fi
262 elif test -n "$detached"