[RFC/PATCH 07/48] builtin/apply: move 'newfd' global into 'struct apply_state'

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

 



Signed-off-by: Christian Couder <chriscool@xxxxxxxxxxxxx>
---
 builtin/apply.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/builtin/apply.c b/builtin/apply.c
index 462e28f..d56dd9f 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -24,6 +24,7 @@
 struct apply_state {
 	const char *prefix;
 	int prefix_length;
+	int newfd;
 };
 
 /*
@@ -35,7 +36,6 @@ struct apply_state {
  *  --index updates the cache as well.
  *  --cached updates only the cache without ever touching the working tree.
  */
-static int newfd = -1;
 
 static int unidiff_zero;
 static int p_value = 1;
@@ -4425,8 +4425,8 @@ static int apply_patch(struct apply_state *state,
 		apply = 0;
 
 	update_index = check_index && apply;
-	if (update_index && newfd < 0)
-		newfd = hold_locked_index(&lock_file, 1);
+	if (update_index && state->newfd < 0)
+		state->newfd = hold_locked_index(&lock_file, 1);
 
 	if (check_index) {
 		if (read_cache() < 0)
@@ -4605,6 +4605,7 @@ int cmd_apply(int argc, const char **argv, const char *prefix_)
 	memset(&state, 0, sizeof(state));
 	state.prefix = prefix_;
 	state.prefix_length = state.prefix ? strlen(state.prefix) : 0;
+	state.newfd = -1;
 
 	git_apply_config();
 	if (apply_default_whitespace)
-- 
2.8.0.rc1.49.gca61272

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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]