{"thread":{"id":"3147","subject":"What's in git.git","startedAt":"2006-01-25T13:00:47Z","lastAt":"2006-01-26T16:24:35Z","messageCount":6,"participants":["Junio C Hamano","Jason Riedy","Santi Bejar"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"15114","messageId":"7vy814qx6o.fsf@assigned-by-dhcp.cox.net","threadId":"3147","inReplyTo":null,"subject":"What's in git.git","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-01-25T13:00:47Z","receivedAt":"2006-01-25T13:00:47Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"I've pushed out the following changes to \"master\" branch:\n\n * git-clone\n\n   . --naked option is still accepted but is deprecated.  Please\n     say --bare.\n\n   . a repository cloned with --bare does not get \"origin\"\n     branch, nor remotes/origin file.\n\n   . Earlier we accepted more than one -o options, without\n     complaining.  We now complain.\n\n * fetch and peek/ls-remote (Michal Ostrowski)\n\n   . --upload-pack option to the underlying git-peek-remote and\n     friends can be passed from the barebone Porcelain.\n\n * local push/pull environment fix (Matt Draisey)\n\n   . We now clean \"GIT_DIR\" and friends from the environment\n     when spawning a program on the other end to drive git\n     native protocols on a local machine.  This uses unsetenv(),\n     which is not strictly portable, but I was too lazy to fix\n     it myself.  I am hoping that Jason Riedy will scream and\n     give us a patch to make it work again on his Solaris box\n     ;-).\n\n * sample update-hook rewrite (Andreas Ericsson)\n\n * asciidoc --unsafe workaround (Pavel Roskin)\n\nIn the \"pu\" branch, there are some interesting changes.  The\nmost immediately visible usability enhancement is the \"combined\ndiff\" option to git-diff-tree command.  Interested people can\ntry something like this:\n\n\t$ git checkout pu\n\t$ make clean strip all install\n\t$ git checkout master\n\nDo not forget to come back to your \"master\" branch once you are\ndone, or your next pull would be screwed.\n\n        $ git whatchanged --cc --abbrev pu\n\nThis would show an improved version of \"git whatchanged -m -p\".\nThe difference is that it uses the \"dense combined diff\"\nsuggested by Linus yesterday.  Commits near the tip of \"pu\" tend\nto be Octopus, and you would see quite interesting combined\ndiffs for them.  I am not proud of the implementation itself,\nand I am sure there are more bugs to be discovered, but overall\nI am reasonably happy with what it shows.  Once it stabilizes,\nit would be a good addition to gitweb UI.  In addition to the\n\"commitdiff\" next to each parent, there would be an extra link\nin a merge commit to get a combined diff.\n\nThe \"annotate helper\" change by Linus and \"bound commit\"\nsubproject support experiments are there as before.\n\nThere are other minor fixes and enhancements.  Not all of them\nmay make it to \"master\":\n\n * \"diff-tree --abbrev --pretty\" was still showing full 40\n   characters of commit object names on \"Merge:\" line.\n\n * \"rev-parse --abbrev[=<n>] $rev\" is similar to\n   \"rev-parse --verify $rev\", except that it shows an\n   abbreviated object name.\n\n * The flag argument was handled confusingly by \"rev-parse\n   [--flags|--no-flags]\".  The command now treats anything that\n   come after --flags/--no-flags things to be parsed, not an\n   option to control what the command does.  This was primarily\n   needed to allow parsing out \"--abbrev\" option and giving it\n   to \"diff-tree\" inside whatchanged.  All existing users have\n   been adjusted to this change.  I do not think any of Cogito,\n   gitk, nor stgit is affected.\n"},{"id":"15118","messageId":"7v8xt4qffg.fsf@assigned-by-dhcp.cox.net","threadId":"3147","inReplyTo":"8aa486160601250741k120f0021h@mail.gmail.com","subject":"Re: What's in git.git","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-01-25T19:24:19Z","receivedAt":"2006-01-25T19:24:19Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Santi Bejar <sbejar@gmail.com> writes:\n\n> I think we should be consistent with respect the leading dots. Now the\n> diff-tree line has the dots, but the merge line do not.\n\nThis is deliberate.  Merge lines do not have to align with\nanything else for readability.\n"},{"id":"15120","messageId":"10786.1138221407@lotus.CS.Berkeley.EDU","threadId":"3147","inReplyTo":"7vy814qx6o.fsf@assigned-by-dhcp.cox.net","subject":"Re: What's in git.git","fromName":"Jason Riedy","fromEmail":"ejr@eecs.berkeley.edu","sentAt":"2006-01-25T20:36:47Z","receivedAt":"2006-01-25T20:36:47Z","isPatch":false,"sender":{"key":"ejr@eecs.berkeley.edu","avatar":"https://gravatar.com/avatar/547fa56f887cab01599edab4e9f813c949c1269e02714f20e0496c56185d9837?d=mp&s=160"},"body":"And Junio C Hamano writes:\n -      This uses unsetenv(), which is not strictly portable, but \n - \tI was too lazy to fix it myself.\n\nAnd you manage to catch me on the one day in the last month\nI've played with git code...  Patch to add compat/unsetenv.c\ncoming shortly.  Passes unit tests and make test as well as \nbefore (I have some wierd, local-only cpio problems), but I \nhaven't used this extensively.\n\nPeople _with_ unsetenv can still add compat functions, you \nknow.  ;)\n\nJason\n"},{"id":"15129","messageId":"7vvew7lv4s.fsf@assigned-by-dhcp.cox.net","threadId":"3147","inReplyTo":"8aa486160601250634v294857e0j@mail.gmail.com","subject":"Re: What's in git.git","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-01-25T23:56:19Z","receivedAt":"2006-01-25T23:56:19Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Santi Bejar <sbejar@gmail.com> writes:\n\n> Junio C Hamano <junkio@cox.net> writes:\n>...\n>>         $ git whatchanged --cc --abbrev pu\n>...\n>       Then some comments :)\n>\n>       * There is an extra space between the +- and the content.\n\nThanks for noticing.  Fixed.\n\n>       * I think the \"diff command\" could be just \"diff --git\".  And\n>         \"diff --git --cc\" for the \"dense combined diff\".\n\nI chose not say \"--git\" because I wanted to make sure people\nwould not run \"git apply\" by mistake.  I replaced them\nwith \"--combined\" and \"--cc\" to make the differences clearer.\n\n>       * I miss the index lines\n\nThat would probably be easy to add in the later rounds if you\nreally want them, but I consider it lower priority for now.\nThis is designed to be human readable and not necessarily\nmachine applicable, so I do not see much point in showing them.\n\nMode changes, creation, deletion, rename, and copy may need to\nbe there, though.  The code currently punts on them.  Patches\nwelcome.\n\n>       * In the case of 3 and more parents I find uninteresting the hunk\n>         where the merge is equal to one (or more) of its children and\n>         the rest are equal. For example the first hunk in 22573dd, where\n>         all the children are equal expect the picked one:\n>\n> diff-tree 22573dd... (from parents)\n> Merge: 92643a2 0359fe8 a428965 4aa079f\n> Author: Junio C Hamano <junkio@cox.net>\n> Date:   Wed Jan 25 03:51:37 2006 -0800\n>\n>     Merge lt/revlist,jc/diff,jc/bind\n>\n> diff --combined rev-list.c\n> @@@@@ +37,7 @@@@@\n>      static int dense = 1;\n>      static int unpacked = 0;\n>      static int bisect_list = 0;\n> ---  static int tag_objects = 0;\n> ---  static int tree_objects = 0;\n> ---  static int blob_objects = 0;\n> +++  static int list_objects = 0;\n>      static int verbose_header = 0;\n>      static int show_parents = 0;\n>      static int hdr_termination = 0;\n\nI noticed it and found it somewhat less interesting than others,\nbut left it the way.  It is \"changed the same way from all of\nthese parents except this one\", which is different from what I\nculled in the version you are commenting on, i.e. \"changed only\nfrom one parent\".\n\nI've since updated the logic to drop these hunks as well.\nPlease take a look at the tip of \"pu\".\n\n>       * Like you said in another thread, the line numbers of all the\n>         files.\n\nThis is left as an exercise for the reader ;-)\n\n> So, at the end, I suggest this output for the diff:\n>...\n> and this for the diff-raw:\n>\n> :100644 100644 56505b4... 538d21d... M  Makefile\n> :100644 100644 30479b4... 538d21d... M  Makefile\n\nI do not find this to be so interesting.  diff-raw is primarily\nfor quick sanity check and machine processing, so I'd rather not\nplay games when generating diff-raw in order to keep the latter\nform of users sane.\n"},{"id":"15147","messageId":"7vhd7rfare.fsf@assigned-by-dhcp.cox.net","threadId":"3147","inReplyTo":"8aa486160601260156h6157ca34s@mail.gmail.com","subject":"Re: What's in git.git","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-01-26T12:12:53Z","receivedAt":"2006-01-26T12:12:53Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Santi Bejar <sbejar@gmail.com> writes:\n\n> 2006/1/26, Junio C Hamano <junkio@cox.net>:\n>> No comment on your message yet, but please fix your MUA so that\n>> your messages do not get rejected by the mailing list software.\n>>\n>> I suspect it is base64 CTE that causes it.\n>>\n>>         Content-Type: text/plain; charset=UTF-8\n>>         Content-Transfer-Encoding: base64\n>\n> Sorry, about that. But I didn't get any notification.\n\nYou do not need to feel sorry.  It's just your voice is not\nheard as widely as it should have been, and you did not know\nabout it.\n\nThe spam filter just drops things on the floor without bothering\nto notify potential spammers.\n\nI think this patch would address your two issues (applies on top\nof \"pu\"), but I have not had time to test it seriously enough.\n\n-- >8 --\n[PATCH] combine-diff: better hunk splitting.\n\nIt considered an otherwise unchanged line that had line removals\nin front of it an interesting line, which caused hunks to have\none extra the trailing context line.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n\n---\n\n combine-diff.c |  142 ++++++++++++++++++++++++++++++++++++++++++++++----------\n 1 files changed, 116 insertions(+), 26 deletions(-)\n\n0aa20bc0c276c3fcb7215ba9f591960178792261\ndiff --git a/combine-diff.c b/combine-diff.c\nindex 3b219a0..d94a93d 100644\n--- a/combine-diff.c\n+++ b/combine-diff.c\n@@ -323,52 +323,142 @@ static unsigned long line_all_diff(struc\n \treturn different;\n }\n \n-static int make_hunks(struct sline *sline, unsigned long cnt,\n-\t\t       int num_parent, int dense)\n+static unsigned long adjust_hunk_tail(struct sline *sline,\n+\t\t\t\t      unsigned long all_mask,\n+\t\t\t\t      unsigned long hunk_begin,\n+\t\t\t\t      unsigned long i)\n+{\n+\t/* i points at the first uninteresting line.\n+\t * If the last line of the hunk was interesting\n+\t * only because it has some deletion, then\n+\t * it is not all that interesting for the\n+\t * purpose of giving trailing context lines.\n+\t */\n+\tif ((hunk_begin + 1 <= i) &&\n+\t    ((sline[i-1].flag & all_mask) == all_mask))\n+\t\ti--;\n+\treturn i;\n+}\n+\n+static unsigned long next_interesting(struct sline *sline,\n+\t\t\t\t      unsigned long mark,\n+\t\t\t\t      unsigned long i,\n+\t\t\t\t      unsigned long cnt,\n+\t\t\t\t      int uninteresting)\n+{\n+\twhile (i < cnt)\n+\t\tif (uninteresting ?\n+\t\t    !(sline[i].flag & mark) :\n+\t\t    (sline[i].flag & mark))\n+\t\t\treturn i;\n+\t\telse\n+\t\t\ti++;\n+\treturn cnt;\n+}\n+\n+static int give_context(struct sline *sline, unsigned long cnt, int num_parent)\n {\n \tunsigned long all_mask = (1UL<<num_parent) - 1;\n \tunsigned long mark = (1UL<<num_parent);\n \tunsigned long i;\n \tint has_interesting = 0;\n \n-\ti = 0;\n+\ti = next_interesting(sline, mark, 0, cnt, 0);\n+\tif (cnt <= i)\n+\t\treturn 0;\n+\n \twhile (i < cnt) {\n-\t\tif (interesting(&sline[i], all_mask)) {\n-\t\t\tunsigned long j = (context < i) ? i - context : 0;\n-\t\t\twhile (j <= i)\n+\t\tunsigned long j = (context < i) ? (i - context) : 0;\n+\t\tunsigned long k;\n+\t\twhile (j < i)\n+\t\t\tsline[j++].flag |= mark;\n+\n+\tagain:\n+\t\tj = next_interesting(sline, mark, i, cnt, 1);\n+\t\tif (cnt <= j)\n+\t\t\tbreak; /* the rest are all interesting */\n+\n+\t\t/* lookahead context lines */\n+\t\tk = next_interesting(sline, mark, j, cnt, 0);\n+\t\tj = adjust_hunk_tail(sline, all_mask, i, j);\n+\n+\t\tif (k < j + context) {\n+\t\t\t/* k is interesting and [j,k) are not, but\n+\t\t\t * paint them interesting because the gap is small.\n+\t\t\t */\n+\t\t\twhile (j < k)\n \t\t\t\tsline[j++].flag |= mark;\n-\t\t\twhile (++i < cnt) {\n-\t\t\t\tif (!interesting(&sline[i], all_mask))\n-\t\t\t\t\tbreak;\n-\t\t\t\tsline[i].flag |= mark;\n-\t\t\t}\n-\t\t\tj = (i + context < cnt) ? i + context : cnt;\n-\t\t\twhile (i < j)\n-\t\t\t\tsline[i++].flag |= mark;\n-\t\t\thas_interesting = 1;\n-\t\t\tcontinue;\n+\t\t\ti = k;\n+\t\t\tgoto again;\n \t\t}\n-\t\ti++;\n+\n+\t\t/* j is the first uninteresting line and there is\n+\t\t * no overlap beyond it within context lines.\n+\t\t */\n+\t\ti = k;\n+\t\tk = (j + context < cnt) ? j + context : cnt;\n+\t\twhile (j < k)\n+\t\t\tsline[j++].flag |= mark;\n+\t}\n+\treturn 1;\n+}\n+\n+static int make_hunks(struct sline *sline, unsigned long cnt,\n+\t\t       int num_parent, int dense)\n+{\n+\tunsigned long all_mask = (1UL<<num_parent) - 1;\n+\tunsigned long mark = (1UL<<num_parent);\n+\tunsigned long i;\n+\tint has_interesting = 0;\n+\n+\tfor (i = 0; i < cnt; i++) {\n+\t\tif (interesting(&sline[i], all_mask))\n+\t\t\tsline[i].flag |= mark;\n+\t\telse\n+\t\t\tsline[i].flag &= ~mark;\n \t}\n \tif (!dense)\n-\t\treturn has_interesting;\n+\t\treturn give_context(sline, cnt, num_parent);\n \n \t/* Look at each hunk, and if we have changes from only one\n \t * parent, or the changes are the same from all but one\n \t * parent, mark that uninteresting.\n \t */\n-\thas_interesting = 0;\n \ti = 0;\n \twhile (i < cnt) {\n-\t\tint j, hunk_end, same, diff;\n+\t\tunsigned long j, hunk_begin, hunk_end;\n+\t\tint same, diff;\n \t\tunsigned long same_diff, all_diff;\n \t\twhile (i < cnt && !(sline[i].flag & mark))\n \t\t\ti++;\n \t\tif (cnt <= i)\n \t\t\tbreak; /* No more interesting hunks */\n-\t\tfor (hunk_end = i + 1; hunk_end < cnt; hunk_end++)\n-\t\t\tif (!(sline[hunk_end].flag & mark))\n-\t\t\t\tbreak;\n+\t\thunk_begin = i;\n+\t\tfor (j = i + 1; j < cnt; j++) {\n+\t\t\tif (!(sline[j].flag & mark)) {\n+\t\t\t\t/* Look beyond the end to see if there\n+\t\t\t\t * is an interesting line after this\n+\t\t\t\t * hunk within context span.\n+\t\t\t\t */\n+\t\t\t\tunsigned long la; /* lookahead */\n+\t\t\t\tint contin = 0;\n+\t\t\t\tla = adjust_hunk_tail(sline, all_mask,\n+\t\t\t\t\t\t     hunk_begin, j);\n+\t\t\t\tla = (la + context < cnt) ?\n+\t\t\t\t\t(la + context) : cnt;\n+\t\t\t\twhile (j <= --la) {\n+\t\t\t\t\tif (sline[la].flag & mark) {\n+\t\t\t\t\t\tcontin = 1;\n+\t\t\t\t\t\tbreak;\n+\t\t\t\t\t}\n+\t\t\t\t}\n+\t\t\t\tif (!contin)\n+\t\t\t\t\tbreak;\n+\t\t\t\tj = la;\n+\t\t\t}\n+\t\t}\n+\t\thunk_end = j;\n+\n \t\t/* [i..hunk_end) are interesting.  Now does it have\n \t\t * the same change with all but one parent?\n \t\t */\n@@ -387,13 +477,13 @@ static int make_hunks(struct sline *slin\n \t\t}\n \t\tif ((num_parent - 1 <= same) || (diff == 1)) {\n \t\t\t/* This hunk is not that interesting after all */\n-\t\t\tfor (j = i; j < hunk_end; j++)\n+\t\t\tfor (j = hunk_begin; j < hunk_end; j++)\n \t\t\t\tsline[j].flag &= ~mark;\n \t\t}\n-\t\telse\n-\t\t\thas_interesting = 1;\n \t\ti = hunk_end;\n \t}\n+\n+\thas_interesting = give_context(sline, cnt, num_parent);\n \treturn has_interesting;\n }\n \n-- \n1.1.4.g2cff\n"},{"id":"15153","messageId":"8aa486160601260824g72b127ddn@mail.gmail.com","threadId":"3147","inReplyTo":"7vhd7rfare.fsf@assigned-by-dhcp.cox.net","subject":"Re: What's in git.git","fromName":"Santi Bejar","fromEmail":"sbejar@gmail.com","sentAt":"2006-01-26T16:24:35Z","receivedAt":"2006-01-26T16:24:35Z","isPatch":false,"sender":{"key":"santi@agolina.net","avatar":null},"body":"> I think this patch would address your two issues (applies on top\n> of \"pu\"), but I have not had time to test it seriously enough.\n\nIt works here, thanks.\n\nJust a little issue. With grafted commits the combined diff works but\nthe \"Merge:\" line is not shown.\n\nSanti\n"}]}