Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-commit.sh: convert run_status to a C builtin
This creates a new git-runstatus which should do roughly the same thing as the run_status function from git-commit.sh. Except for color support, the main focus has been to keep the output identical, so that it can be verified as correct and then used as a C platform for other improvements to the status printing code. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
- Loading branch information
Showing
10 changed files
with
349 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#include "wt-status.h" | ||
#include "cache.h" | ||
|
||
extern int wt_status_use_color; | ||
|
||
static const char runstatus_usage[] = | ||
"git-runstatus [--color|--nocolor] [--amend] [--verbose]"; | ||
|
||
int cmd_runstatus(int argc, const char **argv, const char *prefix) | ||
{ | ||
struct wt_status s; | ||
int i; | ||
|
||
git_config(git_status_config); | ||
wt_status_prepare(&s); | ||
|
||
for (i = 1; i < argc; i++) { | ||
if (!strcmp(argv[i], "--color")) | ||
wt_status_use_color = 1; | ||
else if (!strcmp(argv[i], "--nocolor")) | ||
wt_status_use_color = 0; | ||
else if (!strcmp(argv[i], "--amend")) { | ||
s.amend = 1; | ||
s.reference = "HEAD^1"; | ||
} | ||
else if (!strcmp(argv[i], "--verbose")) | ||
s.verbose = 1; | ||
else | ||
usage(runstatus_usage); | ||
} | ||
|
||
wt_status_print(&s); | ||
return s.commitable ? 0 : 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.