{"thread":{"id":"2729","subject":"[PATCH] unneeded processing in forward_patches() ??","startedAt":"2005-12-02T00:11:41Z","lastAt":"2005-12-02T00:15:13Z","messageCount":2,"participants":["Chuck Lever"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"13080","messageId":"20051202001141.9140.23252.stgit@dexter.citi.umich.edu","threadId":"2729","inReplyTo":null,"subject":"[PATCH] unneeded processing in forward_patches() ??","fromName":"Chuck Lever","fromEmail":"cel@citi.umich.edu","sentAt":"2005-12-02T00:11:41Z","receivedAt":"2005-12-02T00:11:41Z","isPatch":true,"sender":{"key":"cel@citi.umich.edu","avatar":null},"body":"i was wondering why \"stg push\" takes so long to decide not to use\nfast-forward.\n\nit turns out that when forward_patches() has not been able to fast-\nforward any patches, it still does a git.switch() and rewrites the\nunapplied file even though nothing has changed.  on a big working\ndirectory, this 'no-op' can take a while.\n\nfollowing is a simple patch that addresses the problem.  does this appear\nto be a reasonable optimization (in terms of correctness)?\n\n        -- Chuck Lever\n--\ncorporate:    <cel at netapp dot com>\npersonal:     <chucklever at bigfoot dot com>\n"},{"id":"13081","messageId":"20051202001513.9140.14792.stgit@dexter.citi.umich.edu","threadId":"2729","inReplyTo":"20051202001141.9140.23252.stgit@dexter.citi.umich.edu","subject":"[PATCH] Fast-forwarding does a git.switch() even when it forwarded no patches","fromName":"Chuck Lever","fromEmail":"cel@netapp.com","sentAt":"2005-12-02T00:15:13Z","receivedAt":"2005-12-02T00:15:13Z","isPatch":true,"sender":{"key":"cel@netapp.com","avatar":null},"body":"The git.switch() in forward_patches() is not needed when no patches have\nbeen fast forwarded.  This is a significant speed up.\n\nSigned-off-by: Chuck Lever <cel@netapp.com>\n---\n\n stgit/stack.py |    3 +++\n 1 files changed, 3 insertions(+), 0 deletions(-)\n\ndiff --git a/stgit/stack.py b/stgit/stack.py\nindex 3fd6a46..3cc37c5 100644\n--- a/stgit/stack.py\n+++ b/stgit/stack.py\n@@ -735,6 +735,9 @@ class Series:\n             forwarded+=1\n             unapplied.remove(name)\n \n+        if forwarded == 0:\n+            return 0\n+\n         git.switch(top)\n \n         append_strings(self.__applied_file, names[0:forwarded])\n"}]}