git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] git-name-rev: allow --name-only in combination with --stdin
@ 2008-07-31 13:20 Pieter de Bie
  2008-08-01  7:23 ` Junio C Hamano
  2008-08-02 18:12 ` [PATCH] git-name-rev: allow --name-only in combination with --stdin Junio C Hamano
  0 siblings, 2 replies; 8+ messages in thread
From: Pieter de Bie @ 2008-07-31 13:20 UTC (permalink / raw)
  To: Git Mailinglist, Johannes Schindelin; +Cc: Pieter de Bie


Signed-off-by: Pieter de Bie <pdebie@ai.rug.nl>
---

	Or was there a specific reason not to allow this?

 Documentation/git-name-rev.txt |    3 +--
 builtin-name-rev.c             |   10 ++++++++--
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/Documentation/git-name-rev.txt b/Documentation/git-name-rev.txt
index 6e77ab1..c8a72dd 100644
--- a/Documentation/git-name-rev.txt
+++ b/Documentation/git-name-rev.txt
@@ -38,8 +38,7 @@ OPTIONS
 	Instead of printing both the SHA-1 and the name, print only
 	the name.  If given with --tags the usual tag prefix of
 	"tags/" is also omitted from the name, matching the output
-	of 'git-describe' more closely.  This option
-	cannot be combined with --stdin.
+	of 'git-describe' more closely.
 
 --no-undefined::
 	Die with error code != 0 when a reference is undefined,
diff --git a/builtin-name-rev.c b/builtin-name-rev.c
index 85612c4..0536af4 100644
--- a/builtin-name-rev.c
+++ b/builtin-name-rev.c
@@ -266,8 +266,14 @@ int cmd_name_rev(int argc, const char **argv, const char *prefix)
 					if (!name)
 						continue;
 
-					fwrite(p_start, p - p_start + 1, 1, stdout);
-					printf(" (%s)", name);
+					if (data.name_only) {
+						fwrite(p_start, p - p_start + 1 - 40, 1, stdout);
+						printf(name);
+					}
+					else {
+						fwrite(p_start, p - p_start + 1, 1, stdout);
+						printf(" (%s)", name);
+					}
 					p_start = p + 1;
 				}
 			}
-- 
1.6.0.rc1.163.gc85c5.dirty

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-08-03 20:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-31 13:20 [PATCH] git-name-rev: allow --name-only in combination with --stdin Pieter de Bie
2008-08-01  7:23 ` Junio C Hamano
2008-08-01 10:57   ` Johannes Schindelin
2008-08-01 11:16     ` [PATCH] builtin-name-rev: refactor stdin handling to its own function Pieter de Bie
2008-08-01 19:07       ` Junio C Hamano
2008-08-02 18:12 ` [PATCH] git-name-rev: allow --name-only in combination with --stdin Junio C Hamano
2008-08-03 13:44   ` [PATCH] git-name-rev: don't use printf without format René Scharfe
2008-08-03 20:44     ` Junio C Hamano

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).