All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] diff: handle --no-abbrev outside of repository
@ 2016-11-28 18:25 Jack Bates
  2016-11-28 23:03 ` Junio C Hamano
  2016-11-29  7:06 ` Jeff King
  0 siblings, 2 replies; 13+ messages in thread
From: Jack Bates @ 2016-11-28 18:25 UTC (permalink / raw)
  To: git; +Cc: Jack Bates

The "git diff --no-index" codepath
doesn't handle the --no-abbrev option.

Signed-off-by: Jack Bates <jack@nottheoilrig.com>
---
 diff.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/diff.c b/diff.c
index ec87283..0447eff 100644
--- a/diff.c
+++ b/diff.c
@@ -3106,7 +3106,8 @@ static const char *diff_abbrev_oid(const struct object_id *oid, int abbrev)
 			abbrev = FALLBACK_DEFAULT_ABBREV;
 		if (abbrev > GIT_SHA1_HEXSZ)
 			die("BUG: oid abbreviation out of range: %d", abbrev);
-		hex[abbrev] = '\0';
+		if (abbrev)
+			hex[abbrev] = '\0';
 		return hex;
 	}
 }
@@ -4024,6 +4025,8 @@ int diff_opt_parse(struct diff_options *options,
 			    offending, optarg);
 		return argcount;
 	}
+	else if (!strcmp(arg, "--no-abbrev"))
+		options->abbrev = 0;
 	else if (!strcmp(arg, "--abbrev"))
 		options->abbrev = DEFAULT_ABBREV;
 	else if (skip_prefix(arg, "--abbrev=", &arg)) {
-- 
2.10.2

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

end of thread, other threads:[~2016-12-09  0:22 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-28 18:25 [PATCH] diff: handle --no-abbrev outside of repository Jack Bates
2016-11-28 23:03 ` Junio C Hamano
2016-11-29  7:06 ` Jeff King
2016-12-02 18:48   ` [PATCH v2] " Jack Bates
2016-12-05  6:01     ` Jeff King
2016-12-05  6:15       ` Jeff King
2016-12-05  6:58         ` Jeff King
2016-12-06  1:01           ` [PATCH v3] diff: handle --no-abbrev in no-index case Jack Bates
2016-12-06 16:53             ` [PATCH v4] " Jack Bates
2016-12-06 16:56             ` Jack Bates
2016-12-06 17:00               ` Jack Bates
2016-12-08 22:53               ` Junio C Hamano
2016-12-09  0:22                 ` Jack Bates

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.