issue: strange `git diff --numstat` behavior.
- From
- Sergey Andreenko <andreenkosa@gmail.com>
- Date
- Oct 12, 2018, 18:23 UTC
- Message-ID
- <CAD1gVxMg0ZiKqFABrnwt0v_=wr2X_3ErkR92RmCAtFQnuM+L5w@mail.gmail.com>
git diff –numstat FOLDER1 FOLDER2 works strange when run from a git controlled folder.
The output shrinks some symbols in the diff file paths.
For example:
Create a folder and call git init, for example: `C:\test`.
mkdir C:\test
cd C:\test
git init
Create two folders with to diff. For example: ` C:\diff`, `C:\base` and put a file in them with a diff (for example `1.txt` with `1` in base and `1.txt` with 2 in diff).
mkdir C:\base
mkdir C:\diff
echo. 12>C:\base\1.txt
echo 13>C:\diff\1.txt
Run git diff:
pushd C:\
git.exe diff --numstat "C:\diff" "C:\base"
Output will be:
1 1 "C:\\diff/1.txt" => "C:\\base/1.txt"
Now move into C:\test and run it again:
pushd C:\test
git.exe diff --numstat "C:\diff" "C:\base"
1 1 "C:\\diff/1.txt" => "C:\\base/1.txt"
Now create a folder in `C:\test`, for example `one`:
mkdir one
cd one
git.exe diff --numstat "C:\diff" "C:\base"
output will be:
0 1 {iff => ase}/1.txtSo (folder_name_length) symbols were cut from the path (“C:\\d” and “C:\\b”).
Is any way to avoid that? I have checked several git versions and they all do the same.
Commands to repro:
mkdir C:\test
cd C:\test
git init
mkdir C:\base
mkdir C:\diff
echo. 12>C:\base\1.txt
echo 13>C:\diff\1.txt
pushd C:\
git.exe diff --numstat "C:\diff" "C:\base"
pushd C:\test
git.exe diff --numstat "C:\diff" "C:\base"
mkdir one
cd one
git.exe diff --numstat "C:\diff" "C:\base"
Best Regards,
Sergey Andrenko