Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] LFS

Hi All :)

I'm tinkering with LFS support. Quite a lot is working so far (I honestly did not do very much to get this running). The major thing that’s missing from my POV is pre-push hook support for a builtin LFS pre-push. Now my question is: what would be the best approach to implement this, without introducing too many hacks.

I'd of course like to detect the native git-lfs pre-push and don't execute it, but rather execute the built-in hook. On the other hand I would rather not implement some string magic that is bound to fail once git-lfs commands would change or something like that... (?).

IMHO the most simple (stupid) approach would be to override the doRun method in PrePushHook and do something more intelligent if a lfs pre-push hook is detected, but as I said, I fear that this solution is too stupid :)

Any advice?

On another note, because most of you have at least some knowledge of Gerrit (looking at you Shawn ;)): is there any way to improve diff support for LFS tracked files? Somehow Gerrit fails with internal error as long as a change is not merged. Once it is merged, the LFS markers are diffed, instead of the file contents. I'm using the LFS plugins and the FS backend in my case, if that is important. Gerrit is some 2.14 snapshot.

Cheers,
Markus

-----Original Message-----
From: Shawn Pearce [mailto:spearce@xxxxxxxxxxx]
Sent: Thursday, September 28, 2017 5:35 PM
To: Duft Markus <Markus.Duft@xxxxxxxxxxxxxxxx>
Cc: JGit Developers list (jgit-dev@xxxxxxxxxxx) <jgit-dev@xxxxxxxxxxx>
Subject: Re: [jgit-dev] LFS

On Thu, Sep 28, 2017 at 2:06 AM, Duft Markus
<Markus.Duft@xxxxxxxxxxxxxxxx> wrote:
>
> I know that SAP lost interest in LFS – but I did not ;) I picked up this
> commit: https://git.eclipse.org/r/#/c/83506/9 and rebased to somewhere on
> 4.8.1 which we are using. I then registered the filters in EGit Activator
> something like done in https://git.eclipse.org/r/#/c/76591/3
>
>
>
> I also managed to setup a test repo with this .gitattributes:
>
>
>
> $ cat .gitattributes
>
> *.lfs.txt filter=lfs diff=lfs merge=lfs -text
>
>
>
> And this .git/config:
>
>
>
> $ cat .git/config
>
> [core]
>
>                 repositoryformatversion = 0
>
>                 filemode = true
>
>                 logallrefupdates = true
>
> [filter "lfs"]
>
>                 clean = jgit://builtin/lfs/clean
>
>                 smudge = jgit://builtin/lfs/smudge
>
>                 required = true
>
>
>
> I successfully test local commits, and verified that the LFS pointers are
> the actual git objects as expected.
>
>
>
> There are couple of questions for me now:
>
>
>
> ·         Apart from the mentioned two commits, is there anything “big”
> open? Or is it just finalization of what’s there? For instance I cannot see
> any “upload” code? Where would that go?
>
> ·         It seems the repository is now no longer usable with CGIT (“error:
> external filter jgit://builtin/lfs/clean failed”). Is there a way to make a
> repository usable with CGIT and JGIT?

The filter name strings you configure in .git/config must be identical
between the two systems. That means you should configure the filter
name string for git-core and then JGit needs to recognize that name
specially, and swap in its logic instead of launching that command.

SSI Schäfer IT Solutions GmbH | Friesachstrasse 15 | 8114 Friesach | Austria
Registered Office: Friesach | Commercial Register: 49324 K | VAT no. ATU28654300
Commercial Court: Landesgericht für Zivilrechtssachen Graz

Back to the top