amazon

12.5.16

Get a list of tracked files of Git by GitPython


The code below is equivalent to git command, "git ls-tree -r master --name-only".

import git

def get_tracked_files(trees):
paths = []
for tree in trees:
for blob in tree.blobs:
paths.append(blob.abspath)
if tree.trees:
paths.extend(get_tracked_files(tree.trees))
return paths

if __name__=='__main__':
repo = git.Repo('.')
tracked_files = get_tracked_files([repo.tree()])
print tracked_files

12.12.15

Failed OS X El Capitan 10.11.2 update

I updated to 10.11.2 yesterday.
It went halfway and stopped before completed.

So, I force quitted and restarted. Mac showed the login screen.
I logged in with my primary user A.
With a long spinning cursor, nothing happened.
I force quitted again.

Fortunately, I have another admin user B.
I tried logging in with user B. It was succeeded.

With Consol.app on user B, I found following messages around time when failing to log in with user A .
diagnosticd[136]: error evaluating process info - pid: 316, puniqueid: 316
com.apple.xpc.launchd[1]: (com.apple.lsd[316]) Service exited due to signal: Segmentation fault: 11

According to a Crash report, something was wrong with mdworker of com.apple.LaunchServices.

Thanks to information here, I could find where the cache of LauchServices.
sudo find /var/folders /Library/Caches/ -name '*LaunchServices*' -print0 | xargs -0 ls -l

I backed up the cache of user A and deleted it.
Solved.

OS X El Capitan 10.11.2 アップデート失敗

アップデートをしたら、プログレスバーが6,7割のところで止まった。
強制終了して通常使っていたユーザーAでログインすると、アップルマークの下のグルグルが回ったまま進まなくなった。

幸い別のユーザーBを作ってあったのでそちらでログインすると、ログイン可能だった。
とりあえず、ターミナルでsuコマンドを使ってユーザーAに変更し、必要なファイルを救出することができた。

OSは10.11.2になっていた。
つまり、システムには問題はなくユーザーAに問題があることが考えられる。

さて、ここからこの壊れたユーザーAを直しにかかる。
セーフモードでログインを試したが、グルグルは回ったまま起動しない。

ユーザーBでログイン後、コンソールからユーザーAがログインしようとしたときのログを見ると、
diagnosticd[136]: error evaluating process info - pid: 316, puniqueid: 316
com.apple.xpc.launchd[1]: (com.apple.lsd[316]) Service exited due to signal: Segmentation fault: 11
とCrash reportが毎秒出ていた。

Crash reportによるとcom.apple.LaunchServicesのmdworkerが悪さをしているようだ。

ここによると、以下でLauchServicesのキャッシュの場所が分かるようだ。
sudo find /var/folders /Library/Caches/ -name '*LaunchServices*' -print0 | xargs -0 ls -l

これで見つけたユーザーAのキャッシュファイルをバックアップしてから削除した。
再起動して、ユーザーAでログインすると、無事ログインできるようになった。