Rugged::Repository.merge_base complains when the merge base is a graft

Aperta
#846 1 commento 2 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
c, git, ruby

Direzione di ricerca

Inizia con la riproduzione collegata di libgit2_merge_base e con l’entry point Rugged::Repository.merge_base; riproduci il problema usando lo shallow fetch e il graft merge base descritti qui. Confronta il risultato con git merge-base e verifica che l’errore object-not-found non si verifichi più senza aumentare la shallow depth.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Hello, I have some CI jobs that try to avoid checking out unnecessary commits for merges. They call the GitHub API to see how many commits behind/ahead they are, compared to the base branch, and then fetch the base/merge branch with depth equal to number of commits they are behind/ahead + 1.

When one of the test tools calls Rugged::Repository.merge_base, if the merge base commit is a graft commit (from the shallow fetch), I get an error like:

Traceback (most recent call last):
	1: from show_merge_base.rb:9:in `<main>'
show_merge_base.rb:9:in `merge_base': object not found - no match for id (fab6d6845fe971f1bb15b793c5604ce7aeb0eaa2) (Rugged::OdbError)

where fab6d6845fe971f1bb15b793c5604ce7aeb0eaa2 is the parent of the grafted commit.

I see that git handles it fine :

$ git merge-base HEAD master
6e85c6c9868ba19e1b8c2f41890f02d37d9c8634

Increasing the shallow depth by one prevents the error, but I feel like merge_base shouldn't be looking for commits that aren't needed to calculate the merge base.

I created a repo to make it easier to reproduce the error, and included exact steps: https://github.com/dgholz/libgit2_merge_base

Lingua principale
C
Stelle
2.3k
Fork
293
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di libgit2/rugged

Tutte le issue di libgit2/rugged

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.