Browse Source
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>next
Yunjie Li
5 years ago
committed by
Jonathan Nieder
5 changed files with 45 additions and 33 deletions
Loading…
Reference in new issue