Re: [PATCH REPLACEMENT for 2/2] git status: show relative paths when run in a subdirectory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Untracked files in the current dir don't include the relative path 
to the project-root, but changed/updated files do:

# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       new file: ../subdir/hello
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       world

With the patch below (on top of your changes), the output becomes

# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       new file: hello
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       world

Cheers,

- Michel

diff --git a/wt-status.c b/wt-status.c
index 0d25362..2cdc8ce 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -133,8 +133,8 @@ static void wt_status_print_filepair(struct wt_status *s,
 
        strbuf_init(&onebuf, 0);
        strbuf_init(&twobuf, 0);
-       one = quote_path(p->one->path, -1, &onebuf, s->prefix);
-       two = quote_path(p->two->path, -1, &twobuf, s->prefix);
+       one = quote_path(p->one->path, strlen(p->one->path), &onebuf, s->prefix);
+       two = quote_path(p->two->path, strlen(p->two->path), &twobuf, s->prefix);
 
        color_fprintf(s->fp, color(WT_STATUS_HEADER), "#\t");
        switch (p->status) {
@@ -233,7 +233,8 @@ static void wt_status_print_initial(struct wt_status *s)
        for (i = 0; i < active_nr; i++) {
                color_fprintf(s->fp, color(WT_STATUS_HEADER), "#\t");
                color_fprintf_ln(s->fp, color(WT_STATUS_UPDATED), "new file: %s",
-                               quote_path(active_cache[i]->name, -1,
+                               quote_path(active_cache[i]->name,
+                                       strlen(active_cache[i]->name),
                                           &buf, s->prefix));
        }
        if (active_nr)


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux