Bug 507049 - Wrong remote sha in prepush hook
Summary: Wrong remote sha in prepush hook
Status: NEW
Alias: None
Product: JGit
Classification: Technology
Component: JGit (show other bugs)
Version: 4.5   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-04 10:27 EDT by Jeremy Soumagne CLA
Modified: 2016-11-04 10:27 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jeremy Soumagne CLA 2016-11-04 10:27:03 EDT
The pre-psuh hook STDIN <remote SHA-1> argument is always NULL_COMMIT even if the foreign ref exist.

From Git documentation:
-----------------------------
Information about what is to be pushed is provided on the hook’s standard input with lines of the form:

<local ref> SP <local sha1> SP <remote ref> SP <remote sha1> LF

although the full, 40-character SHA-1s would be supplied. If the foreign ref does not yet exist the <remote SHA-1> will be 40 0. If a ref is to be deleted, the <local ref> will be supplied as (delete) and the <local SHA-1> will be 40 0. If the local commit was specified by something other than a name which could be expanded (such as HEAD~, or a SHA-1) it will be supplied as it was originally given.

In JGIT
-----------
I always get 40 0 for the <remote SHA-1> argument even when the foreign remote exists