Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ build/
assets/demo-dir
.cache/

test

compile_commands.json

.quickmarks
Expand Down
2 changes: 1 addition & 1 deletion include/cli.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <git2/types.h>
#include <stdio.h>

#define LASER_VERSION "1.7.0"
#define LASER_VERSION "1.7.1"

typedef struct laser_opts
{
Expand Down
13 changes: 7 additions & 6 deletions src/laser.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ void laser_process_single_file(laser_opts opts)
longest_ownername = strlen(ownername); // this has to be the longest name
// cus it be the ownly name

laser_print_entry(&entry, LASER_COLORS[LASER_COLOR_FILE].value, "", 0, opts,
1);
laser_handle_entry(&entry, opts.dir, "", 0, opts, 1);

free(entry.d);
}
Expand Down Expand Up @@ -295,14 +294,15 @@ static void laser_handle_entry(struct laser_dirent *entry,
strerror(errno));

ent->s = entry->s;
ent->d = malloc(offsetof(struct dirent, d_name) +
strlen(res_string) + 1);
ent->d = malloc(sizeof(struct dirent));
if (ent->d == NULL)
laser_logger_fatal(1, "Failed to allocate entry struct: %s",
strerror(errno));

strcpy(ent->d->d_name, res_string);

ent->git_status = entry->git_status;

laser_print_entry(ent, LASER_COLORS[LASER_COLOR_SYMLINK].value,
indent, depth, opts, is_last);

Expand Down Expand Up @@ -432,8 +432,9 @@ static void laser_print_entry(struct laser_dirent *entry, const char *color,

printf("%s%s%s%s%s", indent, branch, color, entry->d->d_name,
LASER_COLORS[LASER_COLOR_RESET].value);
if (entry->git_status && entry->git_status != ' ')
printf("\x1b[33m [%c]\x1b[0m", entry->git_status);
(entry->git_status && entry->git_status != ' ')
? printf("\x1b[33m [%c]\x1b[0m", entry->git_status)
: 0;
printf("\n");
}

Expand Down