On Wed, 14 May 2008, Junio C Hamano wrote:This is "for all (or some, by pathspecs) files currently unmerged in the index, resolve them to the version in MERGE_HEAD", right? Like this (also untested)? (This is missing defaulting to a pathspec of '.' if --unmerged is used without any pathspecs) diff --git a/builtin-checkout.c b/builtin-checkout.c index 10ec137..0bae1d4 100644 --- a/builtin-checkout.c +++ b/builtin-checkout.c @@ -42,6 +42,8 @@ static int post_checkout_hook(struct commit *old, struct commit *new, return run_command(&proc); } +static int unmerged; + static int update_some(const unsigned char *sha1, const char *base, int baselen, const char *pathname, unsigned mode, int stage) { @@ -59,6 +61,13 @@ static int update_some(const unsigned char *sha1, const char *base, int baselen, hashcpy(ce->sha1, sha1); memcpy(ce->name, base, baselen); memcpy(ce->name + baselen, pathname, len - baselen); + if (unmerged) { + int pos = cache_name_pos(ce->name, len); + if (!(pos && pos < active_nr && ce_same_name(active_cache[pos], active_cache[pos + 1]))) { + free(ce); + return 0; + } + } ce->ce_flags = create_ce_flags(len, 0); ce->ce_mode = create_ce_mode(mode); add_cache_entry(ce, ADD_CACHE_OK_TO_ADD | ADD_CACHE_OK_TO_REPLACE); @@ -508,6 +517,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix) BRANCH_TRACK_EXPLICIT), OPT_BOOLEAN('f', NULL, &opts.force, "force"), OPT_BOOLEAN('m', NULL, &opts.merge, "merge"), + OPT_BOOLEAN( 0 , "unmerged", &unmerged, "check out unmerged paths"), OPT_END(), }; -- 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
| Greg KH | [GIT PATCH] driver core patches against 2.6.24 |
| Tim Tassonis | reiser4 for 2.6.27-rc1 |
| monstr | [PATCH 20/52] [microblaze] heartbeat file |
| Tarkan Erimer | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
git: | |
| David Kastrup | Terminology question about remote branches. |
| Pascal Obry | git svn and the post-receive hook |
| Giuseppe Bilotta | git-svn tags and branches |
| Thomas Glanzmann | fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree. |
| GVG GVG | ssh_exchange_identification: Connection closed by remote host |
| Andrei Pirvan | apache 1.3.29 + PHP 5.2.6 on OpenBSD 4.4 |
| Richard Stallman | Real men don't attack straw men |
| Jason Dixon | DCBSDCon 2009 - Three Weeks Left |
| David Miller | Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| John P Poet | Realtek 8111C transmit timed out |
| Gerrit Renker | [PATCH 26/37] dccp: Integration of dynamic feature activation - part 1 (socket set... |
| Joerg Roedel | [PATCH 08/10] x86: add checks for sync_single* code |
