Skip to contentSkip to conversation

Suggest use of "git add file1 file2" when there is nothing to commit.

PATCH In review Shawn O. Pearce 5 participants 26 messages Jun 15, 2016 – Aug 11, 2016

lore
Share & tools
lore
#1 lore raw
In reply to Shawn O. Pearce

Hi,

Am Freitag, den 15.12.2006, 21:53 -0500 schrieb Shawn O. Pearce:
...

wt-status.c void wt_status_print(struct wt_status *s) · line 297

Quoted 9 lines
wt-status.c +3 -1
@@ -292,7 +291,9 @@ void wt_status_print(struct wt_status *s)
 	if (s->verbose && !s->is_initial)
 		wt_status_print_verbose(s);
 	if (!s->commitable)
-		printf("%s\n", s->amend ? "# No changes" : "nothing to commit");
+		printf("%s (%s)\n",
+			s->amend ? "# No changes" : "nothing to commit",
+			use_add_msg);
 }

I don't like the new 'nothing to commit (use "git add ... message")' message. I use git status very often to see if there is something to commit, but now there is always this annoying "use git add ..." message. I just want to see on what the branch is and if there is something to commit.

If there is something to commit I get the list of untracked or modified files with the use_add_msg and if I try to commit an empty tree as initial commit I get the message from git-commit.sh.

bye

#2 lore raw
Quoted 9 lines · Michael Loeffler

Am Freitag, den 15.12.2006, 21:53 -0500 schrieb Shawn O. Pearce:
...

wt-status.c void wt_status_print(struct wt_status *s) · line 297

Quoted 4 lines
wt-status.c +3 -0
+		printf("%s (%s)\n",
+			s->amend ? "# No changes" : "nothing to commit",
+			use_add_msg);
 }

I don't like the new 'nothing to commit (use "git add ... message")' message. I use git status very often to see if there is something to commit, but now there is always this annoying "use git add ..." message.

I tend to not like _ANY_ change at all, but I've learned to wait and see if I get used to it when I see something that annoys me initially, to see if the annoyance is because what it does is truly wrong or it is because what it does is merely different from what I am used to.

So I've been trying it out myself as one of the guinea pigs on this one as well.

So far, my judgement is that this is of the better kind; it is easy to get used to, and once you get used to it, it is easily ignorable.

Other people's tastes may differ, of course.

#3 lore raw
Quoted 18 lines · Junio C Hamano
Quoted 9 lines · Michael Loeffler

Am Freitag, den 15.12.2006, 21:53 -0500 schrieb Shawn O. Pearce:
...

Review

Quoted 4 lines
(quoted diff) +3 -0
+		printf("%s (%s)\n",
+			s->amend ? "# No changes" : "nothing to commit",
+			use_add_msg);
 }

I don't like the new 'nothing to commit (use "git add ... message")' message. I use git status very often to see if there is something to commit, but now there is always this annoying "use git add ..." message.

I tend to not like _ANY_ change at all, but I've learned to wait and see if I get used to it when I see something that annoys me initially, to see if the annoyance is because what it does is truly wrong or it is because what it does is merely different from what I am used to.

Quoted 6 lines

So I've been trying it out myself as one of the guinea pigs on this one as well.

So far, my judgement is that this is of the better kind; it is easy to get used to, and once you get used to it, it is easily ignorable.

How about doing this?

-- >8 --
git-status: squelch "use 'git add file...'" message when unneeded

Add a field in wt_status to record if there are any uncached changes, and use it to decide when there is no point to add the "use 'git add'" message.

---

wt-status.c +17 -9
index db42738..1037c94 100644
@@ -15,7 +15,7 @@ static char wt_status_colors[][COLOR_MAXLEN] = {
 	"\033[31m", /* WT_STATUS_CHANGED: red */
 	"\033[31m", /* WT_STATUS_UNTRACKED: red */
 };
-static const char* use_add_msg = "use \"git add file1 file2\" to include for commit";
+static const char* use_add_msg = "use \"git add file...\" to include for commit";
 
 static int parse_status_slot(const char *var, int offset)
 {
@@ -162,13 +162,17 @@ static void wt_status_print_changed_cb(struct diff_queue_struct *q,
                         struct diff_options *options,
                         void *data)
 {
+	struct wt_status *s = (struct wt_status *)data;
 	int i;
-	if (q->nr)
-		wt_status_print_header("Changed but not added", use_add_msg);
+
+	s->modified = q->nr;
+	if (!q->nr)
+		return;
+
+	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)
-		wt_status_print_trailer();
+	wt_status_print_trailer();
 }
 
 void wt_status_print_initial(struct wt_status *s)
