Author: stsp
Date: Tue May 7 13:16:39 2013
New Revision: 1479896
URL: http://svn.apache.org/r1479896
Log:
* subversion/svnlook/svnlook.c
(print_tree): Sort directory entries to provide stable output even with
unstable APR hash order.
Found by: Ursula Schädel
Modified:
subversion/trunk/subversion/svnlook/svnlook.c
Modified: subversion/trunk/subversion/svnlook/svnlook.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/svnlook/svnlook.c?rev=1479896&r1=1479895&r2=1479896&view=diff
==============================================================================
--- subversion/trunk/subversion/svnlook/svnlook.c (original)
+++ subversion/trunk/subversion/svnlook/svnlook.c Tue May 7 13:16:39 2013
@@ -47,6 +47,7 @@
#include "svn_time.h"
#include "svn_utf.h"
#include "svn_subst.h"
+#include "svn_sorts.h"
#include "svn_opt.h"
#include "svn_props.h"
#include "svn_diff.h"
@@ -1167,7 +1168,6 @@ print_tree(svn_fs_root_t *root,
{
apr_pool_t *subpool;
apr_hash_t *entries;
- apr_hash_index_t *hi;
const char* name;
SVN_ERR(check_cancel(NULL));
@@ -1215,11 +1215,18 @@ print_tree(svn_fs_root_t *root,
/* Recursively handle the node's children. */
if (recurse || (indentation == 0))
{
+ apr_array_header_t *sorted_entries;
+ int i;
+
SVN_ERR(svn_fs_dir_entries(&entries, root, path, pool));
subpool = svn_pool_create(pool);
- for (hi = apr_hash_first(pool, entries); hi; hi = apr_hash_next(hi))
- {
- svn_fs_dirent_t *entry = svn__apr_hash_index_val(hi);
+ sorted_entries = svn_sort__hash(entries,
+ svn_sort_compare_items_lexically, pool);
+ for (i = 0; i < sorted_entries->nelts; i++)
+ {
+ svn_sort__item_t item = APR_ARRAY_IDX(sorted_entries, i,
+ svn_sort__item_t);
+ svn_fs_dirent_t *entry = item.value;
svn_pool_clear(subpool);
SVN_ERR(print_tree(root,