diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..bf1651ee6 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,18 @@ +on: [push, pull_request] +name: Test +jobs: + test: + strategy: + matrix: + go-version: [1.12.x, 1.13.x, 1.14.x] + platform: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.platform }} + steps: + - name: Install Go + uses: actions/setup-go@v1 + with: + go-version: ${{ matrix.go-version }} + - name: Checkout code + uses: actions/checkout@v2 + - name: Test + run: go test -v ./... \ No newline at end of file diff --git a/plumbing/object/commit.go b/plumbing/object/commit.go index 6b5093405..eb86a0114 100644 --- a/plumbing/object/commit.go +++ b/plumbing/object/commit.go @@ -177,6 +177,7 @@ func (c *Commit) Decode(o plumbing.EncodedObject) (err error) { var message bool var pgpsig bool + var msgbuf bytes.Buffer for { line, err := r.ReadBytes('\n') if err != nil && err != io.EOF { @@ -221,13 +222,15 @@ func (c *Commit) Decode(o plumbing.EncodedObject) (err error) { pgpsig = true } } else { - c.Message += string(line) + msgbuf.Write(line) } if err == io.EOF { - return nil + break } } + c.Message = msgbuf.String() + return nil } // Encode transforms a Commit into a plumbing.EncodedObject.