# [PATCH] git-blame: Kill warning "print_map defined but not used"

3 messages from 2006-03-05 to 2006-03-05. Participants: Fredrik Kuivinen, Linus Torvalds, Junio C Hamano.
Thread: https://gitlist.dev/t/3567

## Fredrik Kuivinen, 2006-03-05 11:16

Subject: [PATCH] git-blame: Kill warning "print_map defined but not used"
Message-ID: <20060305111650.GC23448@c165.ib.student.liu.se>
URL: https://gitlist.dev/e/20060305111650.GC23448%40c165.ib.student.liu.se

```

Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>


---

 blame.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

aebef8969d11b04634b9ab7a6ae85a0844b2e4c7
diff --git a/blame.c b/blame.c
index 6dccae5..0fb30ee 100644
--- a/blame.c
+++ b/blame.c
@@ -235,6 +235,7 @@ static void print_patch(struct patch *p)
 }
 
 /* For debugging only */
+#if DEBUG
 static void print_map(struct commit *cmit, struct commit *other)
 {
 	struct util_info *util = cmit->object.util;
@@ -267,6 +268,7 @@ static void print_map(struct commit *cmi
 		printf("\n");
 	}
 }
+#endif
 
 // p is a patch from commit to other.
 static void fill_line_map(struct commit *commit, struct commit *other,
-- 
1.2.4.g4644-dirty

```

## Linus Torvalds, 2006-03-05 18:58

Subject: Re: [PATCH] git-blame: Kill warning "print_map defined but not used"
Message-ID: <Pine.LNX.4.64.0603051054330.13139@g5.osdl.org>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0603051054330.13139%40g5.osdl.org
In-Reply-To: <20060305111650.GC23448@c165.ib.student.liu.se>

```


Fredrik,

Three comments on "git-blame":

 - you should use "-u -U 0" instead of "-u0" to avoid warnings from some 
   versions of GNU diff

 - Please default to HEAD so that you don't need to say it.

 - What I'd actually want to see is blame for a certain group of lines. 
   Ie, I'd like to see

	git-blame --line=50-56 filename

   which only shows those 7 lines. That would be wonderful for a visual 
   interface where you could mark off a few lines and say "follow these 
   backwards" kind of thing, and should make it more efficient than trying 
   to resolve the _whole_ file.

Hmm?

		Linus

```

## Junio C Hamano, 2006-03-05 22:45

Subject: Re: [PATCH] git-blame: Kill warning "print_map defined but not used"
Message-ID: <7vmzg4ecjg.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vmzg4ecjg.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <Pine.LNX.4.64.0603051054330.13139@g5.osdl.org>

```
Linus Torvalds <torvalds@osdl.org> writes:

>  - you should use "-u -U 0" instead of "-u0" to avoid warnings from some 
>    versions of GNU diff

One liner here.

>  - Please default to HEAD so that you don't need to say it.

Fredrik's latest patch already does.

-- >8 --
Subject: [PATCH] blame: avoid "diff -u0".

As Linus suggests, use "diff -u -U 0" instead.

Signed-off-by: Junio C Hamano <junkio@cox.net>

---

 blame.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

1f7d9585190c22a4c019487444d9e461e08baa0e
diff --git a/blame.c b/blame.c
index a3a8ddc..141e4c6 100644
--- a/blame.c
+++ b/blame.c
@@ -92,7 +92,7 @@ static struct patch *get_patch(struct co
 		die("write failed: %s", strerror(errno));
 	close(fd);
 
-	sprintf(diff_cmd, "diff -u0 %s %s", tmp_path1, tmp_path2);
+	sprintf(diff_cmd, "diff -u -U 0 %s %s", tmp_path1, tmp_path2);
 	fin = popen(diff_cmd, "r");
 	if (!fin)
 		die("popen failed: %s", strerror(errno));
-- 
1.2.4.gee5c7

```
