[PATCH] git-name-rev: allow --name-only in combination with --stdin

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Pieter de Bie <pdebie@xxxxxxxxx>
---

	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


--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux