{"thread":{"id":"36952","subject":"[PATCH v3 0/5] cleanup duplicate name_compare() functions","startedAt":"2014-06-18T18:45:12Z","lastAt":"2014-06-19T08:54:47Z","messageCount":15,"participants":["Jeremiah Mahler","Jonathan Nieder","Jeff King"],"isPatch":true,"patchVersion":3,"patchTotal":5},"messages":[{"id":"244549","messageId":"1403117117-10384-1-git-send-email-jmmahler@gmail.com","threadId":"36952","inReplyTo":null,"subject":"[PATCH v3 0/5] cleanup duplicate name_compare() functions","fromName":"Jeremiah Mahler","fromEmail":"jmmahler@gmail.com","sentAt":"2014-06-18T18:45:12Z","receivedAt":"2014-06-18T18:45:12Z","isPatch":true,"sender":{"key":"jmmahler@gmail.com","avatar":"https://avatars.githubusercontent.com/u/154028?v=4"},"body":"Version 3 of the patch series to cleanup duplicate name_compare()\nfunctions (previously was 'add strnncmp() function' [1]).  \n\nThis version goes in a slightly different direction than the previous\nversion.  Before I was trying to add a strnncmp() function so I could\nremove duplicate copies of the name_compare() function in tree-walk.c\nand unpack-trees.c.  But then Torsten Bögershausen pointed out that\nthere is a cache_name_compare() function which is nearly identical to\nname_compare() [2]*.\n\n* cache_name_compare() is not identical to name_compare().  The former\n  returns +1, -1, whereas the latter returns +N, -N.  But there is no\n  place where name_compare() was used that needed the magnitude so this\n  change would not alter its behavior.\n\nSo I decided why not generalize the name of cache_name_compare() by\nrenaming it to  name_compare(), since it doesn't do anything with\ncaches, other than being part of cache.h and read-cache.c.  Then the\nduplicate name_compare() functions can be removed and the few places\nthat used cache_name_compare() can be renamed to name_compare().\n\nIt cleans up the code with a minimal number of changes.  It keeps\nexisting functions instead of creating new ones.  And there are several\nother functions in cache.h that are similarly named '*name_compare' so\nit follows the already established style.\n\nAlso, the name_compare() now uses memcmp() as it did originally instead\nof using strncmp() as it did in the last version.\n\n[1]: http://marc.info/?l=git&m=140299051431479&w=2\n\n[2]: http://marc.info/?l=git&m=140300329403706&w=2\n\nJeremiah Mahler (5):\n  cache: rename cache_name_compare() to name_compare()\n  tree-walk.c: remove name_compare() function\n  unpack-trees.c: remove name_compare() function\n  dir.c: rename to name_compare()\n  name-hash.c: rename to name_compare()\n\n cache.h        |  2 +-\n dir.c          |  3 +--\n name-hash.c    |  2 +-\n read-cache.c   | 23 +++++++++++++----------\n tree-walk.c    | 10 ----------\n unpack-trees.c | 11 -----------\n 6 files changed, 16 insertions(+), 35 deletions(-)\n\n-- \n2.0.0\n"},{"id":"244550","messageId":"1403117117-10384-2-git-send-email-jmmahler@gmail.com","threadId":"36952","inReplyTo":"1403117117-10384-1-git-send-email-jmmahler@gmail.com","subject":"[PATCH v3 1/5] cache: rename cache_name_compare() to name_compare()","fromName":"Jeremiah Mahler","fromEmail":"jmmahler@gmail.com","sentAt":"2014-06-18T18:45:13Z","receivedAt":"2014-06-18T18:45:13Z","isPatch":true,"sender":{"key":"jmmahler@gmail.com","avatar":"https://avatars.githubusercontent.com/u/154028?v=4"},"body":"The cache_name_compare() function is not specific to a cache.\nMake its name more general by renaming it to name_compare().\n\nSimplify cache_name_stage_compare() via name_compare().\nWhere lengths are involved, change int to size_t.\n\nSigned-off-by: Jeremiah Mahler <jmmahler@gmail.com>\n---\n cache.h      |  2 +-\n read-cache.c | 23 +++++++++++++----------\n 2 files changed, 14 insertions(+), 11 deletions(-)\n\ndiff --git a/cache.h b/cache.h\nindex c498a30..e3205fe 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -1027,7 +1027,7 @@ extern int validate_headref(const char *ref);\n \n extern int base_name_compare(const char *name1, int len1, int mode1, const char *name2, int len2, int mode2);\n extern int df_name_compare(const char *name1, int len1, int mode1, const char *name2, int len2, int mode2);\n-extern int cache_name_compare(const char *name1, int len1, const char *name2, int len2);\n+extern int name_compare(const char *name1, size_t len1, const char *name2, size_t len2);\n extern int cache_name_stage_compare(const char *name1, int len1, int stage1, const char *name2, int len2, int stage2);\n \n extern void *read_object_with_reference(const unsigned char *sha1,\ndiff --git a/read-cache.c b/read-cache.c\nindex 9f56d76..158241d 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -434,18 +434,26 @@ int df_name_compare(const char *name1, int len1, int mode1,\n \treturn c1 - c2;\n }\n \n-int cache_name_stage_compare(const char *name1, int len1, int stage1, const char *name2, int len2, int stage2)\n+int name_compare(const char *name1, size_t len1, const char *name2, size_t len2)\n {\n-\tint len = len1 < len2 ? len1 : len2;\n-\tint cmp;\n-\n-\tcmp = memcmp(name1, name2, len);\n+\tsize_t min_len = (len1 < len2) ? len1 : len2;\n+\tint cmp = memcmp(name1, name2, min_len);\n \tif (cmp)\n \t\treturn cmp;\n \tif (len1 < len2)\n \t\treturn -1;\n \tif (len1 > len2)\n \t\treturn 1;\n+\treturn 0;\n+}\n+\n+int cache_name_stage_compare(const char *name1, int len1, int stage1, const char *name2, int len2, int stage2)\n+{\n+\tint cmp;\n+\n+\tcmp = name_compare(name1, len1, name2, len2);\n+\tif (cmp)\n+\t\treturn cmp;\n \n \tif (stage1 < stage2)\n \t\treturn -1;\n@@ -454,11 +462,6 @@ int cache_name_stage_compare(const char *name1, int len1, int stage1, const char\n \treturn 0;\n }\n \n-int cache_name_compare(const char *name1, int len1, const char *name2, int len2)\n-{\n-\treturn cache_name_stage_compare(name1, len1, 0, name2, len2, 0);\n-}\n-\n static int index_name_stage_pos(const struct index_state *istate, const char *name, int namelen, int stage)\n {\n \tint first, last;\n-- \n2.0.0\n"},{"id":"244554","messageId":"1403117117-10384-3-git-send-email-jmmahler@gmail.com","threadId":"36952","inReplyTo":"1403117117-10384-1-git-send-email-jmmahler@gmail.com","subject":"[PATCH v3 2/5] tree-walk.c: remove name_compare() function","fromName":"Jeremiah Mahler","fromEmail":"jmmahler@gmail.com","sentAt":"2014-06-18T18:45:14Z","receivedAt":"2014-06-18T18:45:14Z","isPatch":true,"sender":{"key":"jmmahler@gmail.com","avatar":"https://avatars.githubusercontent.com/u/154028?v=4"},"body":"Remove the duplicate name_compare() function and use the one provided by\nread-cache.c.\n\nSigned-off-by: Jeremiah Mahler <jmmahler@gmail.com>\n---\n\nNotes:\n    There is one small difference between the old function and the new one.\n    The old one returned -N and +N whereas the new one returns -1 and +1.\n    However, there is no place where the magnitude was needed, so this\n    change will not alter its behavior.\n\n tree-walk.c | 10 ----------\n 1 file changed, 10 deletions(-)\n\ndiff --git a/tree-walk.c b/tree-walk.c\nindex 4dc86c7..5dd9a71 100644\n--- a/tree-walk.c\n+++ b/tree-walk.c\n@@ -144,16 +144,6 @@ struct tree_desc_x {\n \tstruct tree_desc_skip *skip;\n };\n \n-static int name_compare(const char *a, int a_len,\n-\t\t\tconst char *b, int b_len)\n-{\n-\tint len = (a_len < b_len) ? a_len : b_len;\n-\tint cmp = memcmp(a, b, len);\n-\tif (cmp)\n-\t\treturn cmp;\n-\treturn (a_len - b_len);\n-}\n-\n static int check_entry_match(const char *a, int a_len, const char *b, int b_len)\n {\n \t/*\n-- \n2.0.0\n"},{"id":"244553","messageId":"1403117117-10384-4-git-send-email-jmmahler@gmail.com","threadId":"36952","inReplyTo":"1403117117-10384-1-git-send-email-jmmahler@gmail.com","subject":"[PATCH v3 3/5] unpack-trees.c: remove name_compare() function","fromName":"Jeremiah Mahler","fromEmail":"jmmahler@gmail.com","sentAt":"2014-06-18T18:45:15Z","receivedAt":"2014-06-18T18:45:15Z","isPatch":true,"sender":{"key":"jmmahler@gmail.com","avatar":"https://avatars.githubusercontent.com/u/154028?v=4"},"body":"Remove the duplicate name_compare() function and use the one provided by\nread-cache.c.\n\nSigned-off-by: Jeremiah Mahler <jmmahler@gmail.com>\n---\n\nNotes:\n    There is one small difference between the old function and the new one.\n    The old one returned -N and +N whereas the new one returns -1 and +1.\n    However, there is no place where the magnitude was needed, so this\n    change will not alter its behavior.\n\n unpack-trees.c | 11 -----------\n 1 file changed, 11 deletions(-)\n\ndiff --git a/unpack-trees.c b/unpack-trees.c\nindex 4a9cdf2..c4a97ca 100644\n--- a/unpack-trees.c\n+++ b/unpack-trees.c\n@@ -629,17 +629,6 @@ static int unpack_failed(struct unpack_trees_options *o, const char *message)\n \treturn -1;\n }\n \n-/* NEEDSWORK: give this a better name and share with tree-walk.c */\n-static int name_compare(const char *a, int a_len,\n-\t\t\tconst char *b, int b_len)\n-{\n-\tint len = (a_len < b_len) ? a_len : b_len;\n-\tint cmp = memcmp(a, b, len);\n-\tif (cmp)\n-\t\treturn cmp;\n-\treturn (a_len - b_len);\n-}\n-\n /*\n  * The tree traversal is looking at name p.  If we have a matching entry,\n  * return it.  If name p is a directory in the index, do not return\n-- \n2.0.0\n"},{"id":"244551","messageId":"1403117117-10384-5-git-send-email-jmmahler@gmail.com","threadId":"36952","inReplyTo":"1403117117-10384-1-git-send-email-jmmahler@gmail.com","subject":"[PATCH v3 4/5] dir.c: rename to name_compare()","fromName":"Jeremiah Mahler","fromEmail":"jmmahler@gmail.com","sentAt":"2014-06-18T18:45:16Z","receivedAt":"2014-06-18T18:45:16Z","isPatch":true,"sender":{"key":"jmmahler@gmail.com","avatar":"https://avatars.githubusercontent.com/u/154028?v=4"},"body":"Rename the call to cache_name_compare() to name_compare().\n\nSigned-off-by: Jeremiah Mahler <jmmahler@gmail.com>\n---\n\nNotes:\n    This is a case where cache_name_compare() was used even though it had\n    nothing to do with a cache.  The new name makes it clear that no cache\n    is involved.\n\n dir.c | 3 +--\n 1 file changed, 1 insertion(+), 2 deletions(-)\n\ndiff --git a/dir.c b/dir.c\nindex 797805d..e65888d 100644\n--- a/dir.c\n+++ b/dir.c\n@@ -1354,8 +1354,7 @@ static int cmp_name(const void *p1, const void *p2)\n \tconst struct dir_entry *e1 = *(const struct dir_entry **)p1;\n \tconst struct dir_entry *e2 = *(const struct dir_entry **)p2;\n \n-\treturn cache_name_compare(e1->name, e1->len,\n-\t\t\t\t  e2->name, e2->len);\n+\treturn name_compare(e1->name, e1->len, e2->name, e2->len);\n }\n \n static struct path_simplify *create_simplify(const char **pathspec)\n-- \n2.0.0\n"},{"id":"244552","messageId":"1403117117-10384-6-git-send-email-jmmahler@gmail.com","threadId":"36952","inReplyTo":"1403117117-10384-1-git-send-email-jmmahler@gmail.com","subject":"[PATCH v3 5/5] name-hash.c: rename to name_compare()","fromName":"Jeremiah Mahler","fromEmail":"jmmahler@gmail.com","sentAt":"2014-06-18T18:45:17Z","receivedAt":"2014-06-18T18:45:17Z","isPatch":true,"sender":{"key":"jmmahler@gmail.com","avatar":"https://avatars.githubusercontent.com/u/154028?v=4"},"body":"Rename the call to cache_name_compare() to name_compare().\n\nSigned-off-by: Jeremiah Mahler <jmmahler@gmail.com>\n---\n name-hash.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/name-hash.c b/name-hash.c\nindex be7c4ae..e2bea88 100644\n--- a/name-hash.c\n+++ b/name-hash.c\n@@ -179,7 +179,7 @@ static int same_name(const struct cache_entry *ce, const char *name, int namelen\n \t * Always do exact compare, even if we want a case-ignoring comparison;\n \t * we do the quick exact one first, because it will be the common case.\n \t */\n-\tif (len == namelen && !cache_name_compare(name, namelen, ce->name, len))\n+\tif (len == namelen && !name_compare(name, namelen, ce->name, len))\n \t\treturn 1;\n \n \tif (!icase)\n-- \n2.0.0\n"},{"id":"244555","messageId":"20140618190359.GS8557@google.com","threadId":"36952","inReplyTo":"1403117117-10384-3-git-send-email-jmmahler@gmail.com","subject":"Re: [PATCH v3 2/5] tree-walk.c: remove name_compare() function","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2014-06-18T19:03:59Z","receivedAt":"2014-06-18T19:03:59Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Jeremiah Mahler wrote:\n\n> Remove the duplicate name_compare() function and use the one provided by\n> read-cache.c.\n\nI'd squash this into patch 1/5.\n\n> ---\n> Notes:\n>     There is one small difference between the old function and the new one.\n>     The old one returned -N and +N whereas the new one returns -1 and +1.\n>     However, there is no place where the magnitude was needed, so this\n>     change will not alter its behavior.\n\nThis is useful information for anyone looking back at the patch in the\nfuture, so it belongs above the three-dash divider.\n\nThanks,\nJonathan\n"},{"id":"244556","messageId":"20140618190439.GT8557@google.com","threadId":"36952","inReplyTo":"1403117117-10384-4-git-send-email-jmmahler@gmail.com","subject":"Re: [PATCH v3 3/5] unpack-trees.c: remove name_compare() function","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2014-06-18T19:04:39Z","receivedAt":"2014-06-18T19:04:39Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Jeremiah Mahler wrote:\n\n>  unpack-trees.c | 11 -----------\n>  1 file changed, 11 deletions(-)\n\nSame thoughts as patch 2/5. :)\n\nThanks,\nJonathan\n"},{"id":"244557","messageId":"20140618190956.GU8557@google.com","threadId":"36952","inReplyTo":"1403117117-10384-5-git-send-email-jmmahler@gmail.com","subject":"Re: [PATCH v3 4/5] dir.c: rename to name_compare()","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2014-06-18T19:09:56Z","receivedAt":"2014-06-18T19:09:56Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Jeremiah Mahler wrote:\n\n>     This is a case where cache_name_compare() was used even though it had\n>     nothing to do with a cache.  The new name makes it clear that no cache\n>     is involved.\n\nThat's a perfect sort of thing to put in the commit message. ;-)\n\nUnlike patches 2 and 3, this could make sense to me as a separate\npatch from 1/5.  Except... how does git work at all with patch 1 and\nwithout this patch?  I thought that patch removed the public\ncache_name_compare function.\n\nWould it make sense to delay the removal of cache_name_compare until a\npatch at the end of the series?\n\nThe patch is small enough that squashing into patch 1 seems fine, too.\n\n[...]\n> Rename the call to cache_name_compare() to name_compare().\n\nIt's not actually renaming but calling a different function, right?\nSo I'd say something like\n\n\tread_directory: use name_compare instead of cache_name_compare\n\n\tThis is a case where cache_name_compare() was used even though it had\n\tnothing to do with a cache.  The new name makes it clear that no cache\n\tis involved.\n\n\tNo functional change intended.\n\nThanks,\nJonathan\n"},{"id":"244558","messageId":"20140618191021.GV8557@google.com","threadId":"36952","inReplyTo":"1403117117-10384-6-git-send-email-jmmahler@gmail.com","subject":"Re: [PATCH v3 5/5] name-hash.c: rename to name_compare()","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2014-06-18T19:10:21Z","receivedAt":"2014-06-18T19:10:21Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Jeremiah Mahler wrote:\n\n>  name-hash.c | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n\nSame thoughts as patch 4/5.\n"},{"id":"244559","messageId":"20140618191109.GW8557@google.com","threadId":"36952","inReplyTo":"1403117117-10384-2-git-send-email-jmmahler@gmail.com","subject":"Re: [PATCH v3 1/5] cache: rename cache_name_compare() to name_compare()","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2014-06-18T19:11:09Z","receivedAt":"2014-06-18T19:11:09Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Jeremiah Mahler wrote:\n\n> The cache_name_compare() function is not specific to a cache.\n> Make its name more general by renaming it to name_compare().\n\nSounds reasonable.\n"},{"id":"244560","messageId":"20140618191407.GX8557@google.com","threadId":"36952","inReplyTo":"1403117117-10384-1-git-send-email-jmmahler@gmail.com","subject":"Re: [PATCH v3 0/5] cleanup duplicate name_compare() functions","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2014-06-18T19:14:07Z","receivedAt":"2014-06-18T19:14:07Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Jeremiah Mahler wrote:\n\n> Jeremiah Mahler (5):\n>   cache: rename cache_name_compare() to name_compare()\n>   tree-walk.c: remove name_compare() function\n>   unpack-trees.c: remove name_compare() function\n>   dir.c: rename to name_compare()\n>   name-hash.c: rename to name_compare()\n>\n>  cache.h        |  2 +-\n>  dir.c          |  3 +--\n>  name-hash.c    |  2 +-\n>  read-cache.c   | 23 +++++++++++++----------\n>  tree-walk.c    | 10 ----------\n>  unpack-trees.c | 11 -----------\n>  6 files changed, 16 insertions(+), 35 deletions(-)\n\nAfter looking at the patches I suspect this should be a single patch.\nThat way it's bisectable, and the changes outside of read-cache.c are\nsmall enough that it's not too much of a burden to review as a single\npatch.\n\nThe code change looked good.\n\nThanks and hope that helps,\nJonathan\n"},{"id":"244628","messageId":"20140619080418.GA15698@hudson.localdomain","threadId":"36952","inReplyTo":"20140618190359.GS8557@google.com","subject":"Re: [PATCH v3 2/5] tree-walk.c: remove name_compare() function","fromName":"Jeremiah Mahler","fromEmail":"jmmahler@gmail.com","sentAt":"2014-06-19T08:04:18Z","receivedAt":"2014-06-19T08:04:18Z","isPatch":true,"sender":{"key":"jmmahler@gmail.com","avatar":"https://avatars.githubusercontent.com/u/154028?v=4"},"body":"Jonathan,\n\nOn Wed, Jun 18, 2014 at 12:03:59PM -0700, Jonathan Nieder wrote:\n> Jeremiah Mahler wrote:\n> \n> > Remove the duplicate name_compare() function and use the one provided by\n> > read-cache.c.\n> \n> I'd squash this into patch 1/5.\n> \n> > ---\n> > Notes:\n> >     There is one small difference between the old function and the new one.\n> >     The old one returned -N and +N whereas the new one returns -1 and +1.\n> >     However, there is no place where the magnitude was needed, so this\n> >     change will not alter its behavior.\n> \n> This is useful information for anyone looking back at the patch in the\n> future, so it belongs above the three-dash divider.\n> \nMakes sense. I will add it to the log message.\n\n> Thanks,\n> Jonathan\n\nThanks,\n-- \nJeremiah Mahler\njmmahler@gmail.com\nhttp://github.com/jmahler\n"},{"id":"244629","messageId":"20140619080432.GB15698@hudson.localdomain","threadId":"36952","inReplyTo":"20140618191407.GX8557@google.com","subject":"Re: [PATCH v3 0/5] cleanup duplicate name_compare() functions","fromName":"Jeremiah Mahler","fromEmail":"jmmahler@gmail.com","sentAt":"2014-06-19T08:04:32Z","receivedAt":"2014-06-19T08:04:32Z","isPatch":true,"sender":{"key":"jmmahler@gmail.com","avatar":"https://avatars.githubusercontent.com/u/154028?v=4"},"body":"Jonathan,\n\nOn Wed, Jun 18, 2014 at 12:14:07PM -0700, Jonathan Nieder wrote:\n> Jeremiah Mahler wrote:\n> \n> > Jeremiah Mahler (5):\n> >   cache: rename cache_name_compare() to name_compare()\n> >   tree-walk.c: remove name_compare() function\n> >   unpack-trees.c: remove name_compare() function\n> >   dir.c: rename to name_compare()\n> >   name-hash.c: rename to name_compare()\n> >\n> >  cache.h        |  2 +-\n> >  dir.c          |  3 +--\n> >  name-hash.c    |  2 +-\n> >  read-cache.c   | 23 +++++++++++++----------\n> >  tree-walk.c    | 10 ----------\n> >  unpack-trees.c | 11 -----------\n> >  6 files changed, 16 insertions(+), 35 deletions(-)\n> \n> After looking at the patches I suspect this should be a single patch.\n> That way it's bisectable, and the changes outside of read-cache.c are\n> small enough that it's not too much of a burden to review as a single\n> patch.\n> \nThat would be a pain to bisect if the partial application of the patch\nset left the system in a broken state.  Good suggestion.\n\n> The code change looked good.\n> \n> Thanks and hope that helps,\n> Jonathan\n\nThanks,\n-- \nJeremiah Mahler\njmmahler@gmail.com\nhttp://github.com/jmahler\n"},{"id":"244632","messageId":"20140619085447.GA1009@sigill.intra.peff.net","threadId":"36952","inReplyTo":"20140619080432.GB15698@hudson.localdomain","subject":"Re: [PATCH v3 0/5] cleanup duplicate name_compare() functions","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2014-06-19T08:54:47Z","receivedAt":"2014-06-19T08:54:47Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Jun 19, 2014 at 01:04:32AM -0700, Jeremiah Mahler wrote:\n\n> > After looking at the patches I suspect this should be a single patch.\n> > That way it's bisectable, and the changes outside of read-cache.c are\n> > small enough that it's not too much of a burden to review as a single\n> > patch.\n> > \n> That would be a pain to bisect if the partial application of the patch\n> set left the system in a broken state.  Good suggestion.\n\nOne trick I use, especially when refactoring, is to use an interactive\nrebase to test each commit in isolation, like:\n\n  GIT_EDITOR='sed -i \"/^pick .*/aexec make -j8 test\"' git rebase -i\n\nAfter picking each commit, that will run the tests on each one[1]. If it\nfails, the rebase will pause. You can fix any problems, test to your\nsatisfaction, \"commit --amend\", and then \"rebase --continue\" to keep\ngoing.\n\n-Peff\n\n[1] Of course it can be rather time-consuming for a large series. I\n    often just compile-test at first, and then do a final \"make test\"\n    pass when I think everything is right.\n"}]}