Bug 546567 - pre-push hook is executed if dry-run is true that executes git-lfs push to early
Summary: pre-push hook is executed if dry-run is true that executes git-lfs push to early
Status: RESOLVED FIXED
Alias: None
Product: JGit
Classification: Technology
Component: JGit (show other bugs)
Version: 5.3   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 6.2   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-04-18 10:55 EDT by Andre Bossert CLA
Modified: 2022-03-23 19:10 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andre Bossert CLA 2019-04-18 10:55:30 EDT
pre-push hook is executed always and in case of dry-run and git-lfs push it tranfers binary data to LFS server. In case of Eclipse (EGit) this cannot be aborted and binary data always is sent.

If we skip pre-push hook in case of Transporet.isDryRun() is true, than it will not execute other not LFS related pre-push hook too. How can we do it only for LFS related hook?
Comment 1 Thomas Wolf CLA 2019-04-24 05:05:45 EDT
I think you'd get the same problem with command-line git on git push --dry-run. Compare https://github.com/git-lfs/git-lfs/issues/3418 .

On the command-line, one could do git push --dry-run --no-verify.

JGit's Transport.java has no support for an equivalent of --no-verify.

But maybe here the hook specification of git is broken. The information about whether a certain command is being dry-run should be passed on to hooks (maybe as an optional command-line parameter, or via an environment variable) so that a hook could do whatever was appropriate.
Comment 2 Andre Bossert CLA 2019-04-24 07:27:21 EDT
Yes, you are right: the native "git push --dry-run" also executes the Git LFS hook and it transfers the data.

I thought also of the way how to call pre-hook with the information we have a dry run, but did not found any possibility. Here Git have to be extended...
Comment 3 Eclipse Genie CLA 2022-03-15 17:14:21 EDT
New Gerrit change created: https://git.eclipse.org/r/c/jgit/jgit/+/191930