ESMCI / ESMCI/git-fleximod

Unexpected error when git-lfs is not configured correctly

Open
#93 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
3
Forks
10
PR merge metrics
No merged PRs in 30d

Description

This is not a `git-fleximod` issue, but at the CSEG meeting we decided this was the best place for the discussion.

If a user does not have `git-lfs` installed, but does have a `[filter "lfs"]` block in `.gitconfig` (perhaps the file was copied from a different machine, or restored from backup? it has happened at least twice!), then CESM checkouts will fail in CTSM because that's the only component to make use of git LFS. The most recent user to raise this issue reported the following error:

```
root - ERROR - Failed to checkout clm at tag or hash ctsm5.4.042 from CESM/components/clm
Traceback (most recent call last):
File "CESM/./bin/git-fleximod", line 8, in
sys.exit(main())
File "CESM/.lib/git-fleximod/git_fleximod/git_fleximod.py", line 385, in main
asyncio.run(submodules_update(gitmodules, root_dir, fxrequired, force))
File "/usr/lib64/python3.9/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib64/python3.9/asyncio/base_events.py", line 647, in run_until_complete
return future.result()
File "CESM/.lib/git-fleximod/git_fleximod/git_fleximod.py", line 283, in submodules_update
await asyncio.gather(*tasks)
File "CESM/.lib/git-fleximod/git_fleximod/git_fleximod.py", line 267, in update_submodule
await submod.update()
File "CESM/.lib/git-fleximod/git_fleximod/submodule.py", line 522, in update
utils.fatal_error(
File "CESM/.lib/git-fleximod/git_fleximod/utils.py", line 123, in fatal_error
raise RuntimeError("{0}ERROR: {1}".format(os.linesep, message))
RuntimeError:
ERROR: Failed to checkout clm at tag or hash ctsm5.4.042 from CESM/components/clm
```

I hopped on a google meet call with him to try to troubleshoot... I had him run `git-fleximod update -v`, but I don't think we saw an LFS-specific error message there either. We started to suspect LFS when we cloned CTSM directly and saw an LFS error when checking out the tag.

One reason to open an issue here is to see if there's a way for git-fleximod to recognize this specific failure mode, and provide a better error message. To that end I'll see if I can recreate this error and provide more complete logs from

1. `git-fleximod update`
2. `git-fleximod update -v`
3. `git clone -b `
4. `git clone ; git checkout `

to see which of those actually mention LFS in some manner. It will probably take a little bit of time before I can run those tests, though.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with git_fleximod/git_fleximod.py at update_submodule and submodule.py around update and line 522, then inspect utils.py around fatal_error. Reproduce the failure with the listed git-fleximod update, verbose update, and git clone or checkout commands; done means the missing git-lfs configuration is recognized and produces a clearer error message.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, python
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.