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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to