feat: added a simple filesystem tree walk and the status cli command to get a list of untracked files
This commit is contained in:
parent
8b862f8b87
commit
c372a5f8bc
5 changed files with 174 additions and 7 deletions
|
|
@ -14,15 +14,15 @@ typedef enum {
|
|||
// Represents a deletion or insertion into the files text
|
||||
typedef struct {
|
||||
ActionType type;
|
||||
uint64_t line_original;
|
||||
uint64_t line_changed;
|
||||
size_t line_original;
|
||||
size_t line_changed;
|
||||
} Action;
|
||||
|
||||
// Dynamic array of Actions
|
||||
typedef struct {
|
||||
Action* actions;
|
||||
uint64_t capacity;
|
||||
uint64_t len;
|
||||
size_t capacity;
|
||||
size_t len;
|
||||
} ActionList;
|
||||
|
||||
ActionList* new_list();
|
||||
|
|
|
|||
24
include/tree.h
Normal file
24
include/tree.h
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#ifndef TREE_H
|
||||
#define TREE_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <dirent.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
typedef struct {
|
||||
char** paths;
|
||||
size_t len;
|
||||
size_t capacity;
|
||||
} PathBuffer;
|
||||
|
||||
PathBuffer* new_path_buffer();
|
||||
void add_path(PathBuffer*, char*);
|
||||
void free_path_buffer(PathBuffer*);
|
||||
char* find_root(const char*);
|
||||
void walk(const char*, const char*, PathBuffer*);
|
||||
|
||||
#endif // TREE_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue