This repository was archived by the owner on Dec 15, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 151
This repository was archived by the owner on Dec 15, 2020. It is now read-only.
Incorrect topological sorting #52
Copy link
Copy link
Open
Description
Enountered an issue with Topological log rendering by latest version of ngit sources, built in VS 2010.
Given a simple history of two merged branches:
$ git log --graph --oneline
* ba81db5 Merge branch 'new'
|\
| * 7f032bd Commit #5
| * fe2dd30 Commit #3
* | efda135 Commit #4
* | 116839d Commit #2
|/
* 089e538 commit #1
I'm trying to render it in the same way using NGit using the following code:
class Program
{
static void Main(string[] args)
{
var r = new FileRepository(@"D:\temp\_git\.git");
var headId = r.Resolve(Constants.HEAD);
var rw = new RevWalk(r);
rw.Sort(RevSort.TOPO);
rw.MarkStart(rw.LookupCommit(headId));
RevCommit c;
while((c = rw.Next()) != null)
{
Console.WriteLine("{0}, {2}, {1}", c.Abbreviate(8).Name, c.GetShortMessage(), UnixTimeStampToDateTime(c.CommitTime));
}
}
public static DateTime UnixTimeStampToDateTime(double unixTimeStamp)
{
// Unix timestamp is seconds past epoch
var dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0);
dtDateTime = dtDateTime.AddSeconds(unixTimeStamp).ToLocalTime();
return dtDateTime;
}
}Which unexpectedly gives me commit-time ordering.
ba81db55, 3/8/2013 1:16:54 PM, Merge branch 'new'
7f032bdc, 3/8/2013 1:16:05 PM, Commit #5
efda135c, 3/8/2013 1:15:29 PM, Commit #4
fe2dd30d, 3/8/2013 1:14:58 PM, Commit #3
116839d4, 3/8/2013 1:13:52 PM, Commit #2
089e5381, 3/8/2013 1:12:54 PM, commit #1
Probably there is a known issue - anyway, please let me know if it would be fixed. (I'm going to use ngit for some automation, but topo-order is critical to me).
Metadata
Metadata
Assignees
Labels
No labels