@@ -291,10 +295,14 @@ void wt_status_print(struct wt_status *s)
 
 	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) {
+		const char *msg =
+			s->amend ? "# No changes" : "nothing to commit";
+		if (s->modified)
+			printf("%s (%s)\n", msg, use_add_msg);
+		else
+			printf("%s\n", msg);
+	}
 }
 
 int git_status_config(const char *k, const char *v)
wt-status.h +1 -0
index 0a5a5b7..72df1b3 100644
@@ -13,6 +13,7 @@ struct wt_status {
 	char *branch;
 	const char *reference;
 	int commitable;
+	int modified;
 	int verbose;
 	int amend;
 	int untracked;
#4 lore raw
Quoted 27 lines · Junio C Hamano
Quoted 18 lines · Junio C Hamano
Quoted 9 lines · Michael Loeffler

Am Freitag, den 15.12.2006, 21:53 -0500 schrieb Shawn O. Pearce:
...

Review

Quoted 4 lines
(quoted diff) +3 -0
+		printf("%s (%s)\n",
+			s->amend ? "# No changes" : "nothing to commit",
+			use_add_msg);
 }

I don't like the new 'nothing to commit (use "git add ... message")' message. I use git status very often to see if there is something to commit, but now there is always this annoying "use git add ..." message.

I tend to not like _ANY_ change at all, but I've learned to wait and see if I get used to it when I see something that annoys me initially, to see if the annoyance is because what it does is truly wrong or it is because what it does is merely different from what I am used to.

Quoted 6 lines

So I've been trying it out myself as one of the guinea pigs on this one as well.

So far, my judgement is that this is of the better kind; it is easy to get used to, and once you get used to it, it is easily ignorable.

Quoted 8 lines

How about doing this?

-- >8 --
git-status: squelch "use 'git add file...'" message when unneeded

Add a field in wt_status to record if there are any uncached changes, and use it to decide when there is no point to add the "use 'git add'" message.

Commit 6e458bf63f48fb7d15cb70ad7c7b7b71915d94a2 in next is already doing exactly that. Or am I missing something?

#5 lore raw
Quoted 11 lines · Juergen Ruehle
Quoted 8 lines

How about doing this?

-- >8 --
git-status: squelch "use 'git add file...'" message when unneeded

Add a field in wt_status to record if there are any uncached changes, and use it to decide when there is no point to add the "use 'git add'" message.

Commit 6e458bf63f48fb7d15cb70ad7c7b7b71915d94a2 in next is already doing exactly that. Or am I missing something?

If there is something you are missing, it is that I am overloaded these days ;-).

Thanks for the reminder.

#6 lore raw
Quoted 2 lines · Junio C Hamano

If there is something you are missing, it is that I am overloaded these days ;-).

I'm sorry. As a rather unsuccessful former maintainer of
http://www.openarchitectureware.org/ I can fully appreciate git's luck to have such a dedicated maintainer.

#7 lore raw
Quoted 7 lines · Juergen Ruehle
Quoted 2 lines · Junio C Hamano

If there is something you are missing, it is that I am overloaded these days ;-).

I'm sorry. As a rather unsuccessful former maintainer of
http://www.openarchitectureware.org/ I can fully appreciate git's luck to have such a dedicated maintainer.

Actually there is one difference that I found practically important. It usually is a norm for me to have a handful untracked files that I do not even bother adding to .gitignore in the repository. My patch does not suggest "add" when there are untracked files but no locally modified files.

#8 lore raw
Quoted 10 lines · Junio C Hamano
Quoted 7 lines · Juergen Ruehle
Quoted 2 lines · Junio C Hamano

If there is something you are missing, it is that I am overloaded these days ;-).

I'm sorry. As a rather unsuccessful former maintainer of
http://www.openarchitectureware.org/ I can fully appreciate git's luck to have such a dedicated maintainer.

Quoted 5 lines

