kythe.io@v0.0.68-0.20240422202219-7225dbc01741/kythe/go/platform/tools/kzip/metadatacmd/test.sh (about)

     1  #!/bin/bash
     2  # Copyright 2020 The Kythe Authors. All rights reserved.
     3  #
     4  # Licensed under the Apache License, Version 2.0 (the "License");
     5  # you may not use this file except in compliance with the License.
     6  # You may obtain a copy of the License at
     7  #
     8  #   http://www.apache.org/licenses/LICENSE-2.0
     9  #
    10  # Unless required by applicable law or agreed to in writing, software
    11  # distributed under the License is distributed on an "AS IS" BASIS,
    12  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  # See the License for the specific language governing permissions and
    14  # limitations under the License.
    15  
    16  set -e
    17  
    18  # For the test, we use a constant string for the time. When working with a git
    19  # repository, the timestamp can be retrieved with `git log --pretty='%ad' -n 1
    20  # HEAD`. The format '%ad' prints out just the 'author date' of the commit. The
    21  # format of the date can be changed with git's --date flag, but the kzip
    22  # create_metadata command is setup to accept git's default format.
    23  TIMESTAMP="Thu Jun 4 23:15:09 2020 -0700"
    24  
    25  echo "Commit timestamp: $TIMESTAMP"
    26  
    27  OUTFILE="$TEST_TMPDIR/meta.kzip"
    28  
    29  $KZIP create_metadata \
    30      --output "$OUTFILE" \
    31      --corpus test_corpus \
    32      --commit_timestamp "$TIMESTAMP"
    33  
    34  $KZIP view "$OUTFILE"