We need to check out .gitattributes files first to have
them in place when we check out the remaining files. This
is needed to get the right attributes during checkout,
for example having the right crlf conversion on the first
checkout if crlf is controlled by a .gitattribute file.
This works only together with the commit
'attr: fix attribute handling if .gitattributes is involved'
which ensures that .gitattributes files do not trigger the
attribute machinery too early.
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
---
builtin-checkout-index.c | 47 ++++++++++++++++++++++++++++-----------------
1 files changed, 29 insertions(+), 18 deletions(-)
diff --git a/builtin-checkout-index.c b/builtin-checkout-index.c
index 75377b9..5e87a39 100644
--- a/builtin-checkout-index.c
+++ b/builtin-checkout-index.c
@@ -125,27 +125,38 @@ static int checkout_file(const char *name, int prefix_length)
static void checkout_all(const char *prefix, int prefix_length)
{
- int i, errs = 0;
+ int i, pass, errs = 0;
struct cache_entry* last_ce = NULL;
- for (i = 0; i < active_nr ; i++) {
- struct cache_entry *ce = active_cache[i];
- if (ce_stage(ce) != checkout_stage
- && (CHECKOUT_ALL != checkout_stage || !ce_stage(ce)))
- continue;
- if (prefix && *prefix &&
- (ce_namelen(ce) <= prefix_length ||
- memcmp(prefix, ce->name, prefix_length)))
- continue;
- if (last_ce && to_tempfile) {
- if (ce_namelen(last_ce) != ce_namelen(ce)
- || memcmp(last_ce->name, ce->name, ce_namelen(ce)))
- write_tempfile_record(last_ce->name, prefix_length);
+ /* pass 0: check out only .gitattribute files
+ pass 1: check out every file
+
+ This is needed to have all .gitattributes in place before
+ checking out files, and thus do the right conversion.
+ */
+ for (pass = 0; pass < 2; pass++) {
+ for (i = 0; i < active_nr ; i++) {
+ struct cache_entry *ce = active_cache[i];
+ if (pass == 0 && strstr (ce->name, GITATTRIBUTES_FILE) == 0) {
+ continue;
+ }
+ if (ce_stage(ce) != checkout_stage
+ && (CHECKOUT_ALL != checkout_stage || !ce_stage(ce)))
+ continue;
+ if (prefix && *prefix &&
+ (ce_namelen(ce) <= prefix_length ||
+ memcmp(prefix, ce->name, prefix_length)))
+ continue;
+ if (last_ce && to_tempfile) {
+ if (ce_namelen(last_ce) != ce_namelen(ce)
+ || memcmp(last_ce->name, ce->name, ce_namelen(ce)))
+ write_tempfile_record(last_ce->name, prefix_length);
+ }
+ if (checkout_entry(ce, &state,
+ to_tempfile ? topath[ce_stage(ce)] : NULL) < 0)
+ errs++;
+ last_ce = ce;
}
- if (checkout_entry(ce, &state,
- to_tempfile ? topath[ce_stage(ce)] : NULL) < 0)
- errs++;
- last_ce = ce;
}
if (last_ce && to_tempfile)
write_tempfile_record(last_ce->name, prefix_length);
--
1.5.3.rc4.96.g6ceb
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
| Jan Kundrát | kswapd high CPU usage with no swap |
| Renato S. Yamane | Error -71 on device descriptor read/all |
| Linus Torvalds | Linux 2.6.27-rc8 |
| Alex Chiang | [PATCH 0/7] Fixups for duplicate slot names |
git: | |
| Peter Karlsson | RCS keyword expansion |
| Wink Saville | Resolving conflicts |
| Andreas Hildebrandt | CVS-$Id:$ replacement in git? |
| Olivier Marin | [PATCH] builtin-rerere: fix conflict markers parsing |
| GVG GVG | ssh_exchange_identification: Connection closed by remote host |
| Felipe Alfaro Solana | quagga-0.99.11 |
| Pc Nicolas | OpenBSD 4.4 httpd reverse proxy |
| Martin Schröder | pkg_add with http? |
| Evgeniy Polyakov | [resend take 2 4/4] DST Makefile/Kconfig files. |
| Volker Armin Hemmann | build error with 2.6.27.6+reiser4+ehci-hub patch. ERROR: "mii_ethtool_gset" [drive... |
| Krzysztof Oledzki | Re: Error: an inet prefix is expected rather than "0/0". |
| David Madore | atl1e Ethernet driver not seeing packets sent to 33:33:00:00:00:01 multicast |
| Block Sub System query | 2 hours ago | Linux kernel |
| kernel module to intercept socket creation | 3 hours ago | Linux kernel |
| Image size changing during each build | 3 hours ago | Linux kernel |
| Soft lock bug | 8 hours ago | Linux kernel |
| sysctl - dynamic registration problem | 14 hours ago | Linux kernel |
| Question on swap as ramdisk partition | 16 hours ago | Linux kernel |
| serial driver xmit problem | 21 hours ago | Linux kernel |
| Generic Netlink subsytem | 22 hours ago | Linux kernel |
| 'Report spam filter error' page broken | 23 hours ago | KernelTrap Suggestions and Feedback |
| Netfilter kernel module | 1 day ago | Linux kernel |
