{"thread":{"id":"51995","subject":"[PATCH 0/1] xdiffi: fix typos and touch up comments","startedAt":"2019-10-08T18:27:57Z","lastAt":"2019-10-10T11:59:04Z","messageCount":4,"participants":["Johannes Schindelin via GitGitGadget","Jeff King","Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":1},"messages":[{"id":"383694","messageId":"pull.380.git.gitgitgadget@gmail.com","threadId":"51995","inReplyTo":null,"subject":"[PATCH 0/1] xdiffi: fix typos and touch up comments","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2019-10-08T18:27:51Z","receivedAt":"2019-10-08T18:27:57Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Some of these changes are best viewed with --color-words.\n\nJohannes Schindelin (1):\n  xdiffi: fix typos and touch up comments\n\n xdiff/xdiffi.c | 99 ++++++++++++++++++++++++++++----------------------\n 1 file changed, 55 insertions(+), 44 deletions(-)\n\n\nbase-commit: b744c3af07a15aaeb1b82fab689995fd5528f120\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-380%2Fdscho%2Fxdiffi-typos-and-comment-style-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-380/dscho/xdiffi-typos-and-comment-style-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/380\n-- \ngitgitgadget\n"},{"id":"383695","messageId":"cb677310cecd52e853055e93a75b365a1d133968.1570559270.git.gitgitgadget@gmail.com","threadId":"51995","inReplyTo":"pull.380.git.gitgitgadget@gmail.com","subject":"[PATCH 1/1] xdiffi: fix typos and touch up comments","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2019-10-08T18:27:52Z","receivedAt":"2019-10-08T18:27:57Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nInspired by the thoroughly stale https://github.com/git/git/pull/159,\nthis patch fixes a couple of typos, rewraps and clarifies some comments.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n xdiff/xdiffi.c | 99 ++++++++++++++++++++++++++++----------------------\n 1 file changed, 55 insertions(+), 44 deletions(-)\n\ndiff --git a/xdiff/xdiffi.c b/xdiff/xdiffi.c\nindex 1f1f4a3c78..bd035139f9 100644\n--- a/xdiff/xdiffi.c\n+++ b/xdiff/xdiffi.c\n@@ -38,9 +38,9 @@ typedef struct s_xdpsplit {\n  * Basically considers a \"box\" (off1, off2, lim1, lim2) and scan from both\n  * the forward diagonal starting from (off1, off2) and the backward diagonal\n  * starting from (lim1, lim2). If the K values on the same diagonal crosses\n- * returns the furthest point of reach. We might end up having to expensive\n- * cases using this algorithm is full, so a little bit of heuristic is needed\n- * to cut the search and to return a suboptimal point.\n+ * returns the furthest point of reach. We might encounter expensive edge cases\n+ * using this algorithm, so a little bit of heuristic is needed to cut the\n+ * search and to return a suboptimal point.\n  */\n static long xdl_split(unsigned long const *ha1, long off1, long lim1,\n \t\t      unsigned long const *ha2, long off2, long lim2,\n@@ -63,11 +63,13 @@ static long xdl_split(unsigned long const *ha1, long off1, long lim1,\n \t\tint got_snake = 0;\n \n \t\t/*\n-\t\t * We need to extent the diagonal \"domain\" by one. If the next\n+\t\t * We need to extend the diagonal \"domain\" by one. If the next\n \t\t * values exits the box boundaries we need to change it in the\n-\t\t * opposite direction because (max - min) must be a power of two.\n+\t\t * opposite direction because (max - min) must be a power of\n+\t\t * two.\n+\t\t *\n \t\t * Also we initialize the external K value to -1 so that we can\n-\t\t * avoid extra conditions check inside the core loop.\n+\t\t * avoid extra conditions in the check inside the core loop.\n \t\t */\n \t\tif (fmin > dmin)\n \t\t\tkvdf[--fmin - 1] = -1;\n@@ -98,11 +100,13 @@ static long xdl_split(unsigned long const *ha1, long off1, long lim1,\n \t\t}\n \n \t\t/*\n-\t\t * We need to extent the diagonal \"domain\" by one. If the next\n+\t\t * We need to extend the diagonal \"domain\" by one. If the next\n \t\t * values exits the box boundaries we need to change it in the\n-\t\t * opposite direction because (max - min) must be a power of two.\n+\t\t * opposite direction because (max - min) must be a power of\n+\t\t * two.\n+\t\t *\n \t\t * Also we initialize the external K value to -1 so that we can\n-\t\t * avoid extra conditions check inside the core loop.\n+\t\t * avoid extra conditions in the check inside the core loop.\n \t\t */\n \t\tif (bmin > dmin)\n \t\t\tkvdb[--bmin - 1] = XDL_LINE_MAX;\n@@ -138,7 +142,7 @@ static long xdl_split(unsigned long const *ha1, long off1, long lim1,\n \t\t/*\n \t\t * If the edit cost is above the heuristic trigger and if\n \t\t * we got a good snake, we sample current diagonals to see\n-\t\t * if some of the, have reached an \"interesting\" path. Our\n+\t\t * if some of them have reached an \"interesting\" path. Our\n \t\t * measure is a function of the distance from the diagonal\n \t\t * corner (i1 + i2) penalized with the distance from the\n \t\t * mid diagonal itself. If this value is above the current\n@@ -196,8 +200,9 @@ static long xdl_split(unsigned long const *ha1, long off1, long lim1,\n \t\t}\n \n \t\t/*\n-\t\t * Enough is enough. We spent too much time here and now we collect\n-\t\t * the furthest reaching path using the (i1 + i2) measure.\n+\t\t * Enough is enough. We spent too much time here and now we\n+\t\t * collect the furthest reaching path using the (i1 + i2)\n+\t\t * measure.\n \t\t */\n \t\tif (ec >= xenv->mxcost) {\n \t\t\tlong fbest, fbest1, bbest, bbest1;\n@@ -244,9 +249,9 @@ static long xdl_split(unsigned long const *ha1, long off1, long lim1,\n \n \n /*\n- * Rule: \"Divide et Impera\". Recursively split the box in sub-boxes by calling\n- * the box splitting function. Note that the real job (marking changed lines)\n- * is done in the two boundary reaching checks.\n+ * Rule: \"Divide et Impera\" (divide & conquer). Recursively split the box in\n+ * sub-boxes by calling the box splitting function. Note that the real job\n+ * (marking changed lines) is done in the two boundary reaching checks.\n  */\n int xdl_recs_cmp(diffdata_t *dd1, long off1, long lim1,\n \t\t diffdata_t *dd2, long off2, long lim2,\n@@ -323,7 +328,9 @@ int xdl_do_diff(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp,\n \t}\n \n \t/*\n-\t * Allocate and setup K vectors to be used by the differential algorithm.\n+\t * Allocate and setup K vectors to be used by the differential\n+\t * algorithm.\n+\t *\n \t * One is to store the forward path and one to store the backward path.\n \t */\n \tndiags = xe->xdf1.nreff + xe->xdf2.nreff + 3;\n@@ -394,8 +401,8 @@ static int recs_match(xrecord_t *rec1, xrecord_t *rec2, long flags)\n /*\n  * If a line is indented more than this, get_indent() just returns this value.\n  * This avoids having to do absurd amounts of work for data that are not\n- * human-readable text, and also ensures that the output of get_indent fits within\n- * an int.\n+ * human-readable text, and also ensures that the output of get_indent fits\n+ * within an int.\n  */\n #define MAX_INDENT 200\n \n@@ -429,9 +436,9 @@ static int get_indent(xrecord_t *rec)\n }\n \n /*\n- * If more than this number of consecutive blank rows are found, just return this\n- * value. This avoids requiring O(N^2) work for pathological cases, and also\n- * ensures that the output of score_split fits in an int.\n+ * If more than this number of consecutive blank rows are found, just return\n+ * this value. This avoids requiring O(N^2) work for pathological cases, and\n+ * also ensures that the output of score_split fits in an int.\n  */\n #define MAX_BLANKS 20\n \n@@ -443,8 +450,8 @@ struct split_measurement {\n \tint end_of_file;\n \n \t/*\n-\t * How much is the line immediately following the split indented (or -1 if\n-\t * the line is blank):\n+\t * How much is the line immediately following the split indented (or -1\n+\t * if the line is blank):\n \t */\n \tint indent;\n \n@@ -454,8 +461,8 @@ struct split_measurement {\n \tint pre_blank;\n \n \t/*\n-\t * How much is the nearest non-blank line above the split indented (or -1\n-\t * if there is no such line)?\n+\t * How much is the nearest non-blank line above the split indented (or\n+\t * -1 if there is no such line)?\n \t */\n \tint pre_indent;\n \n@@ -581,13 +588,13 @@ static void measure_split(const xdfile_t *xdf, long split,\n \n /*\n  * Compute a badness score for the hypothetical split whose measurements are\n- * stored in m. The weight factors were determined empirically using the tools and\n- * corpus described in\n+ * stored in m. The weight factors were determined empirically using the tools\n+ * and corpus described in\n  *\n  *     https://github.com/mhagger/diff-slider-tools\n  *\n- * Also see that project if you want to improve the weights based on, for example,\n- * a larger or more diverse corpus.\n+ * Also see that project if you want to improve the weights based on, for\n+ * example, a larger or more diverse corpus.\n  */\n static void score_add_split(const struct split_measurement *m, struct split_score *s)\n {\n@@ -809,13 +816,16 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) {\n \tgroup_init(xdfo, &go);\n \n \twhile (1) {\n-\t\t/* If the group is empty in the to-be-compacted file, skip it: */\n+\t\t/*\n+\t\t * If the group is empty in the to-be-compacted file, skip it:\n+\t\t */\n \t\tif (g.end == g.start)\n \t\t\tgoto next;\n \n \t\t/*\n \t\t * Now shift the change up and then down as far as possible in\n-\t\t * each direction. If it bumps into any other changes, merge them.\n+\t\t * each direction. If it bumps into any other changes, merge\n+\t\t * them.\n \t\t */\n \t\tdo {\n \t\t\tgroupsize = g.end - g.start;\n@@ -858,17 +868,17 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) {\n \t\t * If the group can be shifted, then we can possibly use this\n \t\t * freedom to produce a more intuitive diff.\n \t\t *\n-\t\t * The group is currently shifted as far down as possible, so the\n-\t\t * heuristics below only have to handle upwards shifts.\n+\t\t * The group is currently shifted as far down as possible, so\n+\t\t * the heuristics below only have to handle upwards shifts.\n \t\t */\n \n \t\tif (g.end == earliest_end) {\n \t\t\t/* no shifting was possible */\n \t\t} else if (end_matching_other != -1) {\n \t\t\t/*\n-\t\t\t * Move the possibly merged group of changes back to line\n-\t\t\t * up with the last group of changes from the other file\n-\t\t\t * that it can align with.\n+\t\t\t * Move the possibly merged group of changes back to\n+\t\t\t * line up with the last group of changes from the\n+\t\t\t * other file that it can align with.\n \t\t\t */\n \t\t\twhile (go.end == go.start) {\n \t\t\t\tif (group_slide_up(xdf, &g, flags))\n@@ -879,14 +889,15 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) {\n \t\t} else if (flags & XDF_INDENT_HEURISTIC) {\n \t\t\t/*\n \t\t\t * Indent heuristic: a group of pure add/delete lines\n-\t\t\t * implies two splits, one between the end of the \"before\"\n-\t\t\t * context and the start of the group, and another between\n-\t\t\t * the end of the group and the beginning of the \"after\"\n-\t\t\t * context. Some splits are aesthetically better and some\n-\t\t\t * are worse. We compute a badness \"score\" for each split,\n-\t\t\t * and add the scores for the two splits to define a\n-\t\t\t * \"score\" for each position that the group can be shifted\n-\t\t\t * to. Then we pick the shift with the lowest score.\n+\t\t\t * implies two splits, one between the end of the\n+\t\t\t * \"before\" context and the start of the group, and\n+\t\t\t * another between the end of the group and the\n+\t\t\t * beginning of the \"after\" context. Some splits are\n+\t\t\t * aesthetically better and some are worse. We compute\n+\t\t\t * a badness \"score\" for each split, and add the scores\n+\t\t\t * for the two splits to define a \"score\" for each\n+\t\t\t * position that the group can be shifted to. Then we\n+\t\t\t * pick the shift with the lowest score.\n \t\t\t */\n \t\t\tlong shift, best_shift = -1;\n \t\t\tstruct split_score best_score;\n-- \ngitgitgadget\n"},{"id":"383761","messageId":"20191009203847.GB7007@sigill.intra.peff.net","threadId":"51995","inReplyTo":"cb677310cecd52e853055e93a75b365a1d133968.1570559270.git.gitgitgadget@gmail.com","subject":"Re: [PATCH 1/1] xdiffi: fix typos and touch up comments","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2019-10-09T20:38:48Z","receivedAt":"2019-10-09T20:38:50Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Oct 08, 2019 at 11:27:52AM -0700, Johannes Schindelin via GitGitGadget wrote:\n\n> From: Johannes Schindelin <johannes.schindelin@gmx.de>\n> \n> Inspired by the thoroughly stale https://github.com/git/git/pull/159,\n> this patch fixes a couple of typos, rewraps and clarifies some comments.\n> \n> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n> ---\n>  xdiff/xdiffi.c | 99 ++++++++++++++++++++++++++++----------------------\n>  1 file changed, 55 insertions(+), 44 deletions(-)\n\nI scanned through these with diff-highlight, and they all look good to\nme!\n\n-Peff\n"},{"id":"383793","messageId":"nycvar.QRO.7.76.6.1910101358020.46@tvgsbejvaqbjf.bet","threadId":"51995","inReplyTo":"20191009203847.GB7007@sigill.intra.peff.net","subject":"Re: [PATCH 1/1] xdiffi: fix typos and touch up comments","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2019-10-10T11:58:30Z","receivedAt":"2019-10-10T11:59:04Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Peff,\n\nOn Wed, 9 Oct 2019, Jeff King wrote:\n\n> On Tue, Oct 08, 2019 at 11:27:52AM -0700, Johannes Schindelin via GitGitGadget wrote:\n>\n> > From: Johannes Schindelin <johannes.schindelin@gmx.de>\n> >\n> > Inspired by the thoroughly stale https://github.com/git/git/pull/159,\n> > this patch fixes a couple of typos, rewraps and clarifies some comments.\n> >\n> > Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n> > ---\n> >  xdiff/xdiffi.c | 99 ++++++++++++++++++++++++++++----------------------\n> >  1 file changed, 55 insertions(+), 44 deletions(-)\n>\n> I scanned through these with diff-highlight, and they all look good to\n> me!\n\nThank you!\nDscho\n\nP.S.: Darn, now I really have to find time to check out\ndiff-highlight...\n"}]}