[PATCH] checkout_entry(): remove unreachable error() call

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

 



This if statement never evaluates to true since we already check
state->force a few lines above, and immediately return when it is
false.

Signed-off-by: Matheus Tavares <matheus.bernardino@xxxxxx>
---
 entry.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/entry.c b/entry.c
index 449bd32dee..a0532f1f00 100644
--- a/entry.c
+++ b/entry.c
@@ -492,26 +492,24 @@ int checkout_entry(struct cache_entry *ce, const struct checkout *state,
 		if (!state->force) {
 			if (!state->quiet)
 				fprintf(stderr,
 					"%s already exists, no checkout\n",
 					path.buf);
 			return -1;
 		}

 		if (state->clone)
 			mark_colliding_entries(state, ce, &st);

 		/*
 		 * We unlink the old file, to get the new one with the
 		 * right permissions (including umask, which is nasty
 		 * to emulate by hand - much easier to let the system
 		 * just do the right thing)
 		 */
 		if (S_ISDIR(st.st_mode)) {
 			/* If it is a gitlink, leave it alone! */
 			if (S_ISGITLINK(ce->ce_mode))
 				return 0;
-			if (!state->force)
-				return error("%s is a directory", path.buf);
 			remove_subtree(&path);
 		} else if (unlink(path.buf))
 			return error_errno("unable to unlink old '%s'", path.buf);
-- 
2.28.0




[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