repo.Commits.QueryBy(<path>) doesn't return entire history of changing commits
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Inizia riproducendo il repository di esempio ed eseguendo il codice repo.Commits.QueryBy(filePath) mostrato nell’issue sull’intera cronologia di repo.Commits. Esamina il punto di ingresso CommitLog.QueryBy e confronta il modo in cui vengono gestiti i commit di merge. Il lavoro è completato quando si determina se il commit di merge di Iteration 4 debba apparire e si corregge il comportamento oppure si documenta il risultato previsto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I was playing around with using CommitLog.QueryBy() to obtain the history of a specific file, and I am not clear if I'm using the feature correctly, but not getting the output I would expect.
Specifically, in a sample repo with 5 commits where each commit changes the same file, .QueryBy() appears to omit the commit that is merging and changing the file.
Is it possible this is by design, and the merge change in Iteration 4 is being purposefully omitted, or might this be a bug?
Here's the output of my sample program:
History of sample.txt has 4 entries:
- 742d4c5d1fa8c8b4f3fd6894580cb33e7a3ab4e0: Iteration 5
- 0cbfdb9a0f98ef3e62ba9e8f2d5dd6ef9bd755f6: Iteration 2
- 59947c86d20f45b6f19dfd52dcbc4c4b23fc4d16: Iteration 3
- 020323b5bc36f931442343df6aa0557e8d20581f: Iteration 1
Commit history has 5 entries:
- 742d4c5d1fa8c8b4f3fd6894580cb33e7a3ab4e0: Iteration 5
- d096877e0d40c0a002e73c308a50d94d6ffbcb67: Iteration 4
- 0cbfdb9a0f98ef3e62ba9e8f2d5dd6ef9bd755f6: Iteration 2
- 59947c86d20f45b6f19dfd52dcbc4c4b23fc4d16: Iteration 3
- 020323b5bc36f931442343df6aa0557e8d20581f: Iteration 1
Here's the code that i'm running against a sample repo (see below):
using LibGit2Sharp;
using System;
using System.Linq;
namespace ConsoleApplication2
{
class Program
{
// This program is compiled against:
// - LibGit2Sharp v0.23.0
// - Native binaries v1.0.129
static void Main(string[] args)
{
var repo = new Repository(Repository.Discover(Environment.CurrentDirectory));
var filePath = "sample.txt";
// Look at the history of sample.txt
var fileHist = repo.Commits.QueryBy(filePath).Select(x => x.Commit).ToList();
Console.WriteLine("History of {0} has {1} entries:", filePath, fileHist.Count);
foreach (var commit in fileHist)
Console.WriteLine(" - {0}: {1}", commit.Sha, commit.MessageShort);
// Look at the entire history
var fullHist = repo.Commits.ToList();
Console.WriteLine("Commit history has {1} entries:", filePath, fullHist.Count);
foreach (var commit in fullHist)
Console.WriteLine(" - {0}: {1}", commit.Sha, commit.MessageShort);
}
}
}
Here's the script to create a sample git repo that has a diamond pattern of commits around a file:
@REM create a git repo with a single file
git init
echo 1 > sample.txt
git add sample.txt
git commit -m "Iteration 1"
@REM create a branch and make a change
git checkout -b "branch"
echo 2 >> sample.txt
git commit -a -m "Iteration 2"
@REM make a change on the master
git checkout master
echo 3 >> sample.txt
git commit -a -m "Iteration 3"
@REM merge branch into master and overwrite conflict
git merge branch
echo 1 > sample.txt
echo 2 >> sample.txt
echo 3 >> sample.txt
echo 4 >> sample.txt
git commit -a -m "Iteration 4"
@REM one last change for good measure
echo 5 >> sample.txt
git commit -a -m "Iteration 5"
- Lingua principale
- C#
- Stelle
- 3.5k
- Fork
- 925
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di libgit2/libgit2sharp
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 52/100
libgit2/libgit2sharp#2193 · 2 commenti ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 38/100
libgit2/libgit2sharp#2192 · 1 commento ·
-
Website is down Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 20/100
libgit2/libgit2sharp#2191 · 2 reazioni ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
libgit2/libgit2sharp#2189 · 1 reazione ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
libgit2/libgit2sharp#2187 · 2 commenti ·
Tutte le issue di libgit2/libgit2sharp
Issue simili
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
sillsdev/languageforge-lexbox#2665 ·
-
bug documentation frontend
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
azurenoops/spin_agent#975 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
-
:watch: Not Triaged 11.0 fundamentals/subsvc
Difficoltà 2/5 1-3 ore Idoneità per principianti 92/100
dotnet/AspNetCore.Docs#37699 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
SubtitleEdit/subtitleedit#15108 · 1 commento ·