Skip to content

Instantly share code, notes, and snippets.

@b6pzeusbc54tvhw5jgpyw8pwz2x6gs
Created October 5, 2021 12:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save b6pzeusbc54tvhw5jgpyw8pwz2x6gs/701e611b8e5895e458db8d3fe3cd1b37 to your computer and use it in GitHub Desktop.
Save b6pzeusbc54tvhw5jgpyw8pwz2x6gs/701e611b8e5895e458db8d3fe3cd1b37 to your computer and use it in GitHub Desktop.
git-p4 사용시 한글 커밋 메시지가 깨지는 문제 해결 방법

오래된 방법

개선 방법

  • 일단 깨진 상태로 clone 받은 후 아래의 filter-branch 명령을 사용하여 해결 가능.
$ git filter-branch -f --commit-filter '
    author_type=$( echo $GIT_AUTHOR_NAME | file -b --mime-encoding - )
    author=$( echo $GIT_AUTHOR_NAME | iconv -f $author_type -t UTF-8 )
    GIT_AUTHOR_NAME=$author

    committer_type=$( echo $GIT_COMMITTER_NAME | file -b --mime-encoding - )
    committer=$( echo $GIT_COMMITTER_NAME | iconv -f $committer_type -t UTF-8 )
    GIT_COMMITTER_NAME=$committer

    git commit-tree "$@";' --msg-filter '
    cat > .commitmsg
    type=cp949
    ( cat .commitmsg|iconv -f $type -t UTF-8 )
    if [ $? != 0 ];
    then
      echo $COMMIT
    fi
  ' HEAD

우분투 18에서 패키지 추가 없이 바로 됐었던 기억.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment