1 | #!/bin/bash |
---|---|
2 | # |
3 | # Copyright 2022 The Go Authors. All rights reserved. |
4 | # Use of this source code is governed by a BSD-style |
5 | # license that can be found in the LICENSE file. |
6 | # |
7 | # Creates a zip file containing all numbered versions |
8 | # of the commit history of a large source file, for use |
9 | # as input data for the tests of the diff algorithm. |
10 | # |
11 | # Run script from root of the x/tools repo. |
12 | |
13 | set -eu |
14 | |
15 | # WARNING: This script will install the latest version of $file |
16 | # The largest real source file in the x/tools repo. |
17 | # file=internal/lsp/source/completion/completion.go |
18 | # file=internal/lsp/source/diagnostics.go |
19 | file=internal/lsp/protocol/tsprotocol.go |
20 | |
21 | tmp=$(mktemp -d) |
22 | git log $file | |
23 | awk '/^commit / {print $2}' | |
24 | nl -ba -nrz | |
25 | while read n hash; do |
26 | git checkout --quiet $hash $file |
27 | cp -f $file $tmp/$n |
28 | done |
29 | (cd $tmp && zip -q - *) > testdata.zip |
30 | rm -fr $tmp |
31 | git restore --staged $file |
32 | git restore $file |
33 | echo "Created testdata.zip" |
34 |
Members