nnn

mirror of https://github.com/jarun/nnn
Log | Files | Refs | README | LICENSE

commit d87e90042d0529162727382a7713c2bd98be4626
parent 83624f6349fb672a809afc02d691cf4ac8c08019
Author: Arun Prakash Jana <engineerarun@gmail.com>
Date:   Tue,  3 Feb 2026 02:16:46 +0530

Fix patches

Diffstat:
Mpatches/gitstatus/mainline.diff | 32++++++++++++++++----------------
Mpatches/gitstatus/namefirst.diff | 4++--
2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/patches/gitstatus/mainline.diff b/patches/gitstatus/mainline.diff @@ -12,7 +12,7 @@ index 936e9c02..22032dcd 100644 @@ -286,6 +286,25 @@ #define VFS_USED 1 #define VFS_SIZE 2 - + +/* Git icons */ +#ifdef NERD +#define GIT_ADD "" @@ -41,7 +41,7 @@ index 936e9c02..22032dcd 100644 #endif + char git_status[2][5]; } *pEntry; - + /* Selection marker */ @@ -365,6 +385,7 @@ typedef struct { uint_t cliopener : 1; /* All-CLI app opener */ @@ -49,12 +49,12 @@ index 936e9c02..22032dcd 100644 uint_t rollover : 1; /* Roll over at edges */ + uint_t normalgit : 1; /* Show git status in normal mode */ } settings; - + /* Non-persistent program-internal states (alphabeical order) */ @@ -418,7 +439,17 @@ typedef struct { } session_header_t; #endif - + +typedef struct { + char status[2]; + char path[PATH_MAX]; @@ -66,13 +66,13 @@ index 936e9c02..22032dcd 100644 + size_t len; + git_status_t *statuses; +} git_statuses; - + /* Configuration, contexts */ static settings cfg = { @@ -3950,6 +3981,47 @@ static int get_kv_key(kv *kvarr, char *val, uchar_t max, uchar_t id) return -1; } - + +static size_t get_git_statuses(const char *path) +{ + static char gst[] = "git -c core.quotePath= status -s --no-renames --ignored=matching -unormal . 2>/dev/null"; @@ -118,20 +118,20 @@ index 936e9c02..22032dcd 100644 { /* Directories are always shown on top, clear the color when moving to first file */ @@ -4283,6 +4355,10 @@ static void printent(int pdents_index, uint_t namecols, bool sel) - + uchar_t color_pair = get_color_pair_name_ind(ent, &ind, &attrs); - + + if (git_statuses.show && (cfg.showdetail || cfg.normalgit)) + printw("%*s%s%s", (cfg.normalgit && !cfg.showdetail) ? 1 : 0, "", + ent->git_status[0], ent->git_status[1]); + addch((ent->flags & FILE_SELECTED) ? '+' | A_REVERSE | A_BOLD : ' '); - + if (g_state.oldcolor) @@ -5788,6 +5864,11 @@ static int dentfill(char *path, struct entry **ppdents) attron(COLOR_PAIR(cfg.curctx + 1)); } - + + char linkpath[PATH_MAX]; + if ((git_statuses.len = get_git_statuses(path))) + if (!realpath(path, linkpath)) @@ -143,7 +143,7 @@ index 936e9c02..22032dcd 100644 @@ -5988,6 +6069,29 @@ static int dentfill(char *path, struct entry **ppdents) #endif } - + + if (git_statuses.len) { + char dentpath[PATH_MAX]; + size_t pathlen = mkpath(linkpath, dentp->name, dentpath); @@ -169,7 +169,7 @@ index 936e9c02..22032dcd 100644 + ++ndents; } while ((dp = readdir(dirp))); - + @@ -6569,11 +6673,12 @@ static int adjust_cols(int n) #endif if (cfg.showdetail) { @@ -183,7 +183,7 @@ index 936e9c02..22032dcd 100644 + n -= (git_statuses.show ? 34 : 32); + } else if (cfg.normalgit && git_statuses.show) + n -= 3; - + /* 2 columns for preceding space and indicator */ return (n - 2); @@ -8401,6 +8506,7 @@ static void usage(void) @@ -203,11 +203,11 @@ index 936e9c02..22032dcd 100644 free(plgpath); free(cfgpath); @@ -8589,7 +8696,7 @@ int main(int argc, char *argv[]) - + while ((opt = (env_opts_id > 0 ? env_opts[--env_opts_id] -- : getopt(argc, argv, "aAb:BcCdDeEfF:gHiJKl:nNop:P:QrRs:St:T:uUVx0h"))) != -1) { -+ : getopt(argc, argv, "aAb:BcCdDeEfF:gGHiJKl:nNop:P:QrRs:St:T:uUVx0h"))) != -1) { +- : getopt(argc, argv, "aAb:BcCdDeEfF:gHiJKl:nNop:P:QrRs:St:T:uUVxz0h"))) != -1) { ++ : getopt(argc, argv, "aAb:BcCdDeEfF:gGHiJKl:nNop:P:QrRs:St:T:uUVxz0h"))) != -1) { switch (opt) { #ifndef NOFIFO case 'a': diff --git a/patches/gitstatus/namefirst.diff b/patches/gitstatus/namefirst.diff @@ -209,8 +209,8 @@ index 88538787..d4af7c43 100644 while ((opt = (env_opts_id > 0 ? env_opts[--env_opts_id] -- : getopt(argc, argv, "aAb:BcCdDeEfF:gHiJKl:nNop:P:QrRs:St:T:uUVx0h"))) != -1) { -+ : getopt(argc, argv, "aAb:BcCdDeEfF:gGHiJKl:nNop:P:QrRs:St:T:uUVx0h"))) != -1) { +- : getopt(argc, argv, "aAb:BcCdDeEfF:gHiJKl:nNop:P:QrRs:St:T:uUVxz0h"))) != -1) { ++ : getopt(argc, argv, "aAb:BcCdDeEfF:gGHiJKl:nNop:P:QrRs:St:T:uUVxz0h"))) != -1) { switch (opt) { #ifndef NOFIFO case 'a':