{"thread":{"id":"14209","subject":"gitweb/gitk: empty merge diffs","startedAt":"2008-06-29T15:57:57Z","lastAt":"2008-06-29T17:21:37Z","messageCount":2,"participants":["Lea Wiemann","Jakub Narebski"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"81649","messageId":"4867B105.7070208@gmail.com","threadId":"14209","inReplyTo":null,"subject":"gitweb/gitk: empty merge diffs","fromName":"Lea Wiemann","fromEmail":"lewiemann@gmail.com","sentAt":"2008-06-29T15:57:57Z","receivedAt":"2008-06-29T15:57:57Z","isPatch":false,"sender":{"key":"lewiemann@gmail.com","avatar":null},"body":"I'm trying to get the diff of a merge (\"git diff master^1 master\") with \ngitk and gitweb, but both of them only show empty diffs (you can try \nyourself using the test script below).\n\nGitk doesn't seem to allow me to view the merge diff at all.\n\nGitweb only shows \"Trivial merge\" in the commitdiff view.  In the commit \nview, I can get the merge diff I want by clicking the \"diff\" link behind \nthe first parent.\n\nWhy is this a \"trivial merge\", and what's the reason for gitweb not \ndisplaying the diff to the first parent in the commitdiff view?  I'm \nkinda confused here.\n\n\n===== Graph: =====\n\n*   master      merge mybranch into master\n|\\\n| * mybranch    change file2 on mybranch\n| * mybranch~1  change file2 on mybranch\n* | master~1    change file1 on master\n* | master~2    change file1 on master\n|/\n* mybranch~2    initial commit\n\n\n===== Script to set up the repository: =====\n\nrm -rf test-repo.tmp\nmkdir test-repo.tmp\ncd test-repo.tmp\n\ngit init\n\necho File 1 > file1\necho File 2 > file2\ngit add file1 file2\ngit commit -m 'initial commit'\n\ngit branch mybranch\n\necho Addition to file 1 >> file1\ngit commit -a -m 'change file1 on master'\necho Another addition to file 1 >> file1\ngit commit -a -m 'change file1 on master'\n\ngit checkout mybranch\necho Addition to file 2 >> file2\ngit commit -a -m 'change file2 on mybranch'\necho Another addition to file 2 >> file2\ngit commit -a -m 'change file2 on mybranch'\n\ngit checkout master\ngit merge 'merge mybranch into master' HEAD mybranch\n"},{"id":"81651","messageId":"m34p7ci2ch.fsf@localhost.localdomain","threadId":"14209","inReplyTo":"4867B105.7070208@gmail.com","subject":"Re: gitweb/gitk: empty merge diffs","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-06-29T17:21:37Z","receivedAt":"2008-06-29T17:21:37Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Lea Wiemann <lewiemann@gmail.com> writes:\n\n> I'm trying to get the diff of a merge (\"git diff master^1 master\")\n> with gitk and gitweb, but both of them only show empty diffs (you can\n> try yourself using the test script below).\n\nNote that if you are handcrafting gitweb URL, gitweb does not allow\n\"master^1\" as value of 'hp' ($hash_parent) parameter due to overly\nstrict validation (checking) of this parameter: only values suitable\nas refnames, or (shortened) SHA-1 identifiers are accepted.\n\n> Gitk doesn't seem to allow me to view the merge diff at all.\n> \n> Gitweb only shows \"Trivial merge\" in the commitdiff view.  \n\nBecause it _is_ trivial (tree level) merge, see documentation of diff\nformat for merges in git-diff(1) or Documentation/diff-format.txt:\n\n  Note that 'combined diff' lists only files which were modified from\n  all parents.\n\nIf combined diff raw (difftree) format lists nothing, gitweb denotes\nthis as \"Trivial merge\".\n\n> In the commit view, I can get the merge diff I want by clicking the\n> \"diff\" link behind the first parent.\n\nYou can also click on the \"commitdiff\" link in the navbar (at top of\nthe page), or you can click on commit title to switch between 'commit'\nand 'commitdiff' views.\n \n> Why is this a \"trivial merge\", and what's the reason for gitweb not\n> displaying the diff to the first parent in the commitdiff view?  I'm\n> kinda confused here.\n\nLets take git.git repository as an example.  Gitweb can display both\ncombined diff output for merge commit, and compact combined (--cc)\noutput (default); if you however provide both parents it would always\ndisplay ordinary diff.  The \"diff\" links in the 'commit' view you have\nmentioned, and \"1\"/\"2\"/... links in treediff part of combined merge\noutput in 'commitdiff' view, always display ordinary diff.\n\nDefault compact combined diff of a merge commit (c.f. \"git show pu\")\n  http://repo.or.cz/w/git.git?a=commitdiff;h=58829d79 ('pu' branch)\n\nDiff to first parent (c.f. \"git diff pu^1 pu\")\n  http://repo.or.cz/w/git.git?a=commitdiff;h=58829d79;hp=c944eebd\n\nDiff to second parent (c.f. \"git diff pu^2 pu\")\nWarning: large diff, and it takes some time to be displayed!\n  http://repo.or.cz/w/git.git?a=commitdiff;h=58829d79;hp=f1646543\n\n> ===== Graph: =====\n> \n> *   master      merge mybranch into master\n> |\\\n> | * mybranch    change file2 on mybranch\n> | * mybranch~1  change file2 on mybranch\n> * | master~1    change file1 on master\n> * | master~2    change file1 on master\n> |/\n> * mybranch~2    initial commit\n> \n> \n> ===== Script to set up the repository: =====\n\nWell, you can display diff to first parent in gitweb, see\n\n  http://localhost/gitweb.cgi/test-repo.git?a=commitdiff;h=36c2b5d0;hp=62868699\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"}]}