Actually there is one difference that I found practically important. It usually is a norm for me to have a handful untracked files that I do not even bother adding to .gitignore in the repository. My patch does not suggest "add" when there are untracked files but no locally modified files.

Yes. I don't have a real preference. I have a slight suspicion that the hint is useful for newbies because having only untracked files is the initial situation, but the hint in my patch is actually wrong because git-commit won't help in this situation. Do you want to revert the patch and apply yours or should I send a correction?

#9 lore raw
Quoted 17 lines · Juergen Ruehle
Quoted 10 lines · Junio C Hamano
Quoted 7 lines · Juergen Ruehle
Quoted 2 lines · Junio C Hamano

If there is something you are missing, it is that I am overloaded these days ;-).

I'm sorry. As a rather unsuccessful former maintainer of
http://www.openarchitectureware.org/ I can fully appreciate git's luck to have such a dedicated maintainer.

Quoted 5 lines

Actually there is one difference that I found practically important. It usually is a norm for me to have a handful untracked files that I do not even bother adding to .gitignore in the repository. My patch does not suggest "add" when there are untracked files but no locally modified files.

Quoted 5 lines

Yes. I don't have a real preference. I have a slight suspicion that the hint is useful for newbies because having only untracked files is the initial situation, but the hint in my patch is actually wrong because git-commit won't help in this situation. Do you want to revert the patch and apply yours or should I send a correction?

I think it is Ok to give hints for untracked files -- with experience eyes will learn to ignore them but by then they do not need hints. Please send in a correction as appropriate.

#10 lore raw

PATCH 1/1 Provide better feedback for the untracked only case in status output

From: =?utf-8?q?J=C3=BCrgen_R=C3=BChle?= <[email protected]>

Since 98bf8a47c296f51ea9722fef4bb81dbfb70cd4bb status would claim that git-commit could be useful even if there are no changes except untracked files.

Since wt-status is already computing all the information go the whole way and separately track the (non-)emptiness of all three sections, unify the code, and provide separate messages for each case. This adds a new message for the untracked only case and adds an explanation for a completely empty working directory during initial commit.

This change is effectively reverting 98bf8a47c296f51ea9722fef4bb81dbfb70cd4bb and replacing it by a cleaner version.

---

Quoted 3 lines · Junio C Hamano

I think it is Ok to give hints for untracked files -- with experience eyes will learn to ignore them but by then they do not need hints. Please send in a correction as appropriate.

This should provide useful feedback for the nothing to commit case in any situation. It is how I should have done it initially. Sorry for wasting your time.

Still missing:

- Further changes to the header messages (as discussed on the list)

- Patches to every other file that contains these messages verbatim

(AFAICS this affects only the git-reset man page, tutorial-2 and the VIM
syntax highlighting)

 wt-status.c |   21 ++++++++++++---------
 wt-status.h |    6 ++++--
 2 files changed, 16 insertions(+), 11 deletions(-)
wt-status.c +12 -9
index c48127d..5190bde 100644
@@ -47,10 +47,11 @@ void wt_status_prepare(struct wt_status *s)
 	s->reference = "HEAD";
 	s->amend = 0;
 	s->verbose = 0;
-	s->commitable = 0;
 	s->untracked = 0;
 
-	s->workdir_clean = 1;
+	s->commitable = 0;
+	s->workdir_dirty = 0;
+	s->workdir_untracked = 0;
 }
 
 static void wt_status_print_cached_header(const char *reference)
@@ -176,7 +177,7 @@ static void wt_status_print_changed_cb(struct diff_queue_struct *q,
 	struct wt_status *s = data;
 	int i;
 	if (q->nr) {
-		s->workdir_clean = 0;
+		s->workdir_dirty = 1;
 		wt_status_print_header("Changed but not added", use_add_msg);
 	}
 	for (i = 0; i < q->nr; i++)
@@ -263,7 +264,7 @@ static void wt_status_print_untracked(struct wt_status *s)
 				continue;
 		}
 		if (!shown_header) {
-			s->workdir_clean = 0;
+			s->workdir_untracked = 1;
 			wt_status_print_header("Untracked files", use_add_msg);
 			shown_header = 1;
 		}
@@ -311,12 +312,14 @@ void wt_status_print(struct wt_status *s)
 	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
+		else if (s->workdir_dirty)
 			printf("no changes added to commit (use \"git add\" and/or \"git commit [-a|-i|-o]\")\n");
