diff options
author | Yunjie Li <yunjieli@google.com> | 2019-08-15 10:39:25 -0700 |
---|---|---|
committer | Jonathan Nieder <jrn@google.com> | 2019-09-06 12:18:17 -0700 |
commit | ea9231b39df100fa467282150ccef2994f1ef335 (patch) | |
tree | 966d8c617332408cc8904a6dd1b68278a1cc252f /org.eclipse.jgit.lfs.server.test | |
parent | 05f27122dc2cd90ce37c6e336a8c92c5f6b2773e (diff) | |
download | jgit-ea9231b39df100fa467282150ccef2994f1ef335.tar.gz jgit-ea9231b39df100fa467282150ccef2994f1ef335.zip |
ReceivePack: Prevent pointing a branch to a non-commit object
Since commit c3b0dec509fe136c5417422f31898b5a4e2d5e02, Git has
disallowed writing a non-commit to refs/heads/* refs. JGit still
allows that, which can put users in a bad situation. For example,
git push origin v1.0:master
pushes the tag object v1.0 to refs/heads/master, instead of the
intended commit object v1.0^{commit}.
Prevent that by validating that the target of the ref points to a
commit object when pushing to refs/heads/*.
Git performs the same check at a lower level (in the RefDatabase). We
could do the same here, but for now let's start conservatively by
handling it in pushes first.
[jn: fleshed out commit message]
Change-Id: I8f98ae6d8acbcd5ef7553ec732bc096cb6eb7c4e
Signed-off-by: Yunjie Li <yunjieli@google.com>
Signed-off-by: Jonathan Nieder <jrn@google.com>
Diffstat (limited to 'org.eclipse.jgit.lfs.server.test')
0 files changed, 0 insertions, 0 deletions