# [PATCH] Do not try to remove directories when removing old links

2 messages from 2009-10-27 to 2009-10-28. Participants: Sebastian Schuberth, Junio C Hamano.
Thread: https://gitlist.dev/t/21376

## Sebastian Schuberth, 2009-10-27 11:23

Subject: [PATCH] Do not try to remove directories when removing old links
Message-ID: <hc6l9h$fn6$1@ger.gmane.org>
URL: https://gitlist.dev/e/hc6l9h%24fn6%241%40ger.gmane.org

```
When building Git with MSVC on Windows, directories named after the Git alias
are created for the output files, e.g. there is a "git-merge-index" directory
next to the "git-merge-index.exe" executable in the build root. Previously,
"make all" just checked if "git-merge-index" and "git-merge-index.exe" are the
same file, and if not, tried to remove "git-merge-index". This fails in the
case of "git-merge-index" being a directory, which is why this is checked now.

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
---
 Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index 42b7d60..268aede 100644
--- a/Makefile
+++ b/Makefile
@@ -1375,7 +1375,7 @@ SHELL = $(SHELL_PATH)
 
 all:: shell_compatibility_test $(ALL_PROGRAMS) $(BUILT_INS) $(OTHER_PROGRAMS) GIT-BUILD-OPTIONS
 ifneq (,$X)
-	$(QUIET_BUILT_IN)$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), test '$p' -ef '$p$X' || $(RM) '$p';)
+	$(QUIET_BUILT_IN)$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), test -d '$p' -o '$p' -ef '$p$X' || $(RM) '$p';)
 endif
 
 all::
-- 
1.6.5.rc2.13.g1be2

```

## Junio C Hamano, 2009-10-28 07:19

Subject: Re: [PATCH] Do not try to remove directories when removing old links
Message-ID: <7vd448rnn2.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vd448rnn2.fsf%40alter.siamese.dyndns.org
In-Reply-To: <hc6l9h$fn6$1@ger.gmane.org>

```
Thanks.

```