+		else if (s->workdir_untracked)
+			printf("nothing added to commit but untracked files present (use \"git add\" to track)\n");
+		else if (s->is_initial)
+			printf("nothing to commit (working directory is empty)\n");
+		else
+			printf("nothing to commit (working directory matches HEAD)\n");
 	}
 }
 
wt-status.h +4 -2
index 892a86c..cfea4ae 100644
@@ -12,11 +12,13 @@ struct wt_status {
 	int is_initial;
 	char *branch;
 	const char *reference;
-	int commitable;
 	int verbose;
 	int amend;
 	int untracked;
-	int workdir_clean;
+	/* These are computed during processing of the individual sections */
+	int commitable;
+	int workdir_dirty;
+	int workdir_untracked;
 };
 
 int git_status_config(const char *var, const char *value);
Signature · 1 line
1.5.0.rc0.g525e
#11 lore raw

Re: [PATCH] Provide better feedback for the untracked only case in status output

hi,

Am Mittwoch, den 10.01.2007, 08:08 +0100 schrieb Juergen Ruehle:
...

Quoted 1 line
(quoted diff) +0 -0
@@ -311,12 +312,14 @@ void wt_status_print(struct wt_status *s)

...

wt-status.c void wt_status_print(struct wt_status *s) · line 320

Quoted 2 lines
wt-status.c +2 -0
+		else if (s->is_initial)
+			printf("nothing to commit (working directory is empty)\n");

Shouldn't the user know that there is nothing in his working directory?

wt-status.c void wt_status_print(struct wt_status *s) · line 322

Quoted 2 lines
wt-status.c +2 -0
+		else
+			printf("nothing to commit (working directory matches HEAD)\n");

How about s/matches HEAD/clean/

There is another thing:
# Changed but not added:
# (use "git add <file>..." to incrementally add content to commit)
#
# deleted: blah

How about adding some more hints (e.g.: git rm --cached <file>) depending on the diff_queue in wt_status_print_changed_cb()?

bye michael

#12 lore raw

PATCH 1/1 Provide better feedback for the untracked only case in status output

From: Jürgen Rühle <[email protected]>

Since 98bf8a47c296f51ea9722fef4bb81dbfb70cd4bb status would claim that git-commit could be useful even if there are no changes except untracked files.

Since wt-status is already computing all the information needed go the whole way and actually track the (non-)emptiness of all three sections separately, unify the code, and provide useful messages for each individual case.

Thanks to Junio and Michael Loeffler for suggestions.

---
This is a resend of the nothing-to-commit improvement patch (hopefully) without corruption. This also includes some changes due to feedback from Michael Loeffler.

Still missing:

- Further changes to the other messages (as discussed on the list)

- Patches to other files that contain these messages verbatim

(AFAICS this affects only the git-reset man page, tutorial-2 and the VIM
syntax highlighting)

 wt-status.c |   21 ++++++++++++---------
 wt-status.h |    6 ++++--
 2 files changed, 16 insertions(+), 11 deletions(-)
wt-status.c +12 -9
index c48127d..1dc2fdc 100644
@@ -47,10 +47,11 @@ void wt_status_prepare(struct wt_status *s)
 	s->reference = "HEAD";
 	s->amend = 0;
 	s->verbose = 0;
-	s->commitable = 0;
 	s->untracked = 0;
 
-	s->workdir_clean = 1;
+	s->commitable = 0;
+	s->workdir_dirty = 0;
+	s->workdir_untracked = 0;
 }
 
 static void wt_status_print_cached_header(const char *reference)
@@ -176,7 +177,7 @@ static void wt_status_print_changed_cb(struct diff_queue_struct *q,
 	struct wt_status *s = data;
 	int i;
 	if (q->nr) {
-		s->workdir_clean = 0;
+		s->workdir_dirty = 1;
 		wt_status_print_header("Changed but not added", use_add_msg);
 	}
 	for (i = 0; i < q->nr; i++)
@@ -263,7 +264,7 @@ static void wt_status_print_untracked(struct wt_status *s)
 				continue;
 		}
 		if (!shown_header) {
-			s->workdir_clean = 0;
+			s->workdir_untracked = 1;
 			wt_status_print_header("Untracked files", use_add_msg);
 			shown_header = 1;
 		}
