nqminhuit / gis

Java Command Line Application which extends Git for supporting git-modules
2 stars 0 forks source link

Simplify `gis status` using `--porcelain=v1` #111

Open nqminhuit opened 4 months ago

nqminhuit commented 4 months ago

The output of command:

git status -sb --ignore-submodules --porcelain=v1

is:

## master...origin/master [ahead 1, behind 1]
AA aaaadddeed
AM mmm
D  text-11
UU text-2
 M text-25
UU text-33
 M text-5
M  text-50
 D text-8
MM text-9
?? m1/
?? mnew

exactly what we need, no need to add complexity to parse like with porcelain v2.

It also detect rename:

$ git status -sb --ignore-submodules --porcelain
## master...origin/master
R  text-1 -> text-1-rn_

Note: the ProcessBuilder#inheritIO will help maintain the color output from the command it runs. However the order of the output messed up.

code example:

    var p = new ProcessBuilder(commands).inheritIO().directory(directory).start();