wslgit icon indicating copy to clipboard operation
wslgit copied to clipboard

PhpStorm. Show history don't work.

Open zippaaa opened this issue 5 years ago • 9 comments

I do not know where the error or command is not working correctly. I think phpstorm use "git log". Video: https://yadi.sk/i/91cu-JL-yzmGyQ (wgit = wslgit.exe) Windows 1809. Ubuntu 18.05.

zippaaa avatar Oct 09 '18 18:10 zippaaa

So, according to the video, the problem seems to be that git log using wslgit does not work if the (relative) path argument contains backslashes, right?

I recently added support for relative paths but didn't release a new version yet. Can you please test with the current test build of wslgit and report back if this fixes your problem?

andy-5 avatar Oct 10 '18 07:10 andy-5

I recently added support for relative paths but didn't release a new version yet.

Yes, "wgit log -- .\editor" working now, But "show history" don't work. Sorry, I don't know cause. (Can be used by another command.)

zippaaa avatar Oct 10 '18 09:10 zippaaa

Ok, can you somehow find out the exact command(s) used by PhpStorm for the "show history" function?

andy-5 avatar Oct 10 '18 10:10 andy-5

Ok, can you somehow find out the exact command(s) used by PhpStorm for the "show history" function?

I do not know how.

I found a solution: UPD Link. https://gist.github.com/jmickela/7c383c78af66a37a2446fe7eb733b157#gistcomment-2654557

zippaaa avatar Oct 10 '18 14:10 zippaaa

And using this small script the history command works? Because this script basically does the same thing as wslgit, except it does not translate paths, and therefore shows the exact same output for a simple git log.

But you can actually use this script to find the exact commands executed by PhpStorm. Just insert the following line somewhere into the script (e.g. at the end):

echo git %* >> %UserProfile%\git.log

After using it (from PhpStorm), you should find a file git.log in your user directory (i.e. C:\Users\YOU\git.log).

Can you please share the results of this after executing the history command from within PhpStorm?

andy-5 avatar Oct 11 '18 12:10 andy-5

Full log (project)

wsl git -c core.quotepath=false -c log.showSignature=false log HEAD --branches --remotes --max-count=2000 --pretty=format:"%x01%x01%H%x02%x02%ct%x02%x02%an%x02%x02%at%x02%x02%ae%x02%x02%cn%x02%x02%ce%x02%x02%P%x02%x02%s%x02%x02%b%x02%x02%B%x02%x02%d%x03%x03" --encoding=UTF-8 --decorate=full --
wsl git -c core.quotepath=false -c log.showSignature=false tag -l

File history

wsl git -c core.quotepath=false -c log.showSignature=false log -n1 --pretty=format:%x01%x01%H%x02%x02%ct%x03%x03 HEAD -- dir/my_file.php
wsl git -c core.quotepath=false -c log.showSignature=false log --name-status --pretty=format:%x01%x01%H%x02%x02%ct%x02%x02%an%x02%x02%ae%x02%x02%cn%x02%x02%ce%x02%x02%P%x02%x02%s%x02%x02%b%x02%x02%B%x02%x02%at%x03%x03 --encoding=UTF-8 HEAD --full-history --simplify-merges --max-count=1000 -- dir/my_file.php
wsl git -c core.quotepath=false -c log.showSignature=false show -M --name-status --pretty=format:%x01%x01%H%x02%x02%ct%x02%x02%P%x03%x03 --encoding=UTF-8 646fdb5ea77acd3d98f0166527c892665488922c --follow -- dir/my_file.php
wsl git -c core.quotepath=false -c log.showSignature=false log -n1 --pretty=format:%x01%x01%H%x02%x02%ct%x03%x03 HEAD -- dir/my_file.php

Directory history

wsl git -c core.quotepath=false -c log.showSignature=false log -n1 --pretty=format:%x01%x01%H%x02%x02%ct%x03%x03 HEAD -- dir/my_dir
wsl git -c core.quotepath=false -c log.showSignature=false log --name-status --pretty=format:%x01%x01%H%x02%x02%ct%x02%x02%an%x02%x02%ae%x02%x02%cn%x02%x02%ce%x02%x02%P%x02%x02%s%x02%x02%b%x02%x02%B%x02%x02%at%x03%x03 --encoding=UTF-8 HEAD --full-history --simplify-merges --max-count=1000 -- dir/my_dir
wsl git -c core.quotepath=false -c log.showSignature=false show -M --name-status --pretty=format:%x01%x01%H%x02%x02%ct%x02%x02%P%x03%x03 --encoding=UTF-8 20f0a9a3915e12f28f5d2b6ebc1801f69e78c4bd --follow -- dir/my_dir

Project:

|-.git
|-dir
      |-my_dir
      |-my_file.php

zippaaa avatar Oct 11 '18 13:10 zippaaa

And using this small script the history command works? Because this script basically does the same thing as wslgit, except it does not translate paths, and therefore shows the exact same output for a simple git log.

https://yadi.sk/i/A8xfzFCzmNeFZg https://yadi.sk/i/FWs7De6Uq3RKrQ

zippaaa avatar Oct 11 '18 13:10 zippaaa

Thank you for the logs. A quick test did not reveal any errors, however. All of these commands seem to work fine using wslgit. I will probably have to compare the output to native Git (or the script mentioned above) to see if there are any differences.

andy-5 avatar Oct 12 '18 07:10 andy-5

Ok, can you somehow find out the exact command(s) used by PhpStorm for the "show history" function?

I do not know how.

I found a solution: UPD Link. https://gist.github.com/jmickela/7c383c78af66a37a2446fe7eb733b157#gistcomment-2654557

This script outputs Chinese garbled I found this:

@echo off
setlocal enabledelayedexpansion
set command=%*
set find=C:\Users\%USERNAME%\AppData\Local\Temp\git-commit-msg-.txt
set replace=/mnt/c/Users/%USERNAME%/AppData/Local/Temp/git-commit-msg-.txt
call set command=%%command:!find!=!replace!%%
If %PROCESSOR_ARCHITECTURE% == x86 (
    C:\Windows\Sysnative\wsl.exe git %command%
) Else (
  wsl git %command%
)

it's work on win10 1809

SvenZhao avatar Nov 12 '18 11:11 SvenZhao