@@ -311,12 +312,14 @@ void wt_status_print(struct wt_status *s)
 	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
+		else if (s->workdir_dirty)
 			printf("no changes added to commit (use \"git add\" and/or \"git commit [-a|-i|-o]\")\n");
+		else if (s->workdir_untracked)
+			printf("nothing added to commit but untracked files present (use \"git add\" to track)\n");
+		else if (s->is_initial)
+			printf("nothing to commit (create/copy files and use \"git add\" to track)\n");
+		else
+			printf("nothing to commit (working directory clean)\n");
 	}
 }
 
wt-status.h +4 -2
index 892a86c..cfea4ae 100644
@@ -12,11 +12,13 @@ struct wt_status {
 	int is_initial;
 	char *branch;
 	const char *reference;
-	int commitable;
 	int verbose;
 	int amend;
 	int untracked;
-	int workdir_clean;
+	/* These are computed during processing of the individual sections */
+	int commitable;
+	int workdir_dirty;
+	int workdir_untracked;
 };
 
 int git_status_config(const char *var, const char *value);
Signature · 1 line
1.5.0.rc0.g525e
#13 lore raw

Re: [PATCH] Provide better feedback for the untracked only case in status output

Quoted 3 lines · Juergen Ruehle

- Patches to other files that contain these messages verbatim (AFAICS this affects only the git-reset man page, tutorial-2 and the VIM syntax highlighting)

I have been tracking these changes for the vim highlighting, but have been waiting for things to settle before sending a patch (which should hopefully go into v1.5.0, but I will wait until this is finalized).

-Peff

#14 lore raw

Re: [PATCH] Provide better feedback for the untracked only case in status output

Quoted 9 lines · Jeff King
Quoted 3 lines · Juergen Ruehle

- Patches to other files that contain these messages verbatim (AFAICS this affects only the git-reset man page, tutorial-2 and the VIM syntax highlighting)

I have been tracking these changes for the vim highlighting, but have been waiting for things to settle before sending a patch (which should hopefully go into v1.5.0, but I will wait until this is finalized).

Thanks for tracking this. It would be nice if we could make the syntax highlighting less dependent on the exact wording.

#15 lore raw

Re: [PATCH] Provide better feedback for the untracked only case in status output

In reply to Michael Loeffler
Quoted 9 lines · Michael Loeffler

hi,

Am Mittwoch, den 10.01.2007, 08:08 +0100 schrieb Juergen Ruehle:
...

Quoted 1 line
(quoted diff) +0 -0
@@ -311,12 +312,14 @@ void wt_status_print(struct wt_status *s)

...

wt-status.c void wt_status_print(struct wt_status *s) · line 320

Quoted 2 lines
wt-status.c +2 -0
+		else if (s->is_initial)
+			printf("nothing to commit (working directory is empty)\n");

Shouldn't the user know that there is nothing in his working directory?

:-)

Well this is the state directly after git-init, e.g. the very first contact with git. Perhaps we should write:

nothing to commit (create files in the working directory and use git add)

Quoted 3 lines

wt-status.c void wt_status_print(struct wt_status *s) · line 322

Quoted 2 lines
wt-status.c +2 -0
+		else
+			printf("nothing to commit (working directory matches HEAD)\n");

How about s/matches HEAD/clean/

I like that.

Quoted 8 lines

There is another thing:
# Changed but not added:
# (use "git add <file>..." to incrementally add content to commit)
#
# deleted: blah

How about adding some more hints (e.g.: git rm --cached <file>) depending on the diff_queue in wt_status_print_changed_cb()?

Yes, there's always one more case to consider:-)

#16 lore raw

Re: [PATCH] Provide better feedback for the untracked only case in status output

In reply to Juergen Ruehle
Quoted 1 line · Juergen Ruehle

[Corrupted patch deleted]

Will try again when I know what happened.

#17 lore raw

Re: [PATCH] Provide better feedback for the untracked only case in status output

Quoted 2 lines · Juergen Ruehle
Quoted 1 line · Juergen Ruehle

[Corrupted patch deleted]

Actually the patch is ok as sent (somehow my MUA was adding CRs when locally saving the patch). Sorry for the noise.

#18 lore raw

Re: [PATCH] Provide better feedback for the untracked only case in status output

In reply to Juergen Ruehle
Quoted 4 lines · Juergen Ruehle
Quoted 1 line · Juergen Ruehle

