Repository navigation
Conversation
this change improves drastically pre-push behaviour, by not sending
lfs objects which are already on a remote. Works perfectly with
pushing new branches and tags.
currently pre-push command analyse "local sha1" vs "remote sha1" of the
ref being pushed and if "remote sha1" is available locally tries to send
only lfs objects introduced with new commits.
why this is broken:
- remote branch might have moved forward (local repo is not up to date).
In this case you have no chance to isolate new lfs objects ("remote sha1"
does not exist locally) and git-lfs sends everything from the local
branch history.
- remote branch does not exist (or new tag is pushed). Same consequences.
But what is important - local repository always have remote references,
from which user created his local branch and started making some local
changes. So, all we have to do is to identify new lfs objects which do
not exist on remote references. And all this can be easily achieved with
the same all mighty git rev-list command.
This change makes git-lfs usable with gerrit, where changes are uploaded
by using magic gerrit branches which does not really exist. i.e.
git push origin master:refs/for/master
in this case "refs/for/master" does not exist and git feeds all 0-s as
"remote sha1".
There was a problem hiding this comment.
I'm using just "--remotes" here. Another option would be to use --remotes=<remote_name_from_pre-push_arg_1>. But since we only have one git-lfs server and single lfs.url configuration option, it is safe to assume that the same git lfs server is used for all remotes. So, we can do a better jobs isolating only lfs objects introduced locally.
There was a problem hiding this comment.
But since we only have one git-lfs server and single lfs.url configuration option, it is safe to assume that the same git lfs server is used for all remotes. So, we can do a better jobs isolating only lfs objects introduced locally.
Not necessarily. You can also configure an lfs server at remote.{name}.lfsurl. Ideally, each git host has its own lfs host too that's automatically configured. It should be easy to push and pull between different git hosts.
There is one big issue with this right now. Git doesn't tell us what remote we should be using in the smudge or post-checkout hooks. So pulling from a non-origin remote doesn't quite work.
There was a problem hiding this comment.
ok, here is the change which makes use of current remote only: #578
I'll be happy with either of those 2.
I was thinking that perhaps the
I agree the pre-push should be specific about what remote it's comparing with. |
|
I've submitted PR #583 to implement the remote arguments & refinement to the default remote. |
|
superseded by #578 |
this change improves drastically pre-push behaviour, by not sending
lfs objects which are already on a remote. Works perfectly with
pushing new branches and tags.
currently pre-push command analyse "local sha1" vs "remote sha1" of the
ref being pushed and if "remote sha1" is available locally tries to send
only lfs objects introduced with new commits.
why this is broken:
In this case you have no chance to isolate new lfs objects ("remote sha1"
does not exist locally) and git-lfs sends everything from the local
branch history.
But what is important - local repository always have remote references,
from which user created his local branch and started making some local
changes. So, all we have to do is to identify new lfs objects which do
not exist on remote references. And all this can be easily achieved with
the same all mighty git rev-list command.
This change makes git-lfs usable with gerrit, where changes are uploaded
by using magic gerrit branches which does not really exist. i.e.
git push origin master:refs/for/master
in this case "refs/for/master" does not exist and git feeds all 0-s as
"remote sha1".