diff --git a/README.md b/README.md index fb7f88c..8096080 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ symbol | meaning ---|--- `+`| staged changes `*`| unstaged changes - `_`| untracked files/folders + `?`| untracked files/folders The bookkeeping sub-commands are diff --git a/doc/README_CN.md b/doc/README_CN.md index fbeee09..2088e78 100644 --- a/doc/README_CN.md +++ b/doc/README_CN.md @@ -47,7 +47,7 @@ - `+`: 暂存(staged) - `*`: 未暂存(unstaged) -- `_`: 未追踪(untracked) +- `?`: 未追踪(untracked) 基础指令: diff --git a/gita/info.py b/gita/info.py index 91eb747..3af3178 100644 --- a/gita/info.py +++ b/gita/info.py @@ -199,8 +199,8 @@ def get_repo_status(prop: Dict[str, str], no_colors=False) -> str: head = get_head(prop["path"]) dirty, staged, untracked, color = _get_repo_status(prop, no_colors) if color: - return f'{color}{head+" "+dirty+staged+untracked:<10}{Color.end}' - return f'{head+" "+dirty+staged+untracked:<10}' + return f"{color}{head+' ['+dirty+staged+untracked+']':<13}{Color.end}" + return f"{head+' ['+dirty+staged+untracked+']':<13}" def get_repo_branch(prop: Dict[str, str]) -> str: @@ -215,7 +215,7 @@ def _get_repo_status(prop: Dict[str, str], no_colors: bool) -> Tuple[str]: flags = prop["flags"] dirty = "*" if run_quiet_diff(flags, [], path) else "" staged = "+" if run_quiet_diff(flags, ["--cached"], path) else "" - untracked = "_" if has_untracked(flags, path) else "" + untracked = "?" if has_untracked(flags, path) else "" if no_colors: return dirty, staged, untracked, "" diff --git a/tests/test_main.py b/tests/test_main.py index 6991c64..441c14a 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -130,12 +130,12 @@ def test_ls(self, monkeypatch, capfd): [ ( PATH_FNAME, - "repo1 cmaster dsu\x1b[0m msg \nrepo2 cmaster dsu\x1b[0m msg \nxxx cmaster dsu\x1b[0m msg \n", + "repo1 cmaster [dsu] \x1b[0m msg \nrepo2 cmaster [dsu] \x1b[0m msg \nxxx cmaster [dsu] \x1b[0m msg \n", ), (PATH_FNAME_EMPTY, ""), ( PATH_FNAME_CLASH, - "repo1 cmaster dsu\x1b[0m msg \nrepo2 cmaster dsu\x1b[0m msg \n", + "repo1 cmaster [dsu] \x1b[0m msg \nrepo2 cmaster [dsu] \x1b[0m msg \n", ), ], ) diff --git a/tests/test_utils.py b/tests/test_utils.py index c39c626..acf9853 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -115,17 +115,17 @@ def test_auto_group(repos, paths, expected): ( [{"abc": {"path": "/root/repo/", "type": "", "flags": []}}, False], True, - "abc \x1b[31mrepo *+_ \x1b[0m msg xx", + "abc \x1b[31mrepo [*+?] \x1b[0m msg xx", ), ( [{"abc": {"path": "/root/repo/", "type": "", "flags": []}}, True], True, - "abc repo *+_ msg xx", + "abc repo [*+?] msg xx", ), ( [{"repo": {"path": "/root/repo2/", "type": "", "flags": []}}, False], False, - "repo \x1b[32mrepo _ \x1b[0m msg xx", + "repo \x1b[32mrepo [?] \x1b[0m msg xx", ), ], )