diff mbox series

download/git: fix LFS support

Message ID 20220106151942.1506534-1-john@metanate.com
State Accepted
Headers show
Series download/git: fix LFS support | expand

Commit Message

John Keeping Jan. 6, 2022, 3:19 p.m. UTC
The original patch for commit cff428fe31 ("download/git: support Git
LFS") included a call to "git lfs install" but this was a problem as it
could modify ~/.gitconfig outside the dl/ tree.  When this was
updated it was thought that the modification to gitconfig was
unnecessary because the LFS fetch and checkout steps are performed
manually.

Unfortunately, this is not correct and the LFS checkout fails with:

	Cannot checkout LFS objects, Git LFS is not installed.

Add the call to "git lfs install", with the --local option so that only
the repository's .git/config is modified and not the user's global
~/.gitconfig.

This is also required for submodules as the parent repository's config
is not inherited.

Cc: Arnout Vandecappelle <arnout@mind.be>
Cc: Vincent Fazio <vfazio@xes-inc.com>
Signed-off-by: John Keeping <john@metanate.com>
---
 support/download/git | 2 ++
 1 file changed, 2 insertions(+)

Comments

Thomas Petazzoni Jan. 7, 2022, 6:07 p.m. UTC | #1
On Thu,  6 Jan 2022 15:19:42 +0000
John Keeping <john@metanate.com> wrote:

> The original patch for commit cff428fe31 ("download/git: support Git
> LFS") included a call to "git lfs install" but this was a problem as it
> could modify ~/.gitconfig outside the dl/ tree.  When this was
> updated it was thought that the modification to gitconfig was
> unnecessary because the LFS fetch and checkout steps are performed
> manually.
> 
> Unfortunately, this is not correct and the LFS checkout fails with:
> 
> 	Cannot checkout LFS objects, Git LFS is not installed.
> 
> Add the call to "git lfs install", with the --local option so that only
> the repository's .git/config is modified and not the user's global
> ~/.gitconfig.
> 
> This is also required for submodules as the parent repository's config
> is not inherited.
> 
> Cc: Arnout Vandecappelle <arnout@mind.be>
> Cc: Vincent Fazio <vfazio@xes-inc.com>
> Signed-off-by: John Keeping <john@metanate.com>
> ---
>  support/download/git | 2 ++
>  1 file changed, 2 insertions(+)

Applied to master, thanks.

Thomas
diff mbox series

Patch

diff --git a/support/download/git b/support/download/git
index 41c3160099..1a1c315f73 100755
--- a/support/download/git
+++ b/support/download/git
@@ -209,10 +209,12 @@  fi
 
 # If there are large files then fetch them.
 if [ ${large_file} -eq 1 ]; then
+    _git lfs install --local
     _git lfs fetch
     _git lfs checkout
     # If there are also submodules, recurse into them,
     if [ ${recurse} -eq 1 ]; then
+        _git submodule foreach --recursive ${GIT} lfs install --local
         _git submodule foreach --recursive ${GIT} lfs fetch
         _git submodule foreach --recursive ${GIT} lfs checkout
     fi