4 Commits
v3.0 ... v3.2

Author SHA1 Message Date
0e3a7a84e6 add new eyes for when the current repo is in the middle of a merge 2025-04-27 17:30:04 -05:00
68634537c0 fix bug where XD would segfault if the cwd didn't exist
also include errno so we can check it
2025-04-25 02:33:02 -05:00
529ac333ea make sure compile_commands.json doesn't end up in the repo 2025-02-27 12:45:48 -06:00
50aa5f157f typo :( 2025-02-27 12:45:40 -06:00
4 changed files with 15 additions and 4 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
*.o
XD
compile_commands.json

1
XD.1
View File

@ -24,6 +24,7 @@ c;l.
:;default
\;;in a git repo
8;in a git repo with stashed changes
X;in a git repo during a merge
B;in a git repo with no commits
.TE
.Ss Nose

15
XD.c
View File

@ -3,7 +3,10 @@
#include <string.h>
#include <ctype.h>
#if defined(ERR) || defined(EXPLAIN)
#ifdef ERR
#include <errno.h>
#endif
#if defined(EXPLAIN) || defined(ERR)
#include <stdarg.h>
#endif
@ -62,9 +65,12 @@ char
struct stat s;
int i, c;
/* find the number of jumps to the root of the fs */
rpath = realpath(path, NULL);
if (!rpath) {
L("realpath: %s", strerror(errno));
return NULL;
}
for (i = c = 0; i < strlen(rpath); i++) {
if (rpath[i] == '/') {
c++;
@ -281,6 +287,9 @@ main(int argc, char *argv[])
if (has_stashes(repo)) {
E("The current git repo has stashed changes.")
P("8"); /* goggle eyes if we have some stashed changes */
} else if (git_repository_state(repo) == GIT_REPOSITORY_STATE_MERGE) {
E("The current git repo is in the middle of a merge.")
P("X"); /* laughing eyes cause the user is fucked */
} else if (git_repository_is_empty(repo)) {
E("This is a new git repo.")
P("B"); /* sunglasses if we're in a new repo with no HEAD */
@ -291,7 +300,7 @@ main(int argc, char *argv[])
/* change the nose depending on the current git repo's status */
if (has_staged(repo)) {
E("The're staged changes.")
E("They're staged changes.")
P("*"); /* change to broken nose for staged changes */
} else if (has_untracked(repo)) {
E("There are untracked changes in the repository.")

View File

@ -1,4 +1,4 @@
VERSION = 3.0
VERSION = 3.2
PKG_CONFIG = pkg-config