Skip to content

git lfs not check git file system before start tracking files #293

Closed

Description

@aorjoa

File tracking not check necessary items before (git lfs require git file system and into git influence directory) , to prevent error I will hack some code for support this issue and I will show reproduce issue as below. ( I think it's like #200 but duplicate line of tracking file in my case)

System environments
git-lfs/0.5.1 (GitHub; darwin amd64; git 2.0.1; go 1.4.1) on Mac OS X : Yosemity 10.10.4

I woking in directory contain a testfile.png and use git lfs without git file system

$ git lfs track "testfile.png"
Tracking testfile.png

.gitattributes was created and I looking into file

$ cat .gitattributes
testfile.png filter=lfs diff=lfs merge=lfs -crlf

then use git lfs track again

$ git lfs track "testfile.png"
Tracking testfile.png

and read it

$ cat .gitattributes
testfile.png filter=lfs diff=lfs merge=lfs -crlf
testfile.png filter=lfs diff=lfs merge=lfs -crlf

It seem like git lfs not check git file system before. but if git already in the directory it’s warnning user about file exits in git lfs system (.gitattributes).

create git file system

$ git init
Initialized empty Git repository in /Users/AorJoa/repository/test_check_git_exists/.git/

git check tracking file before add any line

$ git lfs track "testfile.png"
testfile.png already supported

and file contains two line of tracking file

$ cat .gitattributes 
testfile.png filter=lfs diff=lfs merge=lfs -crlf
testfile.png filter=lfs diff=lfs merge=lfs -crlf

Activity

  1. added a commit that references this issue on May 10, 2015
    904682f
  2. technoweenie commented on May 21, 2015

    @technoweenie
    Contributor

    Hey, I'm not able to replicate this:

    $ git lfs track "testfile.png"
    Tracking testfile.png
    
    $ cat .gitattributes 
    testfile.png filter=lfs diff=lfs merge=lfs -crlf
    
    $ git lfs track "testfile.png"
    testfile.png already supported
    
    $ cat .gitattributes
    testfile.png filter=lfs diff=lfs merge=lfs -crlf
    

    I added a passing test for this in #323. Are you still seeing this? What version of Git LFS are you running?

  3. aorjoa commented on May 22, 2015

    @aorjoa
    ContributorAuthor

    I use $ go install cmd/git-lfs/git-lfs.go from commit 38657a8. It's still problem but I think test pass in #323 because $ git init was created .git directory. (I guess this issue coming from I run $ git lfs track <some file> out of git directory.

  4. technoweenie commented on May 22, 2015

    @technoweenie
    Contributor

    Can you try it with 7bbd60d?

  5. aorjoa commented on May 22, 2015

    @aorjoa
    ContributorAuthor

    I try to use git lfs with 7bbd60d it's look good. 👍

  6. technoweenie commented on May 22, 2015

    @technoweenie
    Contributor

    Great! I'll merge that PR. Thanks again for the report and patch :)

  7. technoweenie commented on May 22, 2015

    @technoweenie
    Contributor

    This should be fixed in #323.

    git lfs track "testfile.png"
    

    By the way, it's probably better to track file types or directories instead of additional files.

    # better
    git lfs track "*.png"
    
  8. aorjoa commented on May 23, 2015

    @aorjoa
    ContributorAuthor

    👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions