Re: [PATCH 2/3] gitweb: Filter out commit ID from @difftree in git_commit and git_commitdiff
- From
Junio C Hamano <junkio@cox.net>
- Date
- Oct 25, 2006, 04:36 UTC
- Message-ID
- <7v1woxf1v9.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <200610241354.49396.jnareb@gmail.com>
Jakub Narebski <jnareb@gmail.com> writes:
> Filter out commit ID output that git-diff-tree adds when called with > only one <tree-ish> (not only for --stdin) in git_commit and > git_commitdiff.
I initially wondered why this, or other existing such sripping, is necessary in the first place.
The collected result is given to git_difftree_body() and it feeds parse_difftree_raw_line() with it. Interestingly enough, it _is_ prepared to handle the line with the commit object name.
However, the very initial part of git_difftree_body assumes that the array it gets does not have the commit object name (i.e. it counts the array members and says "N files changed").
So I think your change is probably a good one, but I suspect you probably are better off to make parse_difftree_raw_line() to barf when it gets the commit object name to make sure that all callers strip it at the same time; better yet, perhaps you can have a single function that invokes git-diff-tree -r (with different parameters) and returns the result that is already only the difftree body lines?