[Corrupted patch deleted]

Will try again when I know what happened.

While you are at it, let me point out one thing that has been annoying me for a while.

This is an example e-mail I have been getting from you (the below is before decoding MIME):

From: Juergen Ruehle <[email protected]>
Subject: [PATCH] Provide better feedback for the ...
Date: Wed, 10 Jan 2007 08:08:12 +0100
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Cc: [email protected],

          =?utf-8?q?J=C3=BCrgen_R=C3=BChle?= <[email protected]>

X-Mailer: git-send-email 1.5.0.rc0.g525e

From: =3D?utf-8?q?J=3DC3=3DBCrgen_R=3DC3=3DBChle?=3D <[email protected]>

Since 98bf8a47c296f51ea9722fef4bb81dbfb70cd4bb status would claim that git-commit could be useful even if there are no changes except untracked = files.

Since wt-status is already computing all the information go the whole way=
and
separately track the (non-)emptiness of all three sections, unify the cod= e, and
provide separate messages for each case. This adds a new message for the untracked only case and adds an explanation for a completely empty workin= g
directory during initial commit.

This change is effectively reverting 98bf8a47c296f51ea9722fef4bb81dbfb70c= d4bb
and replacing it by a cleaner version.

Notice:

* The message claims to be from git-send-email;

* Content-Type and CTE are UTF-8 and QP (which is fine);

* You have in-body From: line; this is not wrong per-se and I understand why you would want one (your e-mail From: line uses ASCII approximations "ue" and "ue" and you would want the resulting commit to spell your name correctly).

* However, this in-body From: line is _doubly_ QP encoded (what you see above is your name, first RFC 2047 encoded and then QP encoded). It shouldn't be.

So, my questions are:

(1) is this what git-send-email generates and sends out by default? If so that means it is a bug in that program that needs to be fixed.

(2) if not, are you inserting the in-body From: by hand, perhaps cut & paste from format-patch output, before feeding git-send-email (which runs QP on it)?

If the latter, please do not paste the RFC 2047 quoted form. You can spell your name in raw UTF-8 on the in-body From: line just like you did on your Signed-off-by: line.

#19 lore raw

Re: [PATCH] Provide better feedback for the untracked only case in status output

Quoted 29 lines · Junio C Hamano
Quoted 4 lines · Juergen Ruehle
Quoted 1 line · Juergen Ruehle

[Corrupted patch deleted]

Will try again when I know what happened.

While you are at it, let me point out one thing that has been annoying me for a while.

* The message claims to be from git-send-email;

* Content-Type and CTE are UTF-8 and QP (which is fine);

* You have in-body From: line; this is not wrong per-se and I understand why you would want one (your e-mail From: line uses ASCII approximations "ue" and "ue" and you would want the resulting commit to spell your name correctly).

* However, this in-body From: line is _doubly_ QP encoded (what you see above is your name, first RFC 2047 encoded and then QP encoded). It shouldn't be.

So, my questions are:

(1) is this what git-send-email generates and sends out by default? If so that means it is a bug in that program that needs to be fixed.

Quoted 7 lines

(2) if not, are you inserting the in-body From: by hand, perhaps cut & paste from format-patch output, before feeding git-send-email (which runs QP on it)?

If the latter, please do not paste the RFC 2047 quoted form. You can spell your name in raw UTF-8 on the in-body From: line just like you did on your Signed-off-by: line.

Yes, this is using git-send-email which sends the mail as 8bit encoded and provides the QP encoded From line. Unfortunately there seems to be a gateway in between that doesn't handle 8bit and QPs the mail again. Perhaps I need some other switches for format-patch and send-email to produce a better result? I'll take another look at the documentation before annoying you again.

#20 lore raw

PATCH 1/1 Quick hack to avoid double qp encoding

From: Jürgen_Rühle <[email protected]>

---
This is just a hack since I know next to nothing about perl.

 git-send-email.perl |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
git-send-email.perl +1 -0
index ba39d39..a4a22d3 100755
@@ -555,6 +555,7 @@ foreach my $t (@files) {
 	}
 	close F;
 	if (defined $author_not_sender) {
+		$author_not_sender =~ s/=\?utf-8\?q\?([^?]*)\?=/my $bla = $1; $bla =~ s|=([0-9a-fA-F]{2})|sprintf '%c', hex($1)|eg; $bla/eg;
 		$message = "From: $author_not_sender\n\n$message";
 	}
 
