git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael J Gruber <git@drmicha.warpmail.net>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
	Christian Couder <chriscool@tuxfamily.org>
Subject: [PATCH] replace: List replacement along with the object
Date: Thu, 25 Aug 2011 16:39:44 +0200	[thread overview]
Message-ID: <bae5a8f7d30417864d972390f9f6b4470cf4e5bf.1314283118.git.git@drmicha.warpmail.net> (raw)

The documentation could be misunderstood as if "git replace -l" lists
the replacements of the specified objects. Currently, it lists the
replaced objects.

Change the output to the form "<object> <replacement>" so that there is
an easy way to find the replacement, besides the more difficult to find
git show-ref $(git replace -l).

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
Noted in passing while testing decorations.
---
 Documentation/git-replace.txt |    2 +-
 builtin/replace.c             |    2 +-
 t/t6050-replace.sh            |    8 ++++----
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/Documentation/git-replace.txt b/Documentation/git-replace.txt
index 17df525..9bf3ff8 100644
--- a/Documentation/git-replace.txt
+++ b/Documentation/git-replace.txt
@@ -58,7 +58,7 @@ OPTIONS
 
 -l <pattern>::
 	List replace refs for objects that match the given pattern (or
-	all if no pattern is given).
+	all if no pattern is given) in the form "<object> <replacement>".
 	Typing "git replace" without arguments, also lists all replace
 	refs.
 
diff --git a/builtin/replace.c b/builtin/replace.c
index fe3a647..f8c5a9f 100644
--- a/builtin/replace.c
+++ b/builtin/replace.c
@@ -26,7 +26,7 @@ static int show_reference(const char *refname, const unsigned char *sha1,
 	const char *pattern = cb_data;
 
 	if (!fnmatch(pattern, refname, 0))
-		printf("%s\n", refname);
+		printf("%s %s\n", refname, sha1_to_hex(sha1));
 
 	return 0;
 }
diff --git a/t/t6050-replace.sh b/t/t6050-replace.sh
index 5c87f28..665b308 100755
--- a/t/t6050-replace.sh
+++ b/t/t6050-replace.sh
@@ -119,10 +119,10 @@ test_expect_success 'repack, clone and fetch work' '
 '
 
 test_expect_success '"git replace" listing and deleting' '
-     test "$HASH2" = "$(git replace -l)" &&
-     test "$HASH2" = "$(git replace)" &&
+     test "$HASH2 $R" = "$(git replace -l)" &&
+     test "$HASH2 $R" = "$(git replace)" &&
      aa=${HASH2%??????????????????????????????????????} &&
-     test "$HASH2" = "$(git replace -l "$aa*")" &&
+     test "$HASH2 $R" = "$(git replace -l "$aa*")" &&
      test_must_fail git replace -d $R &&
      test_must_fail git replace -d &&
      test_must_fail git replace -l -d $HASH2 &&
@@ -137,7 +137,7 @@ test_expect_success '"git replace" replacing' '
      test_must_fail git replace $HASH2 $R &&
      git replace -f $HASH2 $R &&
      test_must_fail git replace -f &&
-     test "$HASH2" = "$(git replace)"
+     test "$HASH2 $R" = "$(git replace)"
 '
 
 # This creates a side branch where the bug in H2
-- 
1.7.6.845.gc3c05

             reply	other threads:[~2011-08-25 14:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-25 14:39 Michael J Gruber [this message]
2011-08-25 16:29 ` [PATCH] replace: List replacement along with the object Christian Couder
2011-08-26  7:38   ` Michael J Gruber
2011-08-26  7:53     ` [PATCHv2] git-replace.txt: Clarify list mode Michael J Gruber
2011-08-26 16:30       ` Junio C Hamano
2011-08-27 14:07         ` Michael J Gruber
2011-08-26  8:13     ` [PATCH] replace: List replacement along with the object Christian Couder
2011-08-25 19:07 ` Junio C Hamano

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=bae5a8f7d30417864d972390f9f6b4470cf4e5bf.1314283118.git.git@drmicha.warpmail.net \
    --to=git@drmicha.warpmail.net \
    --cc=chriscool@tuxfamily.org \
    --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).