LoginSignup
11
10

More than 5 years have passed since last update.

git である行の修正コミットを特定する

Posted at

git である行の修正コミットを特定する

直近の変更コミットから、さらに遡りたいことがあったので調べた結果。

blame -L で指定行の変更コミットを確認

$ git blame -L 736,736 autoload\unite\kinds\file.vim

d484e113 (Shougo Matsushita 2012-02-11 23:51:30 +0900 736)       if unite#util#is_windows() && path =~ '^//'

変更内容確認(任意の場所を表示するコマンドはあるのかな?)

$ git log -p d484e113 autoload\unite\kinds\file.vim

@@ -486,7 +486,7 @@ function! s:kind.action_table.vimfiler__execute.func(candidates)"{{{
   try
     for candidate in a:candidates
       let path = candidate.action__path
-      if unite#util#is_win() && path =~ '^//'
+      if unite#util#is_windows() && path =~ '^//'
         " substitute separator for UNC.
         let path = substitute(path, '/', '\\', 'g')
       endif

本質的な変更はさらに過去みたいなので、さらに遡る。
このコミットの親 d484e113^ から 489 行目の内容が追加されたコミットを探す。
(表示を開始している行が 486 行目なので、対象の行は +3 の 489 行目。もっとスマートな方法がありそう)

$ git blame -L 489,489 autoload\unite\kinds\file.vim -r "d484e113^"

8f6d596c (Shougo Matsushita 2011-11-28 19:00:16 +0900 489)       if unite#util#is_win() && path =~ '^//'

変更内容確認。こいつみたい。

$ git log -p 8f6d596c autoload\unite\kinds\file.vim

commit 8f6d596c4afc60fe6fd02d4c5dedbcda7fa5146c
Author: Shougo Matsushita <Shougo.Matsu@gmail.com>
Date:   Mon Nov 28 19:00:16 2011 +0900

    - Fixed for UNC.

diff --git a/autoload/unite/kinds/file.vim b/autoload/unite/kinds/file.vim
index 46f34cd..8496432 100644
<後略>
11
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
10