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

Re: git 1.4.0 usability problem

From
JGJeff Garzik <jeff@garzik.org>
Date
Jun 18, 2006, 23:01 UTC
Message-ID
<4495DB3B.10403@garzik.org>
In-Reply-To
<7vbqsqdru0.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano wrote:
Show 25 quoted lines
> Jeff Garzik <jeff@garzik.org> writes:
> 
>> Here is how to reproduce:
> 
> This is not related to the "not clobbering untracked files"
> safety valve under discussion, but one thing I noticed.
> 
>> git clone -l $url/torvalds/linux-2.6.git tmp-2.6
>> cd tmp-2.6
>> cp .git/refs/tags/v2.6.12 .git/refs/heads/tmp
>> git checkout -f tmp
> 
> This should never have been supported.  At this point tmp is a
> tag object that is under heads/ -- a definite no-no.  We should
> make checkout more careful to complain about it.
> 
> Doing
> 
>         git update-ref refs/heads/tmp $(git rev-parse v2.6.12^0)
> 
> instead of "cp" is kosher, and
> 
> 	git-rev-parse v2.6.12^0 >.git/refs/heads/tmp
> 
> is OK under the current implementation of refs.

Sorry about that. The contrived example produced the same results as the real-world example (updating jgarzik/{libata-dev,scsilun-2.6}.git branches).

Show 25 quoted lines
>> git pull . master
>> # watch OBVIOUS FAST-FORWARD MERGE complain about untracked
>> # working tree files
> 
> In any case, here is a patch I think would alleviate your
> original problem.
> 
> Sorry for the trouble.  I really did not want to disrupt the
> workflow of old timers in the name of making it safer for new
> people.  Could you comment on whether this is an acceptable
> approach?
> 
> -- >8 --
> [PATCH] Conditionally loosen "no clobber untracked files" safety valve.
> 
> This introduces a new configuration item "core.oktoclobber" to
> control how untracked working tree file is handled during branch
> switching.
> 
> The safety valve introduced during 1.4.0 development cycle
> refrains from checking out a file that exists in the working
> tree, not in the current HEAD tree and exists in the branch we
> are switching to, in order to prevent accidental and
> irreversible lossage of user data.  This can be controlled by
> having core.oktoclobber configuration item:
I'm a bit under the weather today, so I must defer thinking about this. 
  :)  But if what Ryan says is true, about simply needing to ditch the 
"-f" argument I habitually pass to 'git checkout', would that alleviate 
the need for a patch?
FWIW, my workflow is
	cd /repos
	cd linux-2.6
	git pull
	cd ../libata-dev
	git checkout -f master	# guarantee any WIP goes away
	git pull ../linux-2.6	# update vanilla branch
	git checkout -f upstream# switch to working branch,
				# guarantee any WIP goes away.
	git pull . master	# pull latest upstream updates
	build/test/etc.
	git checkout -f sii-m15w # switch to topic-specific branch,
				 # whose parent is always #upstream
	git pull . upstream
	build/test/etc.
	repeat for several topics (on-going devel branches)
	git checkout -f -b ALL upstream	# create everything-together
					# test branch
	git pull . sii-m15w
	git pull . topicB
	git pull . topicC
	build/test/etc.
	git checkout -f master
	./push		# calls 'git push --force --all $url'
More tomorrow,
	Jeff
Previous: Junio C HamanoNext: Junio C Hamano
Message 6 of 17 in “git 1.4.0 usability problem”
  1. Jeff GarzikJun 18, 2006
  2. Ryan AndersonJun 18, 2006
  3. Ryan AndersonJun 18, 2006
  4. Junio C HamanoJun 18, 2006
  5. Junio C HamanoJun 18, 2006
  6. Jeff GarzikJun 18, 2006
  7. Junio C HamanoJun 19, 2006
  8. Jeff GarzikJun 20, 2006
  9. Ryan AndersonJun 20, 2006
  10. Junio C HamanoJun 20, 2006
  11. checkout -f: do not leave untracked working tree files.Junio C Hamano, Jun 20, 2006
  12. Santi BéjarJun 20, 2006
  13. Junio C HamanoJun 20, 2006
  14. Alexander LitvinovJun 20, 2006
  15. Junio C HamanoJun 20, 2006
  16. Alexander LitvinovJun 20, 2006
  17. Carl WorthJun 20, 2006

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.