summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e54eef9)
raw | patch | inline | side by side (parent: e54eef9)
author | Jürgen Rühle <j-r@online.de> | |
Tue, 2 Jan 2007 19:26:22 +0000 (20:26 +0100) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Wed, 3 Jan 2007 07:43:21 +0000 (23:43 -0800) |
Previously git-status in a clean working directory would advice the user to use
git add. This isn't very helpful when there is nothing to add in the working
directory, therefore note a clean working directory while displaying the other
sections and print the appropriate message for each case.
Signed-off-by: Jürgen Rühle <j-r@online.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
git add. This isn't very helpful when there is nothing to add in the working
directory, therefore note a clean working directory while displaying the other
sections and print the appropriate message for each case.
Signed-off-by: Jürgen Rühle <j-r@online.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
wt-status.c | patch | blob | history | |
wt-status.h | patch | blob | history |
diff --git a/wt-status.c b/wt-status.c
index 34be91b77c2391ad803bedb82c9fd9b28c59751a..ca4690e86b8684eb38909d455f543cf5914e9098 100644 (file)
--- a/wt-status.c
+++ b/wt-status.c
s->verbose = 0;
s->commitable = 0;
s->untracked = 0;
+
+ s->workdir_clean = 1;
}
static void wt_status_print_header(const char *main, const char *sub)
struct diff_options *options,
void *data)
{
+ struct wt_status *s = data;
int i;
- if (q->nr)
+ if (q->nr) {
+ s->workdir_clean = 0;
wt_status_print_header("Changed but not added", use_add_msg);
+ }
for (i = 0; i < q->nr; i++)
wt_status_print_filepair(WT_STATUS_CHANGED, q->queue[i]);
if (q->nr)
run_diff_files(&rev, 0);
}
-static void wt_status_print_untracked(const struct wt_status *s)
+static void wt_status_print_untracked(struct wt_status *s)
{
struct dir_struct dir;
const char *x;
continue;
}
if (!shown_header) {
+ s->workdir_clean = 0;
wt_status_print_header("Untracked files", use_add_msg);
shown_header = 1;
}
if (s->verbose && !s->is_initial)
wt_status_print_verbose(s);
- if (!s->commitable)
- printf("%s (%s)\n",
- s->amend ? "# No changes" : "nothing to commit",
- use_add_msg);
+ if (!s->commitable) {
+ if (s->amend)
+ printf("# No changes\n");
+ else if (s->workdir_clean)
+ printf(s->is_initial
+ ? "nothing to commit\n"
+ : "nothing to commit (working directory matches HEAD)\n");
+ else
+ printf("no changes added to commit (use \"git add\" and/or \"git commit [-a|-i|-o]\")\n");
+ }
}
int git_status_config(const char *k, const char *v)
diff --git a/wt-status.h b/wt-status.h
index 0a5a5b7ba9fc1d50c7dcab8220a4fb77ffecddb4..892a86c76abe69ce69327a10a5d491cc47f8e82b 100644 (file)
--- a/wt-status.h
+++ b/wt-status.h
int verbose;
int amend;
int untracked;
+ int workdir_clean;
};
int git_status_config(const char *var, const char *value);