git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: blameview and file contents

From
Shawn O. Pearce <spearce@spearce.org>
Date
Jan 30, 2007, 06:54 UTC
Message-ID
<20070130065417.GA32640@spearce.org>
In-Reply-To
<cc723f590701292246v282408d0o27a0d8320c027743@mail.gmail.com>
Aneesh Kumar <aneesh.kumar@gmail.com> wrote:
> I guess blame view need to pull the file content from the repository
> rather than opening it directly. If i have a working copy that is not
> yet committed it gives wrong results. I tried some changes as below.
> But i guess there should be a much easier way.
Show 6 quoted lines
> -open(my $fh, '<', $fn)
> -  or die "unable to open $fn: $!";
> +$fh = get_file_handle("HEAD", $fn);
>  while(<$fh>) {
>    chomp;
>    $fileview->{data}->[$.] = ['HEAD', '?', "$fn:$.", $_];
Doesn't the following work just as well, and use a lot less code?
  open(my $fh, '|-', 'git', 'cat-file', 'blob', "HEAD:$fn")
?
-- 
Shawn.
Previous: Aneesh KumarNext: Aneesh Kumar
Message 2 of 5 in “blameview and file contents”
  1. Aneesh KumarJan 30, 2007
  2. Shawn O. PearceJan 30, 2007
  3. Aneesh KumarJan 30, 2007
  4. Shawn O. PearceJan 30, 2007
  5. Junio C HamanoJan 30, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.