git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* git stash destroys hard links
@ 2012-05-22  4:24 Steven Penny
  2012-05-22 17:41 ` Junio C Hamano
  2012-05-22 17:52 ` Angus Hammond
  0 siblings, 2 replies; 3+ messages in thread
From: Steven Penny @ 2012-05-22  4:24 UTC (permalink / raw)
  To: git

I dont know if this is even fixable, but I wanted to at least mention it.
Performing a git stash will destroy any hard links and replace them with simply
a copy of the file.

$ mkdir test
$ cd test
$ git init
$ touch foobar.sh
$ git add -A
$ git commit -m 'first commit'

$ ln foobar.sh foobar-link.sh

$ ls -l
total 0
-rw-r--r-- 2 Steven None 0 May 21 23:18 foobar.sh
-rw-r--r-- 2 Steven None 0 May 21 23:18 foobar-link.sh

$ git stash -u
$ git stash pop

$ ls -l
total 0
-rw-r--r-- 1 Steven None 0 May 21 23:18 foobar.sh
-rw-r--r-- 1 Steven None 0 May 21 23:18 foobar-link.sh

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: git stash destroys hard links
  2012-05-22  4:24 git stash destroys hard links Steven Penny
@ 2012-05-22 17:41 ` Junio C Hamano
  2012-05-22 17:52 ` Angus Hammond
  1 sibling, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2012-05-22 17:41 UTC (permalink / raw)
  To: Steven Penny; +Cc: git

Steven Penny <svnpenn@gmail.com> writes:

> I dont know if this is even fixable, but I wanted to at least mention it.

I do not think there is anything specific to stash.  Whenever we write out
results of an operation to a file in the working tree, we first unlink(2)
and then creat(2), which essentially breaks hardlinked files and avoids
updating some _other_ paths that share the underlying file with the
updated path.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: git stash destroys hard links
  2012-05-22  4:24 git stash destroys hard links Steven Penny
  2012-05-22 17:41 ` Junio C Hamano
@ 2012-05-22 17:52 ` Angus Hammond
  1 sibling, 0 replies; 3+ messages in thread
From: Angus Hammond @ 2012-05-22 17:52 UTC (permalink / raw)
  To: Steven Penny; +Cc: git

>From the very quick and unscientific test that I just did, it doesn't
appear that git commits hard links, it just collapses them into
separate regular files (presumably to avoid changes in one place
mucking things up elsewhere without git knowing about it). I don't
think it makes much sense to stash hardlinks if the policy is to
forget them in commits.
Thanks
Angus

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-05-22 17:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-22  4:24 git stash destroys hard links Steven Penny
2012-05-22 17:41 ` Junio C Hamano
2012-05-22 17:52 ` Angus Hammond

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).