All of lore.kernel.org
 help / color / mirror / Atom feed
* issue: strange `git diff --numstat` behavior.
@ 2018-10-12 18:23 Sergey Andreenko
  2018-10-13  8:13 ` Junio C Hamano
  0 siblings, 1 reply; 8+ messages in thread
From: Sergey Andreenko @ 2018-10-12 18:23 UTC (permalink / raw)
  To: git

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.txt

So (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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-10-19 17:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-12 18:23 issue: strange `git diff --numstat` behavior Sergey Andreenko
2018-10-13  8:13 ` Junio C Hamano
2018-10-18 18:38   ` [PATCH] diff: don't attempt to strip prefix from absolute Windows paths Johannes Sixt
2018-10-18 18:49     ` Stefan Beller
2018-10-18 19:11       ` Johannes Sixt
2018-10-19 16:58         ` [PATCH v2] " Johannes Sixt
2018-10-19 17:04           ` Stefan Beller
2018-10-19  1:34     ` [PATCH] " Junio C Hamano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.