Lea Wiemann <lewiemann@xxxxxxxxx> writes: > I'm trying to get the diff of a merge ("git diff master^1 master") > with gitk and gitweb, but both of them only show empty diffs (you can > try yourself using the test script below). Note that if you are handcrafting gitweb URL, gitweb does not allow "master^1" as value of 'hp' ($hash_parent) parameter due to overly strict validation (checking) of this parameter: only values suitable as refnames, or (shortened) SHA-1 identifiers are accepted. > Gitk doesn't seem to allow me to view the merge diff at all. > > Gitweb only shows "Trivial merge" in the commitdiff view. Because it _is_ trivial (tree level) merge, see documentation of diff format for merges in git-diff(1) or Documentation/diff-format.txt: Note that 'combined diff' lists only files which were modified from all parents. If combined diff raw (difftree) format lists nothing, gitweb denotes this as "Trivial merge". > In the commit view, I can get the merge diff I want by clicking the > "diff" link behind the first parent. You can also click on the "commitdiff" link in the navbar (at top of the page), or you can click on commit title to switch between 'commit' and 'commitdiff' views. > Why is this a "trivial merge", and what's the reason for gitweb not > displaying the diff to the first parent in the commitdiff view? I'm > kinda confused here. Lets take git.git repository as an example. Gitweb can display both combined diff output for merge commit, and compact combined (--cc) output (default); if you however provide both parents it would always display ordinary diff. The "diff" links in the 'commit' view you have mentioned, and "1"/"2"/... links in treediff part of combined merge output in 'commitdiff' view, always display ordinary diff. Default compact combined diff of a merge commit (c.f. "git show pu") http://repo.or.cz/w/git.git?a=commitdiff;h=58829d79 ('pu' branch) Diff to first parent (c.f. "git diff pu^1 pu") http://repo.or.cz/w/git.git?a=commitdiff;h=58829d79;hp=c944eebd Diff to second parent (c.f. "git diff pu^2 pu") Warning: large diff, and it takes some time to be displayed! http://repo.or.cz/w/git.git?a=commitdiff;h=58829d79;hp=f1646543 > ===== Graph: ===== > > * master merge mybranch into master > |\ > | * mybranch change file2 on mybranch > | * mybranch~1 change file2 on mybranch > * | master~1 change file1 on master > * | master~2 change file1 on master > |/ > * mybranch~2 initial commit > > > ===== Script to set up the repository: ===== Well, you can display diff to first parent in gitweb, see http://localhost/gitweb.cgi/test-repo.git?a=commitdiff;h=36c2b5d0;hp=62868699 -- Jakub Narebski Poland ShadeHawk on #git -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html