From 630876f9e4910a4c91705c6cc98414123547419a Mon Sep 17 00:00:00 2001 From: XD Trol Date: Mon, 17 Jan 2022 23:29:04 +0800 Subject: init: add an option --enable-git-lfs-filter It was reported that git-lfs did not work with git-repo. Specifically, `git read-tree -u` run by `repo sync` would fail git-lfs's smudge filter. See https://github.com/github/git-lfs/issues/1422. In fact, by the time `git read-tree -u` is run, the repository is not bare. It is just that, the working directory is not the same as the .git directory. git-lfs's filter should work. No one seems to have delved into that issue. Today, with newer versions of git-repo and git-lfs, that issue will not reproduce. Tested with - git 2.33, git-lfs 2.13 on macOS - git 2.17, git-lfs 2.3 on ubuntu So, it seems fine to add an option --enable-git-lfs-filter, default to false, and stat that it may not work with older versions of git and git-lfs in the help doc. Bug: https://crbug.com/gerrit/14516 Change-Id: I8d21854eeeea541e072f63d6b10ad1253b1a9826 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/328359 Tested-by: XD Trol Reviewed-by: Mike Frysinger --- subcmds/init.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'subcmds/init.py') diff --git a/subcmds/init.py b/subcmds/init.py index b0db76a4..32c85f79 100644 --- a/subcmds/init.py +++ b/subcmds/init.py @@ -291,6 +291,15 @@ to update the working directory files. if opt.submodules: m.config.SetBoolean('repo.submodules', opt.submodules) + if opt.git_lfs is not None: + if opt.git_lfs: + git_require((2, 17, 0), fail=True, msg='Git LFS support') + + m.config.SetBoolean('repo.git-lfs', opt.git_lfs) + if not is_new: + print('warning: Changing --git-lfs settings will only affect new project checkouts.\n' + ' Existing projects will require manual updates.\n', file=sys.stderr) + if opt.use_superproject is not None: m.config.SetBoolean('repo.superproject', opt.use_superproject) -- cgit v1.2.3-54-g00ecf