libgit2 / libgit2/pygit2

Adding LFS tracked files to index

Open
#664 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.7k
Forks
408
Avg merge
2d 57m
Merged PRs (30d)
7

Description

I'm writing a script to take snapshots from SVN URLs and add them to Git in a subfolder. Bringing LFS into the fold it seems like calling Repository.index.add_all isn't working quite right. The files that should be tracked seem to get put in to .git/lfs/objects as expected, but git lfs ls-files doesn't list any files. I changed this line of my code

repo.index.add_all([projectPath])

to this

        check_call(["/usr/bin/git","add","--all",projectPath])
        repo.index.read()

And that's fixed it, but I'd prefer to have the code self contained with library calls.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the snapshot flow using repo.index.add_all([projectPath]) and compare it with the shown git add --all command followed by repo.index.read(). Check the resulting index with git lfs ls-files; done means the library-only path records the LFS-tracked files equivalently.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, python
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.