janet-lang / jpm

Janet Project Manager
MIT License
72 stars 22 forks source link

Trim git output #26

Closed Jakski closed 3 years ago

Jakski commented 3 years ago

Solves #25

fatal: credential url cannot be parsed: https://github.com/janet-lang/spork.git

is actually output from https://github.com/git/git/blob/106298f7f9cca4158a980de149ef217751e1f943/credential.c#L512 which apparently tries to retrieve credentials upon seeing newline.

sogaiu commented 3 years ago

The trimming seems like a good idea to me.

I am not so sure about the conversion to a string. I guess we'll see :)

sogaiu commented 3 years ago

On second thought, I think if trimming and conversion to a string is ok, I think string/trimr is more appropriate.

Sometimes there is whitespace on the left I think one doesn't want lost.

As an example, some git subcommands encode info in the left "columns" of output which sometimes has non-whitespace and sometimes whitespace, e.g. git branch output might look like:

  dispatch-by-backslash
  doc-thread-new-loop
  ev
  hotfix-new-style-math-bindings
* master
  pr/672
  pr/726

I think it's easier to parse this sort of thing if the left-most whitespace is not removed. (In this example output, IIUC, the 2 leading spaces from the first row would be lost.)

Just my 2 cents.