github.com/git-lfs/git-lfs@v2.5.2+incompatible/t/t-track-attrs.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  . "$(dirname "$0")/testlib.sh"
     4  
     5  ensure_git_version_isnt $VERSION_LOWER "2.1.0"
     6  
     7  begin_test "track (--no-modify-attrs)"
     8  (
     9    set -e
    10  
    11    reponame="track-no-modify-attrs"
    12    git init "$reponame"
    13    cd "$reponame"
    14  
    15    echo "contents" > a.dat
    16    git add a.dat
    17  
    18    # Git assumes that identical results from `stat(1)` between the index and
    19    # working copy are stat dirty. To prevent this, wait at least one second to
    20    # yield different `stat(1)` results.
    21    sleep 1
    22  
    23    git commit -m "add a.dat"
    24  
    25    echo "*.dat filter=lfs diff=lfs merge=lfs -text" > .gitattributes
    26  
    27    git add .gitattributes
    28    git commit -m "asdf"
    29  
    30    [ -z "$(git status --porcelain)" ]
    31  
    32    git lfs track --no-modify-attrs "*.dat"
    33  
    34    [ " M a.dat" = "$(git status --porcelain)" ]
    35  )
    36  end_test
    37