Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

potentially invoke lfs for 'git update-index' #2647

Merged
merged 4 commits into from
Oct 5, 2017
Merged

Conversation

technoweenie
Copy link
Contributor

Brings LFS back for git update-index calls. This fixes issues where git status is unclean after a git lfs pull or git lfs clone.

/cc #2646 (comment)

@@ -119,6 +123,7 @@ begin_test "cloneSSL"

newclonedir="testcloneSSL1"
git lfs clone "$SSLGITSERVER/$reponame" "$newclonedir" 2>&1 | tee lfsclone.log
#assert_clean_status
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this commented intentionally?

@@ -459,7 +459,7 @@ func DefaultRemote() (string, error) {
}

func UpdateIndexFromStdin() *subprocess.Cmd {
return gitNoLFS("update-index", "-q", "--refresh", "--stdin")
return git("update-index", "-q", "--refresh", "--stdin")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, here is my understanding:

We hit this code path only if we manually resolve the Git LFS pointers. Manually here means: we don't use the Git clean/smudge mechanism. This happens in the git lfs clone ... and git lfs pull calls. In these calls the following happens:

  1. Git checks out all files without running the Git LFS filters. We have the Git LFS pointer files checked out as a result.
  2. Git LFS iterates over all pointer files and replaces them with the actual content
  3. Git LFS asks Git to re-index the changed content (this happens with the update-index call above). During the re-index Git needs to clean the real content to calculate the pointer file and compare that against the version stored in the repository. This way git status can tell us if the file was changed or not.

--> I think it makes sense to run Git with the clean filter here.

Copy link
Member

@larsxschneider larsxschneider left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except for the single commented line everything looks good to me!

@technoweenie technoweenie merged commit 327253f into master Oct 5, 2017
@technoweenie technoweenie deleted the fix-index-issues branch October 5, 2017 22:42
@technoweenie
Copy link
Contributor Author

Thanks for the review 🤘

@larsxschneider
Copy link
Member

Your welcome! Do you know when 2.3.3 will be released with the fix?

@technoweenie
Copy link
Contributor Author

I have some stuff this morning, but I could release it this afternoon. Though, I don't think a friday afternoon release is a good idea, so I'm leaning towards Monday. What do you think?

@larsxschneider
Copy link
Member

I trust your judgement here. I agree with the Friday argument. However, this is a pretty nasty bug, too.

chrisd8088 added a commit to chrisd8088/git-lfs that referenced this pull request Sep 10, 2024
In commit caaa0f9 of PR git-lfs#2647 and
number of tests of the "git lfs clone" and "git lfs pull" commands
were enhanced so as check that after those commands are invoked,
a "git status" command returns a "working tree clean" message.
To perform these checks, a call to our assert_clean_status() shell
function was added to the tests.

In the case of the "cloneSSL" test, an assert_clean_status() call
was added, but left commented out; it was then uncommented in commit
e0eede1 of the same PR.  Unfortunately,
the call is made when the current working directory has not yet been
changed to that of the newly cloned repository's working tree, and
so will fail as it stands now.

However, as described in git-lfs#5658, the "cloneSSL" test and the "clone
ClientCert" tests in our t/t-clone.sh test script do not actually
run to completion, as a consequence of an improper check of the TRAVIS
variable (which is no longer used since we migrated our test suite to
GitHub Actions in PR git-lfs#3808).  This bug was already in place at the time
of PR git-lfs#2647, and so the assertions are never actually performed in
these tests.

We expect to address this problem in a subsequent commit in this PR,
and when we do so, the test "cloneSSL" test will fail because the
assert_clean_status() call is made without having changed the current
working directory to that of the cloned repository's working tree.

Therefore we move the assertion to the end of the block of checks
performed after the "pushd" shell command is used to change the
directory to that of the new clone's working tree.

We also take the opportunity to add the assert_clean_status() calls
to a number of other tests in the t/t-clone.sh script, so they are
all performing similar sets of checks.  This will help keep our
tests in closer aligment with each other.
chrisd8088 added a commit to chrisd8088/git-lfs that referenced this pull request Sep 15, 2024
In commit caaa0f9 of PR git-lfs#2647 and
number of tests of the "git lfs clone" and "git lfs pull" commands
were enhanced so as check that after those commands are invoked,
a "git status" command returns a "working tree clean" message.
To perform these checks, a call to our assert_clean_status() shell
function was added to the tests.

In the case of the "cloneSSL" test, an assert_clean_status() call
was added, but left commented out; it was then uncommented in commit
e0eede1 of the same PR.  Unfortunately,
the call is made when the current working directory has not yet been
changed to that of the newly cloned repository's working tree, and
so will fail as it stands now.

However, as described in git-lfs#5658, the "cloneSSL" test and the "clone
ClientCert" tests in our t/t-clone.sh test script do not actually
run to completion, as a consequence of an improper check of the TRAVIS
variable (which is no longer used since we migrated our test suite to
GitHub Actions in PR git-lfs#3808).  This bug was already in place at the time
of PR git-lfs#2647, and so the assertions are never actually performed in
these tests.

We expect to address this problem in a subsequent commit in this PR,
and when we do so, the test "cloneSSL" test will fail because the
assert_clean_status() call is made without having changed the current
working directory to that of the cloned repository's working tree.

Therefore we move the assertion to the end of the block of checks
performed after the "pushd" shell command is used to change the
directory to that of the new clone's working tree.

We also take the opportunity to add the assert_clean_status() calls
to a number of other tests in the t/t-clone.sh script, so they are
all performing similar sets of checks.  This will help keep our
tests in closer aligment with each other.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants