git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] "checkout-cache -m" writes unmerged contents for each stage.

From
Linus Torvalds <torvalds@osdl.org>
Date
Apr 18, 2005, 03:05 UTC
Message-ID
<Pine.LNX.4.58.0504171957210.7211@ppc970.osdl.org>
In-Reply-To
<7vk6n0vnbq.fsf@assigned-by-dhcp.cox.net>
On Sun, 17 Apr 2005, Junio C Hamano wrote:
Show 7 quoted lines
> 
> LT> What do you think? I can whip up a "merge-cache" program like that in five 
> LT> minutes, and it _seems_ like the right interface..
> 
> Yes.  I think that is the right thing to do.  In fact the idea
> is quite similar to what I've been working on, which is a
> rewrite of that perl thing to use "read-tree -m O A B".
I pushed the thing out. It was indeed pretty trivial.
Just as an example, on your merge-test, I can then do
	merge-cache echo -a
and the output is
	 .merge_file_Raanu4 .merge_file_q7ZoLY AA
	 .merge_file_zMXLAW .merge_file_SOugrU AN
	.merge_file_tWf5zS   DD
	.merge_file_YmGzgR   DM
	.merge_file_N1M8oO   DN
	.merge_file_eAC5WL .merge_file_ROg7mM  MD
	.merge_file_G1AWSM .merge_file_LMCruN .merge_file_ucVx7N MM
	  .merge_file_3YxD2O NA
	.merge_file_2SJa6P .merge_file_3V5g6Q  ND
	.merge_file_SIo4nQ   S/DD
	.merge_file_dO8AOP   S/DM
	.merge_file_wOO6iP   S/DN
	.merge_file_RrgnYR .merge_file_KQxqHU  S/MD
	.merge_file_F0sQRX .merge_file_E4DC00 .merge_file_HQkyn2 S/MM
	.merge_file_od0mf4 .merge_file_Xvv035  S/ND
	.merge_file_oEtq17 .merge_file_TwkT5c .merge_file_aqx58h Trivial

(Note that the spaces signify an empty argument in those places, since the file in question didn't always exist). It executed the "echo" thing 16 times (once for each object that your script-from-hell had caused a clash with).

In all cases you have $1 being "original", $2 being "branch 1", $3 being "branch 2", and $4 being "name in cache".

ALERT ALERT ALERT! The git "merge object order" is different from the "merge" program merge object order. In the above ordering, the original is first. But the argument order to the 3-way merge program "merge" is to have the original in the middle. Don't ask me why.

Anyway, another example:
	torvalds@ppc970:~/merge-test> merge-cache cat MM
	This is MM from the original tree.			# original
	This is modified MM in the branch A.			# merge1
	This is modified MM in the branch B.			# merge2
	This is modified MM in the branch B.			# current contents
or 
	torvalds@ppc970:~/merge-test> merge-cache cat AA MM
	cat: : No such file or directory
	This is added AA in the branch A.
	This is added AA in the branch B.
	This is added AA in the branch B.
	fatal: merge program failed

where the latter example shows how "merge-cache" will stop trying to merge once anything has returned an error (ie "cat" returned an error for the AA file, because it didn't exist in the original, and thus "merge-cache" didn't even try to merge the MM thing).

		Linus
Previous: Junio C HamanoNext: Junio C Hamano
Message 4 of 6 in “"checkout-cache -m" writes unmerged contents for each stage.”
  1. "checkout-cache -m" writes unmerged contents for each stage.Junio C Hamano, Apr 17, 2005
  2. Linus TorvaldsApr 18, 2005
  3. Junio C HamanoApr 18, 2005
  4. Linus TorvaldsApr 18, 2005
  5. Junio C HamanoApr 18, 2005
  6. Linus TorvaldsApr 18, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.