Skip to content

Commit 8e3c5c9

Browse files
authored
Merge pull request git-lfs#3229 from git-lfs/release-next
release: v2.5.2
2 parents e162848 + 6169805 commit 8e3c5c9

File tree

13 files changed

+116
-25
lines changed

13 files changed

+116
-25
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# Git LFS Changelog
22

3+
## 2.5.2 (17 September, 2018)
4+
5+
### Bugs
6+
7+
* config: Treat [host:port]:path URLs correctly #3226 (@saschpe)
8+
* tq: Always provide a Content-Type when uploading files #3201 (@bk2204)
9+
* commands/track: Properly `lfs track` files with escaped characters in their
10+
name #3192 (@leonid-s-usov)
11+
12+
### Misc
13+
14+
* packagecloud.rb: remove older versions #3210 (@andyneff)
15+
316
## 2.5.1 (2 August, 2018)
417

518
This release contains miscellaneous bug fixes since v2.5.0. Most notably,

commands/command_track.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ ArgsLoop:
7272
pattern := trimCurrentPrefix(cleanRootPath(unsanitizedPattern))
7373
if !trackNoModifyAttrsFlag {
7474
for _, known := range knownPatterns {
75-
if known.Path == filepath.Join(relpath, pattern) &&
75+
if unescapeAttrPattern(known.Path) == filepath.Join(relpath, pattern) &&
7676
((trackLockableFlag && known.Lockable) || // enabling lockable & already lockable (no change)
7777
(trackNotLockableFlag && !known.Lockable) || // disabling lockable & not lockable (no change)
7878
(!trackLockableFlag && !trackNotLockableFlag)) { // leave lockable as-is in all cases
@@ -132,7 +132,7 @@ ArgsLoop:
132132
continue
133133
}
134134

135-
pattern := fields[0]
135+
pattern := unescapeAttrPattern(fields[0])
136136
if newline, ok := changedAttribLines[pattern]; ok {
137137
// Replace this line (newline already embedded)
138138
attributesFile.WriteString(newline)

config/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ var (
1212
)
1313

1414
const (
15-
Version = "2.5.1"
15+
Version = "2.5.2"
1616
)
1717

1818
func init() {

debian/changelog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
git-lfs (2.5.2) stable; urgency=low
2+
3+
* New upstream version
4+
5+
-- Taylor Blau <[email protected]> Mon, 17 Sep 2018 14:29:00 +0000
6+
17
git-lfs (2.5.1) stable; urgency=low
28

39
* New upstream version

lfsapi/endpoint.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ func endpointOperation(e Endpoint, method string) string {
3333

3434
// endpointFromBareSshUrl constructs a new endpoint from a bare SSH URL:
3535
//
36-
// [email protected]:path/to/repo.git
36+
// [email protected]:path/to/repo.git or
37+
// [[email protected]:port]:path/to/repo.git
3738
//
3839
func endpointFromBareSshUrl(rawurl string) Endpoint {
3940
parts := strings.Split(rawurl, ":")
@@ -45,6 +46,9 @@ func endpointFromBareSshUrl(rawurl string) Endpoint {
4546
// Treat presence of ':' as a bare URL
4647
var newPath string
4748
if len(parts) > 2 { // port included; really should only ever be 3 parts
49+
// Correctly handle [host:port]:path URLs
50+
parts[0] = strings.TrimPrefix(parts[0], "[")
51+
parts[1] = strings.TrimSuffix(parts[1], "]")
4852
newPath = fmt.Sprintf("%v:%v", parts[0], strings.Join(parts[1:], "/"))
4953
} else {
5054
newPath = strings.Join(parts, "/")

lfsapi/endpoint_finder_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,18 @@ func TestBareSSHEndpointAddsLfsSuffix(t *testing.T) {
177177
assert.Equal(t, "", e.SshPort)
178178
}
179179

180+
func TestBareSSSHEndpointWithCustomPortInBrackets(t *testing.T) {
181+
finder := NewEndpointFinder(NewContext(nil, nil, map[string]string{
182+
"remote.origin.url": "[[email protected]:2222]:foo/bar.git",
183+
}))
184+
185+
e := finder.Endpoint("download", "")
186+
assert.Equal(t, "https://example.com/foo/bar.git/info/lfs", e.Url)
187+
assert.Equal(t, "[email protected]", e.SshUserAndHost)
188+
assert.Equal(t, "foo/bar.git", e.SshPath)
189+
assert.Equal(t, "2222", e.SshPort)
190+
}
191+
180192
func TestSSHEndpointFromGlobalLfsUrl(t *testing.T) {
181193
finder := NewEndpointFinder(NewContext(nil, nil, map[string]string{
182194
"lfs.url": "[email protected]:foo/bar.git",

rpm/SPECS/git-lfs.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Name: git-lfs
2-
Version: 2.5.1
2+
Version: 2.5.2
33
Release: 1%{?dist}
44
Summary: Git extension for versioning large files
55

script/packagecloud.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@
3333
),
3434
"centos/7" => %w(
3535
el/7
36-
fedora/22
37-
fedora/23
38-
fedora/24
39-
fedora/25
40-
fedora/26
36+
fedora/27
37+
fedora/28
38+
opensuse/42.3
39+
sles/11.4
40+
sles/12.3
4141
),
4242
"debian/7" => %w(
4343
debian/wheezy
@@ -58,6 +58,7 @@
5858
linuxmint/serena
5959
linuxmint/sonya
6060
linuxmint/sylvia
61+
linuxmint/tara
6162
ubuntu/xenial
6263
ubuntu/yakkety
6364
ubuntu/zesty

t/t-content-type.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ begin_test "content-type: is enabled by default"
2020
GIT_CURL_VERBOSE=1 git push origin master 2>&1 | tee push.log
2121

2222
[ 1 -eq "$(grep -c "Content-Type: application/x-gzip" push.log)" ]
23+
[ 0 -eq "$(grep -c "Content-Type: application/octet-stream" push.log)" ]
2324
)
2425
end_test
2526

@@ -42,6 +43,7 @@ begin_test "content-type: is disabled by configuration"
4243
GIT_CURL_VERBOSE=1 git push origin master 2>&1 | tee push.log
4344

4445
[ 0 -eq "$(grep -c "Content-Type: application/x-gzip" push.log)" ]
46+
[ 1 -eq "$(grep -c "Content-Type: application/octet-stream" push.log)" ]
4547
)
4648
end_test
4749

t/t-track.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,3 +595,28 @@ begin_test "track (system gitattributes)"
595595
grep "*.dat" track.log
596596
)
597597
end_test
598+
599+
begin_test "track: escaped pattern in .gitattributes"
600+
(
601+
set -e
602+
603+
reponame="track-escaped"
604+
git init "$reponame"
605+
cd "$reponame"
606+
607+
filename="file with spaces.#"
608+
609+
echo "I need escaping" > "$filename"
610+
611+
[ "Tracking \"$filename\"" = "$(git lfs track "$filename")" ]
612+
[ "\"$filename\" already supported" = "$(git lfs track "$filename")" ]
613+
614+
#changing flags should track the file again
615+
[ "Tracking \"$filename\"" = "$(git lfs track -l "$filename")" ]
616+
617+
if [ 1 -ne "$(wc -l .gitattributes | awk '{ print $1 }')" ]; then
618+
echo >&2 "changing flag for an existing tracked file shouldn't add another line"
619+
exit 1
620+
fi
621+
)
622+
end_test

t/t-untrack.sh

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ begin_test "untrack removes prefixed patterns (legacy)"
8989
git lfs untrack "./a.dat"
9090

9191
if [ ! -z "$(cat .gitattributes)" ]; then
92-
echo &>2 "fatal: expected 'git lfs untrack' to clear .gitattributes"
92+
echo >&2 "fatal: expected 'git lfs untrack' to clear .gitattributes"
9393
exit 1
9494
fi
9595

@@ -98,7 +98,7 @@ begin_test "untrack removes prefixed patterns (legacy)"
9898
git lfs untrack "a.dat"
9999

100100
if [ ! -z "$(cat .gitattributes)" ]; then
101-
echo &>2 "fatal: expected 'git lfs untrack' to clear .gitattributes"
101+
echo >&2 "fatal: expected 'git lfs untrack' to clear .gitattributes"
102102
exit 1
103103
fi
104104
)
@@ -120,7 +120,7 @@ begin_test "untrack removes prefixed patterns (modern)"
120120
git lfs untrack "./a.dat"
121121

122122
if [ ! -z "$(cat .gitattributes)" ]; then
123-
echo &>2 "fatal: expected 'git lfs untrack' to clear .gitattributes"
123+
echo >&2 "fatal: expected 'git lfs untrack' to clear .gitattributes"
124124
exit 1
125125
fi
126126

@@ -129,7 +129,31 @@ begin_test "untrack removes prefixed patterns (modern)"
129129
git lfs untrack "a.dat"
130130

131131
if [ ! -z "$(cat .gitattributes)" ]; then
132-
echo &>2 "fatal: expected 'git lfs untrack' to clear .gitattributes"
132+
echo >&2 "fatal: expected 'git lfs untrack' to clear .gitattributes"
133+
exit 1
134+
fi
135+
)
136+
end_test
137+
138+
begin_test "untrack removes escaped pattern in .gitattributes"
139+
(
140+
set -e
141+
142+
reponame="untrack-escaped"
143+
git init "$reponame"
144+
cd "$reponame"
145+
146+
filename="file with spaces.#"
147+
148+
# emulate multiple instances of the same file in gitattributes
149+
echo 'file[[:space:]]with[[:space:]]spaces.\# filter=lfs diff=lfs merge=lfs -text' >> .gitattributes
150+
echo 'file[[:space:]]with[[:space:]]spaces.\# filter=lfs diff=lfs merge=lfs -text' >> .gitattributes
151+
echo 'file[[:space:]]with[[:space:]]spaces.\# filter=lfs diff=lfs merge=lfs -text' >> .gitattributes
152+
153+
git lfs untrack "$filename"
154+
155+
if [ ! -z "$(cat .gitattributes)" ]; then
156+
echo >&2 "fatal: expected 'git lfs untrack' to clear .gitattributes even if the file name was escaped"
133157
exit 1
134158
fi
135159
)

tq/basic_upload.go

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -150,19 +150,23 @@ func (a *basicUploadAdapter) DoTransfer(ctx interface{}, t *Transfer, cb Progres
150150
func (a *adapterBase) setContentTypeFor(req *http.Request, r io.ReadSeeker) error {
151151
uc := config.NewURLConfig(a.apiClient.GitEnv())
152152
disabled := !uc.Bool("lfs", req.URL.String(), "contenttype", true)
153-
if len(req.Header.Get("Content-Type")) != 0 || disabled {
153+
if len(req.Header.Get("Content-Type")) != 0 {
154154
return nil
155155
}
156156

157-
buffer := make([]byte, 512)
158-
n, err := r.Read(buffer)
159-
if err != nil && err != io.EOF {
160-
return errors.Wrap(err, "content type detect")
161-
}
157+
var contentType string
158+
159+
if !disabled {
160+
buffer := make([]byte, 512)
161+
n, err := r.Read(buffer)
162+
if err != nil && err != io.EOF {
163+
return errors.Wrap(err, "content type detect")
164+
}
162165

163-
contentType := http.DetectContentType(buffer[:n])
164-
if _, err := r.Seek(0, 0); err != nil {
165-
return errors.Wrap(err, "content type rewind")
166+
contentType = http.DetectContentType(buffer[:n])
167+
if _, err := r.Seek(0, io.SeekStart); err != nil {
168+
return errors.Wrap(err, "content type rewind")
169+
}
166170
}
167171

168172
if contentType == "" {

versioninfo.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"FileVersion": {
55
"Major": 2,
66
"Minor": 5,
7-
"Patch": 1,
7+
"Patch": 2,
88
"Build": 0
99
}
1010
},
@@ -13,7 +13,7 @@
1313
"FileDescription": "Git LFS",
1414
"LegalCopyright": "GitHub, Inc. and Git LFS contributors",
1515
"ProductName": "Git Large File Storage (LFS)",
16-
"ProductVersion": "2.5.1"
16+
"ProductVersion": "2.5.2"
1717
},
1818
"IconPath": "script/windows-installer/git-lfs-logo.ico"
1919
}

0 commit comments

Comments
 (0)