Re: preview of "What's cooking" (topics)

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

 



Junio C Hamano writes:
 >  - Jürgen's git-status improvements are mostly in 'next' but
 >    one of them is queued in 'pu', waiting for comments.

Here is a more detailed breakdown of the reasoning behind the
remaining change in (slightly massaged) git-log format. Especially
the usage of 'cached' and 'unstage' might not be that helpful.

==========

    Add "cached" to cached content header in status output
    
    Since we direct the user to use git-rm --cached this might be a good way to
    clarify it without loosing many words.
    
diff --git a/wt-status.c b/wt-status.c
index 8696e5b..e6355c6 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -56,7 +56,7 @@ void wt_status_prepare(struct wt_status *s)
 static void wt_status_print_cached_header(const char *reference)
 {
 	const char *c = color(WT_STATUS_HEADER);
-	color_printf_ln(c, "# Changes to be committed:");
+	color_printf_ln(c, "# Cached changes to be committed:");
 	if (reference) {
 		color_printf_ln(c, "#   (use \"git reset %s <file>...\" and \"git rm --cached <file>...\" to unstage)", reference);
 	} else {

==========

    Add unstaging hint to status output
    
    If reference commit name is provided advertise git-reset otherwise instruct the
    user to use git-rm --cached. The latter case is needed to handle the initial
    commit.
    
    Note that git-rm --cached is currently needed even if we have a reference
    commit, since git-reset cannot remove freshly added files from the index (yet).
    
diff --git a/wt-status.c b/wt-status.c
index 82b76d5..8696e5b 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -57,6 +57,11 @@ static void wt_status_print_cached_header(const char *reference)
 {
 	const char *c = color(WT_STATUS_HEADER);
 	color_printf_ln(c, "# Changes to be committed:");
+	if (reference) {
+		color_printf_ln(c, "#   (use \"git reset %s <file>...\" and \"git rm --cached <file>...\" to unstage)", reference);
+	} else {
+		color_printf_ln(c, "#   (use \"git rm --cached <file>...\" to unstage)");
+	}
 	color_printf_ln(c, "#");
 }
 

==========

    Simplify cached content header in status output
    
    Replace awkward "Added but not yet committed (will commit)" by a simple
    "Changes to be committed".
    
diff --git a/wt-status.c b/wt-status.c
index 1959238..82b76d5 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -56,8 +56,7 @@ void wt_status_prepare(struct wt_status *s)
 static void wt_status_print_cached_header(const char *reference)
 {
 	const char *c = color(WT_STATUS_HEADER);
-	color_printf_ln(c, "# Added but not yet committed:");
-	color_printf_ln(c, "#   (will commit):");
+	color_printf_ln(c, "# Changes to be committed:");
 	color_printf_ln(c, "#");
 }
 

==========

    Refactor printing of cached content header of status output
    
    Since this header is printed in two different code paths and the name of the
    reference commit will be needed for the future unstaging hint, provide a new
    printing function.
    
diff --git a/wt-status.c b/wt-status.c
index db42738..1959238 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -53,6 +53,14 @@ void wt_status_prepare(struct wt_status *s)
 	s->untracked = 0;
 }
 
+static void wt_status_print_cached_header(const char *reference)
+{
+	const char *c = color(WT_STATUS_HEADER);
+	color_printf_ln(c, "# Added but not yet committed:");
+	color_printf_ln(c, "#   (will commit):");
+	color_printf_ln(c, "#");
+}
+
 static void wt_status_print_header(const char *main, const char *sub)
 {
 	const char *c = color(WT_STATUS_HEADER);
@@ -147,8 +155,7 @@ static void wt_status_print_updated_cb(struct diff_queue_struct *q,
 		if (q->queue[i]->status == 'U')
 			continue;
 		if (!shown_header) {
-			wt_status_print_header("Added but not yet committed",
-					"will commit");
+			wt_status_print_cached_header(s->reference);
 			s->commitable = 1;
 			shown_header = 1;
 		}
@@ -179,8 +186,7 @@ void wt_status_print_initial(struct wt_status *s)
 	read_cache();
 	if (active_nr) {
 		s->commitable = 1;
-		wt_status_print_header("Added but not yet committed",
-				"will commit");
+		wt_status_print_cached_header(NULL);
 	}
 	for (i = 0; i < active_nr; i++) {
 		color_printf(color(WT_STATUS_HEADER), "#\t");

-
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]