mirror of
https://github.com/TECHNOFAB11/jsonnet-bundler.git
synced 2025-12-12 16:10:04 +01:00
use filepath.Join instead of string concatenation
This commit is contained in:
parent
1fe94dcf91
commit
b597b16173
1 changed files with 6 additions and 2 deletions
|
|
@ -212,7 +212,7 @@ func (p *GitPackage) Install(ctx context.Context, name, dir, version string) (st
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sparse checkout optimization: if a Subdir is specificied,
|
// Sparse checkout optimization: if a Subdir is specified,
|
||||||
// there is no need to do a full checkout
|
// there is no need to do a full checkout
|
||||||
if p.Source.Subdir != "" {
|
if p.Source.Subdir != "" {
|
||||||
cmd = exec.CommandContext(ctx, "git", "config", "core.sparsecheckout", "true")
|
cmd = exec.CommandContext(ctx, "git", "config", "core.sparsecheckout", "true")
|
||||||
|
|
@ -224,8 +224,12 @@ func (p *GitPackage) Install(ctx context.Context, name, dir, version string) (st
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
glob := []byte(p.Source.Subdir + "/*\n")
|
glob := []byte(p.Source.Subdir + "/*\n")
|
||||||
ioutil.WriteFile(tmpDir+"/.git/info/sparse-checkout", glob, 0644)
|
err = ioutil.WriteFile(filepath.Join(tmpDir, ".git", "info", "sparse-checkout"), glob, 0644)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd = exec.CommandContext(ctx, "git", "-c", "advice.detachedHead=false", "checkout", version)
|
cmd = exec.CommandContext(ctx, "git", "-c", "advice.detachedHead=false", "checkout", version)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue