Re: [PATCH] Add --temp and --stage=all options to checkout-index.
- From
Junio C Hamano <junkio@cox.net>
- Date
- Mar 5, 2006, 05:29 UTC
- Message-ID
- <7vlkvpihm4.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <20060303151331.GA16369@spearce.org>
Shawn Pearce <spearce@spearce.org> writes:
Show 6 quoted lines
> Junio C Hamano <junkio@cox.net> wrote: >> Shawn Pearce <spearce@spearce.org> writes: >> >> > Unfortunately this change lead me down a path which changed the core >> > checkout code also used by apply and read-tree. >>
I would have preferred not to add to_tempfile member to the checkout struct. Instead, if checkout_entry has non NULL topath, check out to a temporary location and return the path; otherwise behave the way it did before.
That way everybody else would not need to declare useless topath[] array on the stack and pass it to checkout_entry (instead they would just pass NULL because they are not interested in checking out to temporary files).
I am unsure about what the tempfile option should do when asked to checkout a symbolic link. Creating a temporary regular file that has the readlink result does not sound very useful to me.
BTW, in any case, I think there is one breakage that needs to be fixed with something like this...
---
diff --git a/apply.c b/apply.c index 5a2cf54..727d63d 100644 --- a/apply.c +++ b/apply.c @@ -1311,6 +1311,7 @@ static int check_patch(struct patch *pat costate.force = 0; costate.quiet = 0; costate.not_new = 0; + costate.to_tempfile = 0; costate.refresh_cache = 1; if (checkout_entry(active_cache[pos], &costate, topath) ||