Skip to content

Commit 4366247

Browse files
authored
Merge pull request #1347 from luukvbaal/patches
Fix patch conflicts and rebase
2 parents cc965d1 + 7793cb8 commit 4366247

File tree

4 files changed

+80
-84
lines changed

4 files changed

+80
-84
lines changed

patches/gitstatus/mainline.diff

+17-17
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
# Authors: Luuk van Baal
77

88
diff --git a/src/nnn.c b/src/nnn.c
9-
index 1028906a..c80314de 100644
9+
index 508ee915..77d56d63 100644
1010
--- a/src/nnn.c
1111
+++ b/src/nnn.c
12-
@@ -262,6 +262,25 @@
12+
@@ -265,6 +265,25 @@
1313
#define FREE 0
1414
#define CAPACITY 1
1515

@@ -35,23 +35,23 @@ index 1028906a..c80314de 100644
3535
/* TYPE DEFINITIONS */
3636
typedef unsigned int uint_t;
3737
typedef unsigned char uchar_t;
38-
@@ -286,6 +305,7 @@ typedef struct entry {
38+
@@ -289,6 +308,7 @@ typedef struct entry {
3939
uid_t uid; /* 4 bytes */
4040
gid_t gid; /* 4 bytes */
4141
#endif
4242
+ char git_status[2][5];
4343
} *pEntry;
4444

4545
/* Selection marker */
46-
@@ -342,6 +362,7 @@ typedef struct {
46+
@@ -345,6 +365,7 @@ typedef struct {
4747
uint_t cliopener : 1; /* All-CLI app opener */
4848
uint_t waitedit : 1; /* For ops that can't be detached, used EDITOR */
4949
uint_t rollover : 1; /* Roll over at edges */
5050
+ uint_t normalgit : 1; /* Show git status in normal mode */
5151
} settings;
5252

5353
/* Non-persistent program-internal states (alphabeical order) */
54-
@@ -391,7 +412,17 @@ typedef struct {
54+
@@ -394,7 +415,17 @@ typedef struct {
5555
} session_header_t;
5656
#endif
5757

@@ -69,15 +69,15 @@ index 1028906a..c80314de 100644
6969

7070
/* Configuration, contexts */
7171
static settings cfg = {
72-
@@ -422,6 +453,7 @@ static settings cfg = {
72+
@@ -425,6 +456,7 @@ static settings cfg = {
7373
0, /* cliopener */
7474
0, /* waitedit */
7575
1, /* rollover */
7676
+ 0, /* normalgit */
7777
};
7878

7979
static context g_ctx[CTX_MAX] __attribute__ ((aligned));
80-
@@ -3839,6 +3871,56 @@ static int get_kv_key(kv *kvarr, char *val, uchar_t max, uchar_t id)
80+
@@ -3838,6 +3870,56 @@ static int get_kv_key(kv *kvarr, char *val, uchar_t max, uchar_t id)
8181
return -1;
8282
}
8383

@@ -134,7 +134,7 @@ index 1028906a..c80314de 100644
134134
static void resetdircolor(int flags)
135135
{
136136
/* Directories are always shown on top, clear the color when moving to first file */
137-
@@ -4176,6 +4258,10 @@ static void printent(const struct entry *ent, uint_t namecols, bool sel)
137+
@@ -4182,6 +4264,10 @@ static void printent(const struct entry *ent, uint_t namecols, bool sel)
138138

139139
uchar_t color_pair = get_color_pair_name_ind(ent, &ind, &attrs);
140140

@@ -145,7 +145,7 @@ index 1028906a..c80314de 100644
145145
addch((ent->flags & FILE_SELECTED) ? '+' | A_REVERSE | A_BOLD : ' ');
146146

147147
if (g_state.oldcolor)
148-
@@ -5617,6 +5703,11 @@ static int dentfill(char *path, struct entry **ppdents)
148+
@@ -5630,6 +5716,11 @@ static int dentfill(char *path, struct entry **ppdents)
149149
attron(COLOR_PAIR(cfg.curctx + 1));
150150
}
151151

@@ -157,7 +157,7 @@ index 1028906a..c80314de 100644
157157
#if _POSIX_C_SOURCE >= 200112L
158158
posix_fadvise(fd, 0, 0, POSIX_FADV_SEQUENTIAL);
159159
#endif
160-
@@ -5815,6 +5906,29 @@ static int dentfill(char *path, struct entry **ppdents)
160+
@@ -5830,6 +5921,29 @@ static int dentfill(char *path, struct entry **ppdents)
161161
#endif
162162
}
163163

@@ -187,7 +187,7 @@ index 1028906a..c80314de 100644
187187
++ndents;
188188
} while ((dp = readdir(dirp)));
189189

190-
@@ -6360,11 +6474,12 @@ static int adjust_cols(int n)
190+
@@ -6373,11 +6487,12 @@ static int adjust_cols(int n)
191191
#endif
192192
if (cfg.showdetail) {
193193
/* Fallback to light mode if less than 35 columns */
@@ -203,23 +203,23 @@ index 1028906a..c80314de 100644
203203

204204
/* 2 columns for preceding space and indicator */
205205
return (n - 2);
206-
@@ -8126,6 +8241,7 @@ static void usage(void)
206+
@@ -8144,6 +8259,7 @@ static void usage(void)
207207
" -F val fifo mode [0:preview 1:explore]\n"
208208
#endif
209209
" -g regex filters\n"
210210
+ " -G always show git status\n"
211211
" -H show hidden files\n"
212212
" -i show current file info\n"
213-
" -J no auto-jump on select\n"
214-
@@ -8266,6 +8382,7 @@ static void cleanup(void)
215-
free(hostname);
213+
" -J no auto-jump on selection\n"
214+
@@ -8282,6 +8398,7 @@ static void cleanup(void)
215+
fflush(stdout);
216216
}
217217
#endif
218218
+ free(git_statuses.statuses);
219219
free(selpath);
220220
free(plgpath);
221221
free(cfgpath);
222-
@@ -8310,7 +8427,7 @@ int main(int argc, char *argv[])
222+
@@ -8326,7 +8443,7 @@ int main(int argc, char *argv[])
223223

224224
while ((opt = (env_opts_id > 0
225225
? env_opts[--env_opts_id]
@@ -228,7 +228,7 @@ index 1028906a..c80314de 100644
228228
switch (opt) {
229229
#ifndef NOFIFO
230230
case 'a':
231-
@@ -8361,6 +8478,9 @@ int main(int argc, char *argv[])
231+
@@ -8377,6 +8494,9 @@ int main(int argc, char *argv[])
232232
cfg.regex = 1;
233233
filterfn = &visible_re;
234234
break;

patches/gitstatus/namefirst.diff

+18-18
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
# Authors: Luuk van Baal
88

99
diff --git a/src/nnn.c b/src/nnn.c
10-
index af586056..9ebfb203 100644
10+
index ee1f5beb..91aab231 100644
1111
--- a/src/nnn.c
1212
+++ b/src/nnn.c
13-
@@ -262,6 +262,25 @@
13+
@@ -265,6 +265,25 @@
1414
#define FREE 0
1515
#define CAPACITY 1
1616

@@ -36,23 +36,23 @@ index af586056..9ebfb203 100644
3636
/* TYPE DEFINITIONS */
3737
typedef unsigned int uint_t;
3838
typedef unsigned char uchar_t;
39-
@@ -286,6 +305,7 @@ typedef struct entry {
39+
@@ -289,6 +308,7 @@ typedef struct entry {
4040
uid_t uid; /* 4 bytes */
4141
gid_t gid; /* 4 bytes */
4242
#endif
4343
+ char git_status[2][5];
4444
} *pEntry;
4545

4646
/* Selection marker */
47-
@@ -342,6 +362,7 @@ typedef struct {
47+
@@ -345,6 +365,7 @@ typedef struct {
4848
uint_t cliopener : 1; /* All-CLI app opener */
4949
uint_t waitedit : 1; /* For ops that can't be detached, used EDITOR */
5050
uint_t rollover : 1; /* Roll over at edges */
5151
+ uint_t normalgit : 1; /* Show git status in normal mode */
5252
} settings;
5353

5454
/* Non-persistent program-internal states (alphabeical order) */
55-
@@ -395,7 +416,17 @@ static struct {
55+
@@ -398,7 +419,17 @@ static struct {
5656
ushort_t maxnameln, maxsizeln, maxuidln, maxgidln, maxentln, uidln, gidln, printguid;
5757
} dtls;
5858

@@ -70,15 +70,15 @@ index af586056..9ebfb203 100644
7070

7171
/* Configuration, contexts */
7272
static settings cfg = {
73-
@@ -426,6 +457,7 @@ static settings cfg = {
73+
@@ -429,6 +460,7 @@ static settings cfg = {
7474
0, /* cliopener */
7575
0, /* waitedit */
7676
1, /* rollover */
7777
+ 0, /* normalgit */
7878
};
7979

8080
static context g_ctx[CTX_MAX] __attribute__ ((aligned));
81-
@@ -3847,6 +3879,56 @@ static int get_kv_key(kv *kvarr, char *val, uchar_t max, uchar_t id)
81+
@@ -3846,6 +3878,56 @@ static int get_kv_key(kv *kvarr, char *val, uchar_t max, uchar_t id)
8282
return -1;
8383
}
8484

@@ -135,7 +135,7 @@ index af586056..9ebfb203 100644
135135
static void resetdircolor(int flags)
136136
{
137137
/* Directories are always shown on top, clear the color when moving to first file */
138-
@@ -4157,6 +4239,9 @@ static void printent(const struct entry *ent, uint_t namecols, bool sel)
138+
@@ -4163,6 +4245,9 @@ static void printent(const struct entry *ent, uint_t namecols, bool sel)
139139
int attrs = 0, namelen;
140140
uchar_t color_pair = get_color_pair_name_ind(ent, &ind, &attrs);
141141

@@ -145,7 +145,7 @@ index af586056..9ebfb203 100644
145145
addch((ent->flags & FILE_SELECTED) ? '+' | A_REVERSE | A_BOLD : ' ');
146146

147147
if (g_state.oldcolor)
148-
@@ -5623,6 +5708,11 @@ static int dentfill(char *path, struct entry **ppdents)
148+
@@ -5636,6 +5721,11 @@ static int dentfill(char *path, struct entry **ppdents)
149149
attron(COLOR_PAIR(cfg.curctx + 1));
150150
}
151151

@@ -157,7 +157,7 @@ index af586056..9ebfb203 100644
157157
#if _POSIX_C_SOURCE >= 200112L
158158
posix_fadvise(fd, 0, 0, POSIX_FADV_SEQUENTIAL);
159159
#endif
160-
@@ -5821,6 +5911,29 @@ static int dentfill(char *path, struct entry **ppdents)
160+
@@ -5836,6 +5926,29 @@ static int dentfill(char *path, struct entry **ppdents)
161161
#endif
162162
}
163163

@@ -187,7 +187,7 @@ index af586056..9ebfb203 100644
187187
++ndents;
188188
} while ((dp = readdir(dirp)));
189189

190-
@@ -6357,7 +6470,8 @@ static int adjust_cols(int n)
190+
@@ -6374,7 +6487,8 @@ static int adjust_cols(int n)
191191
cfg.showdetail ^= 1;
192192
else /* 2 more accounted for below */
193193
n -= (dtls.maxentln - 2 - dtls.maxnameln);
@@ -197,7 +197,7 @@ index af586056..9ebfb203 100644
197197

198198
/* 2 columns for preceding space and indicator */
199199
return (n - 2);
200-
@@ -6512,7 +6626,7 @@ static void redraw(char *path)
200+
@@ -6529,7 +6643,7 @@ static void redraw(char *path)
201201
}
202202
#endif
203203
}
@@ -206,23 +206,23 @@ index af586056..9ebfb203 100644
206206
}
207207

208208
ncols = adjust_cols(ncols);
209-
@@ -8132,6 +8246,7 @@ static void usage(void)
209+
@@ -8154,6 +8268,7 @@ static void usage(void)
210210
" -F val fifo mode [0:preview 1:explore]\n"
211211
#endif
212212
" -g regex filters\n"
213213
+ " -G always show git status\n"
214214
" -H show hidden files\n"
215215
" -i show current file info\n"
216-
" -J no auto-jump on select\n"
217-
@@ -8272,6 +8387,7 @@ static void cleanup(void)
218-
free(hostname);
216+
" -J no auto-jump on selection\n"
217+
@@ -8292,6 +8407,7 @@ static void cleanup(void)
218+
fflush(stdout);
219219
}
220220
#endif
221221
+ free(git_statuses.statuses);
222222
free(selpath);
223223
free(plgpath);
224224
free(cfgpath);
225-
@@ -8316,7 +8432,7 @@ int main(int argc, char *argv[])
225+
@@ -8336,7 +8452,7 @@ int main(int argc, char *argv[])
226226

227227
while ((opt = (env_opts_id > 0
228228
? env_opts[--env_opts_id]
@@ -231,7 +231,7 @@ index af586056..9ebfb203 100644
231231
switch (opt) {
232232
#ifndef NOFIFO
233233
case 'a':
234-
@@ -8367,6 +8483,9 @@ int main(int argc, char *argv[])
234+
@@ -8387,6 +8503,9 @@ int main(int argc, char *argv[])
235235
cfg.regex = 1;
236236
filterfn = &visible_re;
237237
break;

0 commit comments

Comments
 (0)