On Mon, Jun 15, 2009 at 22:45, Marco Costalba<mcostalba@xxxxxxxxx> wrote: > On Mon, Jun 15, 2009 at 22:25, Marco Costalba<mcostalba@xxxxxxxxx> wrote: >> >> This is really strange ! >> > I have prepared a possible patch, could you please test if fixes the problem for you. Patch is in attachment. Thanks Marco
From 8e4ac4bf9b6c04b09e16a2a49b96f6bf4c75d2e7 Mon Sep 17 00:00:00 2001 From: Marco Costalba <mcostalba@xxxxxxxxx> Date: Mon, 15 Jun 2009 23:01:42 +0100 Subject: [PATCH] Fix format patch bad selected revision order We cannot trust the order of selected items returned by QItemSelectionModel::selectedRows() that is used to call git format-patch. It is not documented and could change with a new version of Qt libraries. So manually reorder the selected revisions before to feed git format-patch. Signed-off-by: Marco Costalba <mcostalba@xxxxxxxxx> --- src/git.cpp | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/git.cpp b/src/git.cpp index 8546f6f..d55d1c2 100644 --- a/src/git.cpp +++ b/src/git.cpp @@ -1577,9 +1577,18 @@ bool Git::formatPatch(SCList shaList, SCRef dirPath, SCRef remoteDir) { if (remote) workDir = remoteDir; // run() uses workDir value - // shaList is ordered by newest to oldest - runCmd.append(" " + shaList.last()); - runCmd.append(QString::fromLatin1("^..") + shaList.first()); + // Don't trust shaList order but reorder from newest to oldest + QStringList orderedShaList; + FOREACH_SL (it, shaList) + appendNamesWithId(orderedShaList, *it, QStringList(*it), true); + + orderedShaList.sort(); + QStringList::iterator itN(orderedShaList.begin()); + for ( ; itN != orderedShaList.end(); ++itN) // strip 'idx' + (*itN) = (*itN).section(' ', -1, -1); + + runCmd.append(" " + orderedShaList.last()); + runCmd.append(QString::fromLatin1("^..") + orderedShaList.first()); bool ret = run(runCmd); workDir = tmp; return ret; -- 1.6.1.9.g97c34