Skip to content
Achilleas Koutsou edited this page Mar 20, 2017 · 14 revisions

This page is for documenting gin internals as they are being developed. In the future, it may become a full developer guide to how the gin client uses git and git annex to perform all the operations it supports.

gin ls

The gin ls command should print the status of all files in a given directory with respect to git and git annex. There are 6 cases that need to be identified:

  1. The file is checked into git annex and its contents are available locally. #CASE1
  2. The file is checked into git annex and its contents are not available locally. In this case, there should be a local placeholder file which contains the file's unique hash. #CASE2
  3. The file is checked into git or git annex and it has local modifications that have not been committed. #CASE3
  4. The file is checked into git or git annex and it has local modifications that have been committed but not pushed. #CASE4
  5. The file is checked into git or git annex and it has remote modifications that have not been pulled. #CASE5
  6. The file is not being tracked. #CASE6

Below we describe how the client uses git and git annex commands to identify the case for a given file.

Conditions

For each file we need to check:

  • Is it in git annex? Y/N
  • If N: Is it in git? Y/N

First question answered by:

  • git annex whereis file

Second question is answered by:

  • git ls-files file

Cases

file is in annex:

  • git annex whereis file will return successfully and will give us the file info From this info we can determine whether:
    • File contents are synced locally. It will have a remote which is the local directory, marked with here: true. #CASE1
    • File contents are not synced yet. All remotes will be marked with here: false. #CASE2

file is not in annex:

  • git annex whereis file will return successfully but will return no info. This means that the file exists and it is either in git or it is untracked. If the command returns with an error, the file does not exist (we don't really care about the missing file case). Following this we need to check whether:
    • git ls-files file returns the file. This means that the file is checked into git.
    • git ls-files file returns nothing. This means the file is not tracked.
Clone this wiki locally