]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'jk/1.7.0-status'
authorJunio C Hamano <gitster@pobox.com>
Mon, 28 Dec 2009 07:01:32 +0000 (23:01 -0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 28 Dec 2009 07:01:32 +0000 (23:01 -0800)
* jk/1.7.0-status:
  status/commit: do not suggest "reset HEAD <path>" while merging
  commit/status: "git add <path>" is not necessarily how to resolve
  commit/status: check $GIT_DIR/MERGE_HEAD only once
  t7508-status: test all modes with color
  t7508-status: status --porcelain ignores relative paths setting
  status: reduce duplicated setup code
  status: disable color for porcelain format
  status -s: obey color.status
  builtin-commit: refactor short-status code into wt-status.c
  t7508-status.sh: Add tests for status -s
  status -s: respect the status.relativePaths option
  docs: note that status configuration affects only long format
  commit: support alternate status formats
  status: add --porcelain output format
  status: refactor format option parsing
  status: refactor short-mode printing to its own function
  status: typo fix in usage
  git status: not "commit --dry-run" anymore
  git stat -s: short status output
  git stat: the beginning of "status that is not a dry-run of commit"

Conflicts:
t/t4034-diff-words.sh
wt-status.c

1  2 
Documentation/git-commit.txt
builtin-commit.c
t/t4034-diff-words.sh
t/test-lib.sh
wt-status.c

index d227cec9ba566caa098c36e8c91b19a8a27fcae5,c45fbe4f9753df62299acc687f86dc672ba80860..c97c151ae1fdf53a09c5d3796ea6f6fb98b57b03
@@@ -69,11 -69,26 +69,25 @@@ OPTION
        Like '-C', but with '-c' the editor is invoked, so that
        the user can further edit the commit message.
  
 ---dry-run::
 -      Do not actually make a commit, but show the list of paths
 -      with updates in the index, paths with changes in the work tree,
 -      and paths that are untracked, similar to the one that is given
 -      in the commit log editor.
 +--reset-author::
 +      When used with -C/-c/--amend options, declare that the
 +      authorship of the resulting commit now belongs of the committer.
 +      This also renews the author timestamp.
  
+ --short::
+       When doing a dry-run, give the output in the short-format. See
+       linkgit:git-status[1] for details. Implies `--dry-run`.
+ --porcelain::
+       When doing a dry-run, give the output in a porcelain-ready
+       format. See linkgit:git-status[1] for details. Implies
+       `--dry-run`.
+ -z::
+       When showing `short` or `porcelain` status output, terminate
+       entries in the status output with NUL, instead of LF. If no
+       format is given, implies the `--porcelain` output format.
  -F <file>::
  --file=<file>::
        Take the commit message from the given file.  Use '-' to
Simple merge
index 1c21276c55400c594f71bc01eba17b0d3820b420,17621dd5a412620299f53eecb7e247b3829e25c5..2e2e103b31332ea2f74de5d5e6e49c00b13dfa8a
@@@ -49,9 -38,9 +39,9 @@@ cat > expect <<\EO
  <WHITE>index 330b04f..5ed8eff 100644<RESET>
  <WHITE>--- a/pre<RESET>
  <WHITE>+++ b/post<RESET>
- <BROWN>@@ -1,3 +1,7 @@<RESET>
+ <CYAN>@@ -1,3 +1,7 @@<RESET>
  <RED>h(4)<RESET><GREEN>h(4),hh[44]<RESET>
 -<RESET>
 +
  a = b + c<RESET>
  
  <GREEN>aa = a<RESET>
@@@ -65,34 -54,14 +55,34 @@@ test_expect_success 'word diff with run
  
  '
  
- <BROWN>@@ -1 +1 @@<RESET>
 +cat > expect <<\EOF
 +<WHITE>diff --git a/pre b/post<RESET>
 +<WHITE>index 330b04f..5ed8eff 100644<RESET>
 +<WHITE>--- a/pre<RESET>
 +<WHITE>+++ b/post<RESET>
- <BROWN>@@ -3,0 +4,4 @@<RESET> <RESET><MAGENTA>a = b + c<RESET>
++<CYAN>@@ -1 +1 @@<RESET>
 +<RED>h(4)<RESET><GREEN>h(4),hh[44]<RESET>
++<CYAN>@@ -3,0 +4,4 @@<RESET> <RESET><MAGENTA>a = b + c<RESET>
 +
 +<GREEN>aa = a<RESET>
 +
 +<GREEN>aeff = aeff * ( aaa )<RESET>
 +EOF
 +
 +test_expect_success 'word diff without context' '
 +
 +      word_diff --color-words --unified=0
 +
 +'
 +
  cat > expect <<\EOF
  <WHITE>diff --git a/pre b/post<RESET>
  <WHITE>index 330b04f..5ed8eff 100644<RESET>
  <WHITE>--- a/pre<RESET>
  <WHITE>+++ b/post<RESET>
- <BROWN>@@ -1,3 +1,7 @@<RESET>
+ <CYAN>@@ -1,3 +1,7 @@<RESET>
  h(4),<GREEN>hh<RESET>[44]
 -<RESET>
 +
  a = b + c<RESET>
  
  <GREEN>aa = a<RESET>
@@@ -126,9 -95,9 +116,9 @@@ cat > expect <<\EO
  <WHITE>index 330b04f..5ed8eff 100644<RESET>
  <WHITE>--- a/pre<RESET>
  <WHITE>+++ b/post<RESET>
- <BROWN>@@ -1,3 +1,7 @@<RESET>
+ <CYAN>@@ -1,3 +1,7 @@<RESET>
  h(4)<GREEN>,hh[44]<RESET>
 -<RESET>
 +
  a = b + c<RESET>
  
  <GREEN>aa = a<RESET>
@@@ -168,9 -137,9 +158,9 @@@ cat > expect <<\EO
  <WHITE>index 330b04f..5ed8eff 100644<RESET>
  <WHITE>--- a/pre<RESET>
  <WHITE>+++ b/post<RESET>
- <BROWN>@@ -1,3 +1,7 @@<RESET>
+ <CYAN>@@ -1,3 +1,7 @@<RESET>
  h(4),<GREEN>hh[44<RESET>]
 -<RESET>
 +
  a = b + c<RESET>
  
  <GREEN>aa = a<RESET>
diff --cc t/test-lib.sh
index 2d523fe0f08dbbc1971f4601f24664cdbce95415,d63ad2d870423cd28b42993bf35fa0257df654a8..142f36f2e919929520d240e56b65f2b69e4b4982
@@@ -207,10 -204,21 +207,21 @@@ trap 'die' EXI
  test_set_editor () {
        FAKE_EDITOR="$1"
        export FAKE_EDITOR
 -      VISUAL='"$FAKE_EDITOR"'
 -      export VISUAL
 +      EDITOR='"$FAKE_EDITOR"'
 +      export EDITOR
  }
  
+ test_decode_color () {
+       sed     -e 's/.\[1m/<WHITE>/g' \
+               -e 's/.\[31m/<RED>/g' \
+               -e 's/.\[32m/<GREEN>/g' \
+               -e 's/.\[33m/<YELLOW>/g' \
+               -e 's/.\[34m/<BLUE>/g' \
+               -e 's/.\[35m/<MAGENTA>/g' \
+               -e 's/.\[36m/<CYAN>/g' \
+               -e 's/.\[m/<RESET>/g'
+ }
  test_tick () {
        if test -z "${test_tick+set}"
        then
diff --cc wt-status.c
index 38eb24536b34e40af4c43eb1631e08624e8993d6,c4589055bb7d6b8e945477d09e0015fe2da349af..5d569880163cccec91fdf1e9d50e03a6b5314d58
@@@ -47,10 -47,11 +47,13 @@@ void wt_status_prepare(struct wt_statu
  static void wt_status_print_unmerged_header(struct wt_status *s)
  {
        const char *c = color(WT_STATUS_HEADER, s);
        color_fprintf_ln(s->fp, c, "# Unmerged paths:");
-       if (!s->is_initial)
 +      if (!advice_status_hints)
 +              return;
+       if (s->in_merge)
+               ;
+       else if (!s->is_initial)
                color_fprintf_ln(s->fp, c, "#   (use \"git reset %s <file>...\" to unstage)", s->reference);
        else
                color_fprintf_ln(s->fp, c, "#   (use \"git rm --cached <file>...\" to unstage)");
  static void wt_status_print_cached_header(struct wt_status *s)
  {
        const char *c = color(WT_STATUS_HEADER, s);
        color_fprintf_ln(s->fp, c, "# Changes to be committed:");
-       if (!s->is_initial) {
 +      if (!advice_status_hints)
 +              return;
+       if (s->in_merge)
+               ; /* NEEDSWORK: use "git reset --unresolve"??? */
+       else if (!s->is_initial)
                color_fprintf_ln(s->fp, c, "#   (use \"git reset %s <file>...\" to unstage)", s->reference);
-       } else {
+       else
                color_fprintf_ln(s->fp, c, "#   (use \"git rm --cached <file>...\" to unstage)");
-       }
        color_fprintf_ln(s->fp, c, "#");
  }
  
@@@ -76,9 -77,8 +81,10 @@@ static void wt_status_print_dirty_heade
                                         int has_deleted)
  {
        const char *c = color(WT_STATUS_HEADER, s);
        color_fprintf_ln(s->fp, c, "# Changed but not updated:");
 +      if (!advice_status_hints)
 +              return;
        if (!has_deleted)
                color_fprintf_ln(s->fp, c, "#   (use \"git add <file>...\" to update what will be committed)");
        else