Signature · 1 line
1.5.0.rc0.g525e
#21 lore raw

Re: [PATCH] Quick hack to avoid double qp encoding

Quoted 1 line · Juergen Ruehle

From: Jürgen_Rühle <[email protected]>

                ^

Ok, i should have also reverted the ' ' to '_' conversion, but it seems that send-email is to blame, because it simply copies the (possibly) QP encoded author address into the body of a (possibly) not QP encoded message.

Quoted 12 lines

---
This is just a hack since I know next to nothing about perl.

 git-send-email.perl |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
git-send-email.perl +0 -0
index ba39d39..a4a22d3 100755

git-send-email.perl foreach my $t (@files) { · line 558

Quoted 4 lines
git-send-email.perl +1 -0
@@ -555,6 +555,7 @@ foreach my $t (@files) {
 	}
 	close F;
 	if (defined $author_not_sender) {
+		$author_not_sender =~ s/=\?utf-8\?q\?([^?]*)\?=/my $bla = $1; $bla =~ s|=([0-9a-fA-F]{2})|sprintf '%c', hex($1)|eg; $bla/eg;

+ $author_not_sender =~ s/=\?utf-8\?q\?([^?]*)\?=/my $bla = $1; $bla =~ s|_| |g; $bla =~ s|=([0-9a-fA-F]{2})|sprintf '%c', hex($1)|eg; $bla/eg;

Quoted 5 lines
git-send-email.perl +0 -0
 		$message = "From: $author_not_sender\n\n$message";
 	}
 
Signature · 1 line
1.5.0.rc0.g525e
#22 lore raw

Re: [PATCH] Quick hack to avoid double qp encoding

Quoted 6 lines · Juergen Ruehle

Juergen Ruehle writes:

Ok, i should have also reverted the ' ' to '_' conversion, but it seems that send-email is to blame, because it simply copies the (possibly) QP encoded author address into the body of a (possibly) not QP encoded message.

Thanks. I think other people would want to hack on this, so I would make a separete sub to make it easier, like this:

git-send-email.perl +10 -0
index ba39d39..8dc2ee0 100755
@@ -402,6 +402,15 @@ sub make_message_id
 $cc = "";
 $time = time - scalar $#files;
 
+sub unquote_rfc2047 {
+	local ($_) = @_;
+	if (s/=\?utf-8\?q\?(.*)\?=/$1/g) {
+		s/_/ /g;
+		s/=([0-9A-F]{2})/chr(hex($1))/eg;
+	}
+	return "$_ - unquoted";
+}
+
 sub send_message
 {
 	my @recipients = unique_email_list(@to);
@@ -555,6 +564,7 @@ foreach my $t (@files) {
 	}
 	close F;
 	if (defined $author_not_sender) {
+		$author_not_sender = unquote_rfc2047($author_not_sender);
 		$message = "From: $author_not_sender\n\n$message";
 	}
 
#23 lore raw
In reply to Michael Loeffler
Quoted 19 lines · Michael Loeffler

Hi,

Am Freitag, den 15.12.2006, 21:53 -0500 schrieb Shawn O. Pearce:
...

wt-status.c void wt_status_print(struct wt_status *s) · line 297

Quoted 9 lines
wt-status.c +3 -1
@@ -292,7 +291,9 @@ void wt_status_print(struct wt_status *s)
 	if (s->verbose && !s->is_initial)
 		wt_status_print_verbose(s);
 	if (!s->commitable)
-		printf("%s\n", s->amend ? "# No changes" : "nothing to commit");
+		printf("%s (%s)\n",
+			s->amend ? "# No changes" : "nothing to commit",
+			use_add_msg);
 }

I don't like the new 'nothing to commit (use "git add ... message")' message. I use git status very often to see if there is something to commit, but now there is always this annoying "use git add ..." message. I just want to see on what the branch is and if there is something to commit.

Quoted 3 lines

If there is something to commit I get the list of untracked or modified files with the use_add_msg and if I try to commit an empty tree as initial commit I get the message from git-commit.sh.

I'd appreciate feedback on my series from the 2nd of January, especially part 3/4 (Subject: [PATCH 3/4] Improve "nothing to commit" part of status output). This is already part of next.

It removes the message if there really is nothing to commit and replaces it by a generic pointer to git add and git commit if there are pending changes in the working directory.

#24 lore raw

hi,

Am Samstag, den 06.01.2007, 15:02 +0100 schrieb Juergen Ruehle:
...

Quoted 3 lines

I'd appreciate feedback on my series from the 2nd of January, especially part 3/4 (Subject: [PATCH 3/4] Improve "nothing to commit" part of status output). This is already part of next.

A very positive feedback from me, I like this and it is much better then just removing this "use git add"-message. ;)

