* Odd rev-list behaviour
@ 2015-04-23 23:48 B M Corser
2015-04-24 1:52 ` Jeff King
0 siblings, 1 reply; 2+ messages in thread
From: B M Corser @ 2015-04-23 23:48 UTC (permalink / raw)
To: git
Seeing some weird results out of rev-list, see my demo repo:
https://github.com/bmcorser/rev-list-fail
I was after a one-liner to sort a bunch of commit hashes into
topological (or date) order. The commits were made by a script that
forges the commit time with --date in the hope of seeing stable
results.
Any ideas welcome,
Ben
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Odd rev-list behaviour
2015-04-23 23:48 Odd rev-list behaviour B M Corser
@ 2015-04-24 1:52 ` Jeff King
0 siblings, 0 replies; 2+ messages in thread
From: Jeff King @ 2015-04-24 1:52 UTC (permalink / raw)
To: B M Corser; +Cc: git
On Fri, Apr 24, 2015 at 12:48:43AM +0100, B M Corser wrote:
> Seeing some weird results out of rev-list, see my demo repo:
> https://github.com/bmcorser/rev-list-fail
That repo has a whole bunch of commits with identical committer
timestamps. The default order that git displays those in is going to
depend on the order you provide them in.
> I was after a one-liner to sort a bunch of commit hashes into
> topological (or date) order. The commits were made by a script that
> forges the commit time with --date in the hope of seeing stable
> results.
Using "--date" will just set the author date. You probably want to set
GIT_COMMITTER_DATE in the environment if you are scripting imported
commits from somewhere else (or better yet, consider using
git-fast-import if you have a lot of commits).
Even with identical commit timestamps, we should be able to show the
commits in topo-order. Your README.md shows you trying:
git rev-list --no-walk $(git log --format=%H | shuf)
That is missing any mention of --topo-order, of course. But even adding
that in, it does not seem to work, which is perhaps what you are getting
at. I am not sure whether "--no-walk" plays well with other sorting
options, and that may be the problem.
Is there a reason that just:
git rev-list --topo-order HEAD
does not serve your purpose? It's hard to tell what you're trying to
achieve from this obviously toy repository.
In the meantime, you can also pipe the output of "rev-list" into your
own sort routine, using --format to get whatever information you need
(you can topo-sort with the information from --parents).
-Peff
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-04-24 1:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-23 23:48 Odd rev-list behaviour B M Corser
2015-04-24 1:52 ` Jeff King
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).