Skip to content

Commit

Permalink
Make format-diff.sh locale-independent (#9079)
Browse files Browse the repository at this point in the history
Summary:
Force POSIX locale for calls to 'git remote' that might have
locale-dependent formatting, as shown in facebook/rocksdb#8731 comment

Pull Request resolved: facebook/rocksdb#9079

Test Plan:
manual (haven't tried on a machine with non-english default
locale)

Reviewed By: ltamasi

Differential Revision: D31943092

Pulled By: pdillinger

fbshipit-source-id: 7dbe5915824f39f73b412cc3d1a86a2521cf76c1
  • Loading branch information
pdillinger authored and facebook-github-bot committed Oct 27, 2021
1 parent dc00e4b commit 4ec31dc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions build_tools/format-diff.sh
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,11 @@ uncommitted_code=`git diff HEAD`
if [ -z "$uncommitted_code" ]
then
# Attempt to get name of facebook/rocksdb.git remote.
[ "$FORMAT_REMOTE" ] || FORMAT_REMOTE="$(git remote -v | grep 'facebook/rocksdb.git' | head -n 1 | cut -f 1)"
[ "$FORMAT_REMOTE" ] || FORMAT_REMOTE="$(LC_ALL=POSIX LANG=POSIX git remote -v | grep 'facebook/rocksdb.git' | head -n 1 | cut -f 1)"
# Fall back on 'origin' if that fails
[ "$FORMAT_REMOTE" ] || FORMAT_REMOTE=origin
# Use main branch from that remote
[ "$FORMAT_UPSTREAM" ] || FORMAT_UPSTREAM="$FORMAT_REMOTE/$(git remote show $FORMAT_REMOTE | sed -n '/HEAD branch/s/.*: //p')"
[ "$FORMAT_UPSTREAM" ] || FORMAT_UPSTREAM="$FORMAT_REMOTE/$(LC_ALL=POSIX LANG=POSIX git remote show $FORMAT_REMOTE | sed -n '/HEAD branch/s/.*: //p')"
# Get the common ancestor with that remote branch. Everything after that
# common ancestor would be considered the contents of a pull request, so
# should be relevant for formatting fixes.
Expand Down

0 comments on commit 4ec31dc

Please sign in to comment.