1

Facing the below error -

fatal: ambiguous argument '`SS_FrameProtoco SS_Codec SS_WcdmaEngineDrivers SS_LocalOam SS_LocalTelecom SS_W1plT`': 

unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git [...] -- [...]'

How to solve this error? I wanted to add two different digits in one single line.

git log --shortstat --since "01.06.2020" --until "1.12.2020" \
SS_FrameProtocol SS_Codec SS_WcdmaEngineDrivers SS_LocalOam \
SS_LocalTelecom SS_W1plTx   | grep "files changed" | awk '{files+=$1;
inserted+=$4; deleted+=$6} END {print "files changed", files, "lines
inserted:", inserted, "lines deleted:", deleted}'

This command is working but I want to pass the directory name(s) in a text file.

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
deena
  • 11
  • 1
  • You can specify the directory names using `$(cat text.file)` in place of the directory names. You should prefix that with `--`, as the error message suggests. – Jonathan Leffler Feb 26 '21 at 17:51

1 Answers1

0

In case your folders might have space in them (not the case in your question, but that could happen), you could follow the approach described here:

declare -a args=()
while IFS='' read -r -d '' item; do
  args+=( "$item" )
done <file
git log --shortstat --since "01.06.2020" --until "1.12.2020" -- "${args[@]}" | ...
                                                            ^^^^

As noted, don't forget the double-hyphen -- (I mentioned that syntax here)

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250