Compare branches, commits and tags with each other (#6991)
* Supports tags when comparing commits or branches Signed-off-by: Mario Lubenka <[email protected]> * Hide headline when only comparing and don't load unused data Signed-off-by: Mario Lubenka <[email protected]> * Merges compare logics to allow comparing branches, commits and tags with eachother Signed-off-by: Mario Lubenka <[email protected]> * Display branch or tag instead of commit when used for comparing Signed-off-by: Mario Lubenka <[email protected]> * Show pull request form after click on button Signed-off-by: Mario Lubenka <[email protected]> * Transfers relevant pull.go changes from master to compare.go Signed-off-by: Mario Lubenka <[email protected]> * Fixes error when comparing forks against a commit or tag Signed-off-by: Mario Lubenka <[email protected]> * Removes console.log from JavaScript file Signed-off-by: Mario Lubenka <[email protected]> * Show icon next to commit reference when comparing branch or tag Signed-off-by: Mario Lubenka <[email protected]> * Updates css file Signed-off-by: Mario Lubenka <[email protected]> * Fixes import order * Renames template variable * Update routers/repo/compare.go Co-Authored-By: zeripath <[email protected]> * Update from master Signed-off-by: Mario Lubenka <[email protected]> * Allow short-shas in compare * Renames prInfo to compareInfo Signed-off-by: Mario Lubenka <[email protected]> * Check PR permissions only if compare is pull request Signed-off-by: Mario Lubenka <[email protected]> * Adjusts comment Signed-off-by: Mario Lubenka <[email protected]> * Use compareInfo instead of prInfo
This commit is contained in:
committed by
techknowlogick
parent
bd55f6ff36
commit
311ce2d1d0
@@ -27,6 +27,16 @@ func (repo *Repository) GetRefCommitID(name string) (string, error) {
|
||||
return ref.Hash().String(), nil
|
||||
}
|
||||
|
||||
// IsCommitExist returns true if given commit exists in current repository.
|
||||
func (repo *Repository) IsCommitExist(name string) bool {
|
||||
hash := plumbing.NewHash(name)
|
||||
_, err := repo.gogitRepo.CommitObject(hash)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// GetBranchCommitID returns last commit ID string of given branch.
|
||||
func (repo *Repository) GetBranchCommitID(name string) (string, error) {
|
||||
return repo.GetRefCommitID(BranchPrefix + name)
|
||||
|
||||
Reference in New Issue
Block a user