[MISC] Move to alpine/git:2.36.3 (#238)

jobatzil/rename
Johannes Batzill 2023-01-21 16:23:04 -08:00 committed by GitHub
parent 48c6802a9f
commit e2d10d06cf
3 changed files with 19 additions and 13 deletions

View File

@ -89,9 +89,11 @@ test-env: stop ## Run test environment - this runs all services and the gitness
image: ## Build the gitness docker image
@echo "Building Gitness Image"
@docker build --build-arg GITNESS_VERSION=latest \
@docker build \
--build-arg GITNESS_VERSION=latest \
--build-arg GIT_COMMIT=${GIT_COMMIT} \
--build-arg GITHUB_ACCESS_TOKEN=${GITHUB_ACCESS_TOKEN} \
--platform linux/amd64 \
-t gitness:latest \
-f ./docker/Dockerfile .

View File

@ -1,9 +1,8 @@
### Build operator
FROM golang:1.19 as builder
FROM golang:1.19-alpine as builder
RUN dpkg --add-architecture amd64 \
&& apt update \
&& apt install -y --no-install-recommends protobuf-compiler
RUN apk update \
&& apk add --no-cache protoc build-base
# Setup workig dir
WORKDIR /app
@ -32,12 +31,9 @@ FROM alpine:latest as cert-image
RUN apk --update add ca-certificates
### Create final image
FROM debian:buster-slim as final
FROM alpine/git:2.36.3 as final
RUN useradd -u 1001 -m -d /app iamuser
RUN apt update \
&& apt install -y --no-install-recommends git
RUN adduser -u 1001 -D -h /app iamuser
WORKDIR /app

View File

@ -13,9 +13,17 @@ import (
"code.gitea.io/gitea/modules/git"
)
func (g Adapter) RawDiff(ctx context.Context, repoPath, left, right string, w io.Writer, args ...string) error {
cmd := git.NewCommand(ctx, append([]string{"diff", "--src-prefix=\\a/",
"--dst-prefix=\\b/", "-M", left, right}, args...)...)
func (g Adapter) RawDiff(ctx context.Context, repoPath, left, right string, w io.Writer, customArgs ...string) error {
args := []string{
"diff",
"--src-prefix=\\a/",
"--dst-prefix=\\b/",
"-M",
}
args = append(args, customArgs...)
args = append(args, left, right)
cmd := git.NewCommand(ctx, args...)
cmd.SetDescription(fmt.Sprintf("GetDiffRange [repo_path: %s]", repoPath))
errbuf := bytes.Buffer{}
if err := cmd.Run(&git.RunOpts{