Ver Fonte

Fix git-crrev-parse on Mac.

Previously, running git crrev-parse {crrev_number} on Mac doesn't 
produce any meaningful output, and the reason is that parameter 
substitutions resulted in extra back slashes ('\'):

ref="refs/heads/master"
remote_ref="${ref/refs\/heads/refs\/remotes\/origin}"

expected: remote_ref="refs/remotes/origin/master"
actual: remote_ref="refs\/remotes\/origin/master"

This CL fixes the issue by removing the extra back slashes.

Bug:
Change-Id: I1ee1b4702f09c96fb65518ee1465d0de927e95cc
Reviewed-on: https://chromium-review.googlesource.com/572052
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Yuke Liao <liaoyuke@chromium.org>
Yuke Liao há 8 anos atrás
pai
commit
383ace4b35
1 ficheiros alterados com 1 adições e 0 exclusões
  1. 1 0
      git-crrev-parse

+ 1 - 0
git-crrev-parse

@@ -39,6 +39,7 @@ while [ -n "$1" ]; do
   fi
   remote_ref="${ref/refs\/heads/refs\/remotes\/origin}"
   remote_ref="${remote_ref/refs\/branch-heads/refs\/remotes\/branch-heads}"
+  remote_ref="${remote_ref//\\}"
   num="${commit_pos#*@\{\#}"
   num="${num%\}}"
   if [ -z "$ref" -o -z "$num" ]; then