Skip to content

Commit 2d63305

Browse files
Bryan C. Millsgopherbot
authored andcommitted
cmd/go: make vcstest repo scripts compatible with old Git versions
The scripts added in CL 421455 passed on the TryBots, but failed on a subset of the builders that have older 'git' binaries installed. Notably, the older versions of git do not support: - 'git branch -m' before the current branch has a commit - 'init.defaultBranch' in the '.gitconfig' file, and - 'git branch -c'. We address those by, respectively: - waiting to run 'git branch -m' until after the first commit - always running 'git branch -m' explicitly to set the branch name, and - using 'git checkout' instead of 'git branch -c' to set branch parents. Updates #27494. Change-Id: I42f012f5add8f31e41d077d752d8268aacbce8a4 Reviewed-on: https://go-review.googlesource.com/c/go/+/445355 Run-TryBot: Bryan Mills <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Than McIntosh <[email protected]> Auto-Submit: Bryan Mills <[email protected]>
1 parent f9bd1d0 commit 2d63305

24 files changed

+41
-35
lines changed

src/cmd/go/testdata/vcstest/git/commit-after-tag.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ env GIT_COMMITTER_NAME=$GIT_AUTHOR_NAME
66
env GIT_COMMITTER_EMAIL=$GIT_AUTHOR_EMAIL
77

88
git init
9-
git branch -m master
109

1110
at 2019-07-15T17:16:47-04:00
1211
git add go.mod main.go
1312
git commit -m 'all: add go.mod and main.go'
13+
git branch -m master
1414
git tag v1.0.0
1515

1616
at 2019-07-15T17:17:27-04:00

src/cmd/go/testdata/vcstest/git/empty-v2-without-v1.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ env GIT_COMMITTER_NAME=$GIT_AUTHOR_NAME
66
env GIT_COMMITTER_EMAIL=$GIT_AUTHOR_EMAIL
77

88
git init
9-
git branch -m master
109

1110
at 2019-10-07T14:15:32-04:00
1211
git add go.mod
1312
git commit -m 'add go.mod file without go source files'
13+
git branch -m master
1414
git tag v2.0.0
1515

1616
git log --oneline --decorate=short

src/cmd/go/testdata/vcstest/git/emptytest.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ env GIT_COMMITTER_NAME=$GIT_AUTHOR_NAME
66
env GIT_COMMITTER_EMAIL=$GIT_AUTHOR_EMAIL
77

88
git init
9-
git branch -m master
109

1110
at 2018-07-03T22:35:49-04:00
1211
git add go.mod
1312
git commit -m 'initial'
13+
git branch -m master
1414

1515
git log --oneline
1616
cmp stdout .git-log

src/cmd/go/testdata/vcstest/git/gitrepo1.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,25 @@ env GIT_COMMITTER_NAME=$GIT_AUTHOR_NAME
66
env GIT_COMMITTER_EMAIL=$GIT_AUTHOR_EMAIL
77

88
git init
9-
git branch -m master
109

1110
at 2018-04-17T15:43:22-04:00
1211
unquote ''
1312
cp stdout README
1413
git add README
1514
git commit -a -m 'empty README'
15+
git branch -m master
1616
git tag v1.2.3
1717

1818
at 2018-04-17T15:45:48-04:00
19-
git branch -c v2
19+
git branch v2
2020
git checkout v2
2121
echo 'v2'
2222
cp stdout v2
2323
git add v2
2424
git commit -a -m 'v2'
2525
git tag v2.3
2626
git tag v2.0.1
27-
git branch -c v2.3.4
27+
git branch v2.3.4
2828

2929
at 2018-04-17T16:00:19-04:00
3030
echo 'intermediate'
@@ -40,7 +40,8 @@ git commit -a -m 'another'
4040
git tag v2.0.2
4141

4242
at 2018-04-17T16:16:52-04:00
43-
git branch -c master v3
43+
git checkout master
44+
git branch v3
4445
git checkout v3
4546
mkdir v3/sub/dir
4647
echo 'v3/sub/dir/file'

src/cmd/go/testdata/vcstest/git/hello.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ env GIT_COMMITTER_NAME='Russ Cox'
66
env GIT_COMMITTER_EMAIL='[email protected]'
77

88
git init
9-
git branch -m master
109

1110
at 2017-09-21T21:05:58-04:00
1211
git add hello.go
1312
git commit -a -m 'hello'
13+
git branch -m master
1414

1515
git log --oneline --decorate=short
1616
cmp stdout .git-log

src/cmd/go/testdata/vcstest/git/insecurerepo.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ env GIT_COMMITTER_NAME=$GIT_AUTHOR_NAME
66
env GIT_COMMITTER_EMAIL=$GIT_AUTHOR_EMAIL
77

88
git init
9-
git branch -m master
109

1110
at 2019-04-03T13:30:35-04:00
1211
git add go.mod
1312
git commit -m 'all: initialize module'
13+
git branch -m master
1414

1515
at 2019-09-04T14:39:48-04:00
1616
git add main.go

src/cmd/go/testdata/vcstest/git/mainonly.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ env GIT_COMMITTER_NAME=$GIT_AUTHOR_NAME
66
env GIT_COMMITTER_EMAIL=$GIT_AUTHOR_EMAIL
77

88
git init
9-
git branch -m master
109

1110
at 2019-09-05T14:07:43-04:00
1211
git add main.go
1312
git commit -a -m 'add main.go'
13+
git branch -m master
1414

1515
git log --oneline --decorate=short
1616
cmp stdout .git-log

src/cmd/go/testdata/vcstest/git/modlegacy1-new.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ env GIT_COMMITTER_NAME=$GIT_AUTHOR_NAME
66
env GIT_COMMITTER_EMAIL=$GIT_AUTHOR_EMAIL
77

88
git init
9-
git branch -m master
109

1110
at 2018-04-25T11:00:57-04:00
1211
git add go.mod new.go p1 p2
1312
git commit -m 'initial commit'
13+
git branch -m master
1414

1515
git log --oneline --decorate=short
1616
cmp stdout .git-log

src/cmd/go/testdata/vcstest/git/modlegacy1-old.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ env GIT_COMMITTER_NAME=$GIT_AUTHOR_NAME
66
env GIT_COMMITTER_EMAIL=$GIT_AUTHOR_EMAIL
77

88
git init
9-
git branch -m master
109

1110
at 2018-04-25T10:59:24-04:00
1211
git add p1 p2
1312
git commit -m 'initial commit'
13+
git branch -m master
1414

1515
git log --oneline --decorate=short
1616
cmp stdout .git-log

src/cmd/go/testdata/vcstest/git/no-tags.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ env GIT_COMMITTER_NAME=$GIT_AUTHOR_NAME
66
env GIT_COMMITTER_EMAIL=$GIT_AUTHOR_EMAIL
77

88
git init
9-
git branch -m master
109

1110
at 2019-07-15T17:20:47-04:00
1211
git add go.mod main.go
1312
git commit -m 'all: add go.mod and main.go'
13+
git branch -m master
1414

1515
git log --oneline --decorate=short
1616
cmp stdout .git-log

0 commit comments

Comments
 (0)