bye michael

#25 lore raw
Quoted 9 lines · Michael Loeffler

hi,

Am Samstag, den 06.01.2007, 15:02 +0100 schrieb Juergen Ruehle:
...

Quoted 3 lines

I'd appreciate feedback on my series from the 2nd of January, especially part 3/4 (Subject: [PATCH 3/4] Improve "nothing to commit" part of status output). This is already part of next.

A very positive feedback from me, I like this and it is much better then just removing this "use git add"-message. ;)

How about Junio's case where there are only untracked files in the working directory? I tend to send a patch that either just prints "nothing to commit" (simpler) or provides a different message that just advertises git-add.

#0 lore raw

PATCH 1/2 Suggest use of "git add file1 file2" when there is nothing to commit.

If a user modifies files and runs 'git commit' (without the very useful -a option) and they have not yet updated the index they are probably coming from another SCM-like tool which would perform the same as 'git commit -a' in this case. Showing the user their current status and a final line of "nothing to commit" is not very reassuring, as the user might believe that Git did not recognize their files were modified.

Instead we can suggest as part of the 'nothing to commit' message that the user invoke 'git add' to add files to their next commit.

Suggested by Andy Parkins' Git 'niggles' list
(<[email protected]>).

---
 git-commit.sh |    2 +-
 wt-status.c   |   11 ++++++-----
 2 files changed, 7 insertions(+), 6 deletions(-)
git-commit.sh +1 -1
index 05828bb..2672def 100755
@@ -515,7 +515,7 @@ then
 	current="$(git-rev-parse --verify HEAD)"
 else
 	if [ -z "$(git-ls-files)" ]; then
-		echo >&2 Nothing to commit
+		echo >&2 'nothing to commit (use "git add file1 file2" to include for commit)'
 		exit 1
 	fi
 	PARENTS=""
wt-status.c +6 -5
index 6e9414d..2173d4f 100644
@@ -15,6 +15,7 @@ static char wt_status_colors[][COLOR_MAXLEN] = {
 	"\033[31m", /* WT_STATUS_CHANGED: red */
 	"\033[31m", /* WT_STATUS_UNTRACKED: red */
 };
+static const char* use_add_msg = "use \"git add file1 file2\" to include for commit";
 
 static int parse_status_slot(const char *var, int offset)
 {
@@ -162,8 +163,7 @@ static void wt_status_print_changed_cb(struct diff_queue_struct *q,
 {
 	int i;
 	if (q->nr)
-		wt_status_print_header("Changed but not updated",
-				"use git-add on files to include for commit");
+		wt_status_print_header("Changed but not updated", use_add_msg);
 	for (i = 0; i < q->nr; i++)
 		wt_status_print_filepair(WT_STATUS_CHANGED, q->queue[i]);
 	if (q->nr)
@@ -249,8 +249,7 @@ static void wt_status_print_untracked(const struct wt_status *s)
 				continue;
 		}
 		if (!shown_header) {
-			wt_status_print_header("Untracked files",
-				"use \"git add\" to add to commit");
+			wt_status_print_header("Untracked files", use_add_msg);
 			shown_header = 1;
 		}
 		color_printf(color(WT_STATUS_HEADER), "#\t");
@@ -292,7 +291,9 @@ void wt_status_print(struct wt_status *s)
 	if (s->verbose && !s->is_initial)
 		wt_status_print_verbose(s);
 	if (!s->commitable)
-		printf("%s\n", s->amend ? "# No changes" : "nothing to commit");
+		printf("%s (%s)\n",
+			s->amend ? "# No changes" : "nothing to commit",
+			use_add_msg);
 }
 
 int git_status_config(const char *k, const char *v)
Signature · 1 line
1.4.4.2.g053a