git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Rast <trast@student.ethz.ch>
To: Junio C Hamano <gitster@pobox.com>
Cc: <git@vger.kernel.org>
Subject: Re: [PATCH 0/5] Revamping "git status"
Date: Wed, 5 Aug 2009 20:52:26 +0200	[thread overview]
Message-ID: <200908052052.28067.trast@student.ethz.ch> (raw)
In-Reply-To: <7v3a869lw1.fsf@alter.siamese.dyndns.org>

Junio C Hamano wrote:
> 
> -	while (pos <= active_nr) {
> +	while (pos < active_nr) {

Thanks, that fixes it.

It gives a weird output now, however:

  # On branch side
  # Unmerged paths:
  #   (use "git reset HEAD <file>..." to unstage)
  #   (use "git add <file>..." to mark resolution)
  #
  #	deleted by us       : foo
  #
  # Changed but not updated:
  #   (use "git add <file>..." to update what will be committed)
  #   (use "git checkout -- <file>..." to discard changes in working directory)
  #
  #
  no changes added to commit (use "git add" and/or "git commit -a")

So it detects there are worktree changes, but then decides not to show
them because it's an unmerged entry.  I think the following should go
in 3/5, but note that I haven't looked at the rest of the code to
check if it breaks anything:

-- 8< --
diff --git i/wt-status.c w/wt-status.c
index 6370fe2..5a68297 100644
--- i/wt-status.c
+++ w/wt-status.c
@@ -400,7 +400,8 @@ static int wt_status_check_worktree_changes(struct wt_status *s)
 	for (i = 0; i < s->change.nr; i++) {
 		struct wt_status_change_data *d;
 		d = s->change.items[i].util;
-		if (!d->worktree_status)
+		if (!d->worktree_status
+		    || d->index_status == DIFF_STATUS_UNMERGED)
 			continue;
 		changes = 1;
 		if (d->worktree_status == DIFF_STATUS_DELETED)
-- >8 --

And with that fixed, the test I posted earlier should be changed to
the following so that it checks the output (the old version detects
failure even for a working git-status, because that exits 1):

-- 8< --
diff --git a/t/t7060-wtstatus.sh b/t/t7060-wtstatus.sh
index 5ad2cd1..76b20b2 100755
--- a/t/t7060-wtstatus.sh
+++ b/t/t7060-wtstatus.sh
@@ -28,4 +28,29 @@ test_expect_success 'Report new path with conflict' '
 	test_cmp expect actual
 '
 
+cat > expect <<EOF
+# On branch side
+# Unmerged paths:
+#   (use "git reset HEAD <file>..." to unstage)
+#   (use "git add <file>..." to mark resolution)
+#
+#	deleted by us       : foo
+#
+no changes added to commit (use "git add" and/or "git commit -a")
+EOF
+
+test_expect_success 'M/D conflict does not segfault' '
+	mkdir mdconflict &&
+	cd mdconflict &&
+	git init &&
+	test_commit initial foo '' &&
+	test_commit modify foo foo &&
+	git checkout -b side HEAD^ &&
+	git rm foo &&
+	git commit -m delete &&
+	test_must_fail git merge master &&
+	test_must_fail git status > ../actual &&
+	test_cmp ../expect ../actual
+'
+
 test_done
-- >8 --

-- 
Thomas Rast
trast@{inf,student}.ethz.ch

  reply	other threads:[~2009-08-05 18:52 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-05  9:15 [PATCH 0/5] Revamping "git status" Junio C Hamano
2009-08-05  9:15 ` [PATCH 1/5] diff-index: report unmerged new entries Junio C Hamano
2009-08-05  9:15   ` [PATCH 2/5] diff-index: keep the original index intact Junio C Hamano
2009-08-05  9:15     ` [PATCH 3/5] wt-status.c: rework the way changes to the index and work tree are summarized Junio C Hamano
2009-08-05  9:15       ` [PATCH 4/5] status: show worktree status of conflicted paths separately Junio C Hamano
2009-08-05  9:15         ` [PATCH 5/5] shortstatus: a new command Junio C Hamano
2009-08-06 15:33           ` Jeff King
2009-08-06 16:23             ` Breaking "git status" (was Re: [PATCH 5/5] shortstatus: a new command) Junio C Hamano
2009-08-06 16:42               ` Jeff King
2009-08-06 19:06                 ` Breaking "git status" Junio C Hamano
2009-08-06 19:57               ` Breaking "git status" (was Re: [PATCH 5/5] shortstatus: a new command) Sverre Rabbelier
2009-08-06 14:53         ` [PATCH 4/5] status: show worktree status of conflicted paths separately Jeff King
2009-08-06 14:46       ` [PATCH 3/5] wt-status.c: rework the way changes to the index and work tree are summarized Jeff King
2009-08-06 15:50         ` Junio C Hamano
2009-08-05  9:49 ` [PATCH 0/5] Revamping "git status" Thomas Rast
2009-08-05 16:57   ` Junio C Hamano
2009-08-05 17:37     ` Thomas Rast
2009-08-05 17:40       ` Thomas Rast
2009-08-05 18:05         ` Junio C Hamano
2009-08-05 18:52           ` Thomas Rast [this message]
2009-08-05 20:02             ` Junio C Hamano
2009-08-05 20:14               ` Thomas Rast

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200908052052.28067.trast@student.ethz.ch \
    --to=trast@student.ethz.ch \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).