wt-status: Teach how to discard changes in the working directory

This is a question that comes up a lot in #git.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Anders Melchiorsen 2008-09-08 00:05:03 +02:00 committed by Junio C Hamano
parent bb914b14c9
commit 4d6e4c4d34
2 changed files with 11 additions and 0 deletions

View File

@ -46,6 +46,7 @@ cat > expect << \EOF
# #
# Changed but not updated: # Changed but not updated:
# (use "git add <file>..." to update what will be committed) # (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
# #
# modified: dir1/modified # modified: dir1/modified
# #
@ -76,6 +77,7 @@ cat >expect <<EOF
# #
# Changed but not updated: # Changed but not updated:
# (use "git add <file>..." to update what will be committed) # (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
# #
# modified: dir1/modified # modified: dir1/modified
# #
@ -104,6 +106,7 @@ cat >expect <<EOF
# #
# Changed but not updated: # Changed but not updated:
# (use "git add <file>..." to update what will be committed) # (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
# #
# modified: dir1/modified # modified: dir1/modified
# #
@ -138,6 +141,7 @@ cat >expect <<EOF
# #
# Changed but not updated: # Changed but not updated:
# (use "git add <file>..." to update what will be committed) # (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
# #
# modified: dir1/modified # modified: dir1/modified
# #
@ -174,6 +178,7 @@ cat > expect << \EOF
# #
# Changed but not updated: # Changed but not updated:
# (use "git add <file>..." to update what will be committed) # (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
# #
# modified: modified # modified: modified
# #
@ -204,6 +209,7 @@ cat > expect << \EOF
# #
# Changed but not updated: # Changed but not updated:
# (use "git add <file>..." to update what will be committed) # (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
# #
# modified: dir1/modified # modified: dir1/modified
# #
@ -267,6 +273,7 @@ cat >expect <<EOF
# #
# Changed but not updated: # Changed but not updated:
# (use "git add <file>..." to update what will be committed) # (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
# #
# modified: dir1/modified # modified: dir1/modified
# #
@ -297,6 +304,7 @@ cat >expect <<EOF
# #
# Changed but not updated: # Changed but not updated:
# (use "git add <file>..." to update what will be committed) # (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
# #
# modified: dir1/modified # modified: dir1/modified
# #
@ -326,6 +334,7 @@ cat >expect <<EOF
# On branch master # On branch master
# Changed but not updated: # Changed but not updated:
# (use "git add <file>..." to update what will be committed) # (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
# #
# modified: dir1/modified # modified: dir1/modified
# #
@ -357,6 +366,7 @@ cat >expect <<EOF
# #
# Changed but not updated: # Changed but not updated:
# (use "git add <file>..." to update what will be committed) # (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
# #
# modified: dir1/modified # modified: dir1/modified
# #

View File

@ -79,6 +79,7 @@ static void wt_status_print_dirty_header(struct wt_status *s,
color_fprintf_ln(s->fp, c, "# (use \"git add <file>...\" to update what will be committed)"); color_fprintf_ln(s->fp, c, "# (use \"git add <file>...\" to update what will be committed)");
else else
color_fprintf_ln(s->fp, c, "# (use \"git add/rm <file>...\" to update what will be committed)"); color_fprintf_ln(s->fp, c, "# (use \"git add/rm <file>...\" to update what will be committed)");
color_fprintf_ln(s->fp, c, "# (use \"git checkout -- <file>...\" to discard changes in working directory)");
color_fprintf_ln(s->fp, c, "#"); color_fprintf_ln(s->fp, c, "#");
} }