mirror of
https://github.com/Jguer/yay.git
synced 2025-10-16 00:05:01 -04:00
fix(download): use git pull --rebase --autostash instead of --ff-only. fixes #1635
This commit is contained in:
parent
bf288822b9
commit
81eeb8c495
@ -234,13 +234,13 @@ func TestABSPKGBUILDRepoExistsPerms(t *testing.T) {
|
|||||||
|
|
||||||
os.MkdirAll(filepath.Join(dir, "linux", ".git"), 0o777)
|
os.MkdirAll(filepath.Join(dir, "linux", ".git"), 0o777)
|
||||||
|
|
||||||
want := fmt.Sprintf("/usr/local/bin/git --no-replace-objects -C %s/linux pull --ff-only", dir)
|
want := fmt.Sprintf("/usr/local/bin/git --no-replace-objects -C %s/linux pull --rebase --autostash", dir)
|
||||||
if os.Getuid() == 0 {
|
if os.Getuid() == 0 {
|
||||||
ld := "systemd-run"
|
ld := "systemd-run"
|
||||||
if path, _ := exec.LookPath(ld); path != "" {
|
if path, _ := exec.LookPath(ld); path != "" {
|
||||||
ld = path
|
ld = path
|
||||||
}
|
}
|
||||||
want = fmt.Sprintf("%s --service-type=oneshot --pipe --wait --pty -p DynamicUser=yes -p CacheDirectory=yay -E HOME=/tmp --no-replace-objects -C %s/linux pull --ff-only", ld, dir)
|
want = fmt.Sprintf("%s --service-type=oneshot --pipe --wait --pty -p DynamicUser=yes -p CacheDirectory=yay -E HOME=/tmp --no-replace-objects -C %s/linux pull --rebase --autostash", ld, dir)
|
||||||
}
|
}
|
||||||
|
|
||||||
cmdRunner := &testRunner{}
|
cmdRunner := &testRunner{}
|
||||||
|
@ -113,13 +113,13 @@ func TestAURPKGBUILDRepoExistsPerms(t *testing.T) {
|
|||||||
|
|
||||||
os.MkdirAll(filepath.Join(dir, "yay-bin", ".git"), 0o777)
|
os.MkdirAll(filepath.Join(dir, "yay-bin", ".git"), 0o777)
|
||||||
|
|
||||||
want := fmt.Sprintf("/usr/local/bin/git --no-replace-objects -C %s/yay-bin pull --ff-only", dir)
|
want := fmt.Sprintf("/usr/local/bin/git --no-replace-objects -C %s/yay-bin pull --rebase --autostash", dir)
|
||||||
if os.Getuid() == 0 {
|
if os.Getuid() == 0 {
|
||||||
ld := "systemd-run"
|
ld := "systemd-run"
|
||||||
if path, _ := exec.LookPath(ld); path != "" {
|
if path, _ := exec.LookPath(ld); path != "" {
|
||||||
ld = path
|
ld = path
|
||||||
}
|
}
|
||||||
want = fmt.Sprintf("%s --service-type=oneshot --pipe --wait --pty -p DynamicUser=yes -p CacheDirectory=yay -E HOME=/tmp --no-replace-objects -C %s/yay-bin pull --ff-only", ld, dir)
|
want = fmt.Sprintf("%s --service-type=oneshot --pipe --wait --pty -p DynamicUser=yes -p CacheDirectory=yay -E HOME=/tmp --no-replace-objects -C %s/yay-bin pull --rebase --autostash", ld, dir)
|
||||||
}
|
}
|
||||||
|
|
||||||
cmdRunner := &testRunner{}
|
cmdRunner := &testRunner{}
|
||||||
|
@ -56,7 +56,7 @@ func downloadGitRepo(ctx context.Context, cmdBuilder exe.GitCmdBuilder,
|
|||||||
errOut: gotext.Get("error reading %s", filepath.Join(dest, pkgName, ".git")),
|
errOut: gotext.Get("error reading %s", filepath.Join(dest, pkgName, ".git")),
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
cmd := cmdBuilder.BuildGitCmd(ctx, filepath.Join(dest, pkgName), "pull", "--ff-only")
|
cmd := cmdBuilder.BuildGitCmd(ctx, filepath.Join(dest, pkgName), "pull", "--rebase", "--autostash")
|
||||||
|
|
||||||
_, stderr, errCmd := cmdBuilder.Capture(cmd)
|
_, stderr, errCmd := cmdBuilder.Capture(cmd)
|
||||||
if errCmd != nil {
|
if errCmd != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user