]> source.dussan.org Git - jgit.git/commit
Make PrePushHook properly terminate ref lines 90/130990/5
authorMarkus Keller <markus.kell.r@gmail.com>
Tue, 16 Oct 2018 14:25:56 +0000 (16:25 +0200)
committerMatthias Sohn <matthias.sohn@sap.com>
Sun, 21 Oct 2018 21:07:58 +0000 (17:07 -0400)
commit8420c729a0a8b55b5a9c9eae1064a2333de7d188
treea9da61959040c76c41714a722838273ee8154bac
parente4fdc571c9bb9fbc7abb7d936d299186a25fd2eb
Make PrePushHook properly terminate ref lines

All of the input lines passed to pre-push hook scripts must be properly
terminated by '\n', so that normal shell scripts like the git-supplied
pre-push.sample work properly, even when pushing just a single branch.

With the old code, hook scripts that use the following pattern didn't
process the last line, because 'read' has a non-zero exit status when
EOF is encountered:
  while read local_ref local_sha remote_ref remote_sha; do ... done

Change-Id: Id899662ed3fedef6c314fc4b2ddf91a6dcb98cbb
Signed-off-by: Markus Keller <markus.kell.r@gmail.com>
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PushCommandTest.java
org.eclipse.jgit/src/org/eclipse/jgit/hooks/PrePushHook.java