git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marco Costalba <mcostalba@gmail.com>
To: markus.heidelberg@web.de
Cc: git@vger.kernel.org
Subject: Re: [PATCH QGit RFC] Fix "Save patch..." on a commit range
Date: Mon, 15 Jun 2009 23:07:07 +0100	[thread overview]
Message-ID: <e5bfff550906151507t3f6ccf39j177f7c39d8495f5a@mail.gmail.com> (raw)
In-Reply-To: <e5bfff550906151445m2f38c3fw964e01251d9568b9@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 312 bytes --]

On Mon, Jun 15, 2009 at 22:45, Marco Costalba<mcostalba@gmail.com> wrote:
> On Mon, Jun 15, 2009 at 22:25, Marco Costalba<mcostalba@gmail.com> 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

[-- Attachment #2: 0001-Fix-format-patch-bad-selected-revision-order.patch --]
[-- Type: text/x-diff, Size: 1623 bytes --]

From 8e4ac4bf9b6c04b09e16a2a49b96f6bf4c75d2e7 Mon Sep 17 00:00:00 2001
From: Marco Costalba <mcostalba@gmail.com>
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@gmail.com>
---
 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


  reply	other threads:[~2009-06-15 22:07 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-12 23:29 [PATCH QGit RFC] Fix "Save patch..." on a commit range Markus Heidelberg
2009-06-13  7:13 ` Marco Costalba
2009-06-13 10:11   ` Markus Heidelberg
2009-06-13 11:02   ` Markus Heidelberg
2009-06-13 11:12     ` Marco Costalba
2009-06-13 11:33       ` Markus Heidelberg
2009-06-13 12:23         ` Marco Costalba
2009-06-15 21:13         ` Markus Heidelberg
2009-06-15 21:25           ` Marco Costalba
2009-06-15 21:45             ` Marco Costalba
2009-06-15 22:07               ` Marco Costalba [this message]
2009-06-15 23:53                 ` Markus Heidelberg
2009-06-16  6:10                   ` Marco Costalba
2009-06-16 18:48                     ` Markus Heidelberg
2009-06-15 23:44               ` Markus Heidelberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e5bfff550906151507t3f6ccf39j177f7c39d8495f5a@mail.gmail.com \
    --to=mcostalba@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=markus.heidelberg@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).