ã¨ãã£ã¿ã§ç·¨éãã¦ãããã¡ã¤ã«ãgit blameãã¦ã³ã¼ãã®æå³ãç解ãããã¨ãããã¨ãããããã®ã ãã©ï¼æ¯åã¿ã¼ããã«ãéãã¦git blameã¨ãããã®ãããã©ãããã¦ï¼ãªãã¨ããããï¼
Emacsã§ã«ã¼ã½ã«ã®ããè¡ãgit blameã§ããã便å©ãããªæ°ãããã®ã§ï¼ãã£ã¦ã¿ãï¼
ãããgit-blame-onelineã¨ããååã§ä¿åãã¦ï¼
#!/usr/bin/env ruby (file, line) = *ARGV Dir.chdir(File.dirname(file)) blame = `git blame -p -L #{line},+1 #{file} 2> /dev/null` exit if $?.to_i != 0 data = {} blame.each_line{|line| match = line.match(/^([^ ]+) (.*)$/) next unless match data[match[1]] = match[2] } print [Time.at(data['author-time'].to_i), data['author'], data['summary']].join(' ')
ãã®é¢æ°ãå®è¡ããã¨ï¼ã«ã¼ã½ã«ãããè¡ãgit blameã§ããï¼
(defun git-blame-current-line () (interactive) (let ((old-buf (current-buffer)) (blame-buf (get-buffer-create "*blame*")) (line-num (number-to-string (line-number-at-pos)))) (set-buffer blame-buf) (erase-buffer) (call-process "git-blame-oneline" nil "*blame*" t (buffer-file-name old-buf) line-num) (setq content (buffer-string)) (set-buffer old-buf) (when (not (eq (length content) 0)) (popup-tip content) ; (message content) ) ))
run-with-idle-timerã§å®è¡ããã¨ã«ã¼ã½ã«ã®ããè¡ã常ægit blameããã¦ãããã¢ãããããï¼
(run-with-idle-timer 1.0 t 'git-blame-current-line)
ãããªæãï¼ãã¤èª°ããªãã¨ããã³ããããããããããã¢ããã§åºãï¼
ãã£ã¦ã¿ã¦åãã£ããã©ï¼1è¡ã ãåºã¦ãããåãããªãã¦ï¼å¨ãã®ã³ããããã°ãè¦ããªãã¨ã ããªæãã ã£ãï¼ä¸ä¸ãåºãã¨ãããã°ããããã ãã©ï¼ãã£ã¨ãããã¢ããã§åºãã¨éªéãªæ°ãããï¼
ãããã¡å ¨ä½ãgit blameããã®ãæ¸ãã¦ã¿ãï¼
(defun git-blame-current-buffer () (interactive) (shell-command (concat "git blame " (buffer-file-name (current-buffer)))) )
ããã¯git blameããã ããªã®ã§ï¼ã³ãããã¡ãã»ã¼ã¸ãèªããªãï¼
ã«ã¼ã½ã«ä½ç½®ã®SHA1ãgit showããã®ãä½ã£ã¦ã¿ãï¼blameãããããã¡ã§ï¼è¦ããè¡ã®SHA1ã®ä¸ã§å®è¡ããã¨git showãå®è¡ãããï¼
(defun git-show-at-point () (interactive) (shell-command (concat "git show " (thing-at-point 'symbol))) )
ããã¯ããã§ãããã©ï¼ãããªã«ä¾¿å©ãããªãï¼ãã¡ã¤ã«å
¨ä½ãgit blameããã®ãéããï¼ã³ããããã°ãè¦ãã®ã«ããä¸æéããã®ãããã©ãããï¼
vc-annotateãããæãã«ä½¿ããã°ãããããªã®ã§ï¼ãããããã¨ã試ãã¦ã¿ããã¨æã£ã¦ãããã©ï¼Emacsããå¿«é©ã«git blameããæ
å ±ããåç¥ã®æ¹ã¯æãã¦ãã ããï¼
ä¸å¿Githubã«ãä¸ãã¦ãããã©ï¼ä½¿ãããã²ã¨å± ãªãããï¼