# [PATCH (GIT-GUI BUG)] git-gui: use of undeclared variable in handle_empty_diff

3 messages from 2009-04-05 to 2009-04-05. Participants: Joerg Bornemann, Sverre Rabbelier, Johannes Schindelin.
Thread: https://gitlist.dev/t/18737

## Joerg Bornemann, 2009-04-05 20:20

Subject: [PATCH (GIT-GUI BUG)] git-gui: use of undeclared variable in handle_empty_diff
Message-ID: <0337ff5648e5e0dc583e255a44573dbf@mb8-2.1blu.de>
URL: https://gitlist.dev/e/0337ff5648e5e0dc583e255a44573dbf%40mb8-2.1blu.de

```
Commit 584fa9cc ("git-gui: Avoid an infinite rescan loop in
handle_empty_diff.") introduced the global variable diff_empty_count, which
is used in diff.tcl. But this variable isn't declared anywhere which
results in an ugly error message box instead of the intended informative
message. This patch fixes this and removes the unnecessary second
initialization of current_diff_path. 

diff --git a/git-gui.sh b/git-gui.sh
index b3aa732..b0d5028 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -1104,10 +1104,10 @@ set commit_type {}
 set empty_tree {}
 set current_branch {}
 set is_detached 0
-set current_diff_path {}
 set is_3way_diff 0
 set is_conflict_diff 0
 set selected_commit_type new
+set diff_empty_count 0
 
 set nullid "0000000000000000000000000000000000000000"
 set nullid2 "0000000000000000000000000000000000000001"

```

## Sverre Rabbelier, 2009-04-05 21:20

Subject: Re: [PATCH (GIT-GUI BUG)] git-gui: use of undeclared variable in handle_empty_diff
Message-ID: <fabb9a1e0904051420l3cbea496wf29c597a93d73417@mail.gmail.com>
URL: https://gitlist.dev/e/fabb9a1e0904051420l3cbea496wf29c597a93d73417%40mail.gmail.com
In-Reply-To: <0337ff5648e5e0dc583e255a44573dbf@mb8-2.1blu.de>

```
Heya,

On Sun, Apr 5, 2009 at 22:20, Joerg Bornemann <git@jbornemann.de> wrote:
> Commit 584fa9cc ("git-gui: Avoid an infinite rescan loop in

Please submit your patch as documented by SubmittingPatches (e.g.,
include a "Signed off by" line, use the formatting as generated by
'git format-patch', inline the patch rather than attaching it, etc).
Thanks!

-- 
Cheers,

Sverre Rabbelier

```

## Johannes Schindelin, 2009-04-05 21:35

Subject: Re: [PATCH (GIT-GUI BUG)] git-gui: use of undeclared variable in handle_empty_diff
Message-ID: <alpine.DEB.1.00.0904052334470.10279@pacific.mpi-cbg.de>
URL: https://gitlist.dev/e/alpine.DEB.1.00.0904052334470.10279%40pacific.mpi-cbg.de
In-Reply-To: <0337ff5648e5e0dc583e255a44573dbf@mb8-2.1blu.de>

```
Hi,

On Sun, 5 Apr 2009, Joerg Bornemann wrote:

> Commit 584fa9cc ("git-gui: Avoid an infinite rescan loop in 
> handle_empty_diff.") introduced the global variable diff_empty_count, 
> which is used in diff.tcl. But this variable isn't declared anywhere 
> which results in an ugly error message box instead of the intended 
> informative message. This patch fixes this and removes the unnecessary 
> second initialization of current_diff_path.

Under which circumstances does this bug trigger?  I never saw it happen.

Ciao,
Dscho

```
