All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Gladysh <agladysh@gmail.com>
To: git@vger.kernel.org
Subject: Re: Troubles when directory is replaced by symlink
Date: Tue, 9 Jun 2009 12:18:16 +0400	[thread overview]
Message-ID: <c6c947f60906090118n78d3c40fq11d1390f8776c2c0@mail.gmail.com> (raw)
In-Reply-To: <c6c947f60906042243v2e36251dn9a46343cf6b8a2f4@mail.gmail.com>

Any help here? This bug is pretty annoying (especially that it
requires double hard resets).

Should I provide any extra information?

Alexander.

On Fri, Jun 5, 2009 at 9:43 AM, Alexander Gladysh<agladysh@gmail.com> wrote:
> Hi, list!
>
> OS X 10.5.7
>
> $ git --version
> git version 1.6.3.2
>
> In my master branch I've had this structure:
>
> root /
>    directory1 /
>        some-files
>    directory2 /
>        copy-of-directory1 /
>            some-files
>
> In a separate branch I replaced copy-of-directory1 with a symlink to
> ../directory1. I did it in two commits: first remove
> copy-of-directory1, in second commit -- create the symlink.
>
> My master branch is then moved by couple commits ahead.
>
> Now I have nasty problems when I try to merge that separate branch
> back to master (see log below).
>
> If I split the branch history in two, and first merge up to commit
> with deletion, and then separately merge the rest of it with symlink
> creation -- all goes well.
>
> Below is the log on how to reproduce the problem:
>
> Alexander.
>
> $ mkdir test
> $ cd test
> $ git init
> Initialized empty Git repository in /users/agladysh/tmp/test/.git/
> $ mkdir alpha
> $ echo "file1" > alpha/file1
> $ git add .
> $ git commit -m "first commit"
> [master (root-commit) 1df90a8] first commit
>  1 files changed, 1 insertions(+), 0 deletions(-)
>  create mode 100644 alpha/file1
>
> $ mkdir beta
> $ cp -R alpha beta/
> $ git add .
> $ git commit -m "second commit"
> [master 0eddb98] second commit
>  1 files changed, 1 insertions(+), 0 deletions(-)
>  create mode 100644 beta/alpha/file1
>
> $ git checkout -b branch
> Switched to a new branch 'branch'
> $ rm -rf beta/alpha
> $ git add -u
> $ git commit -m "deleted"
> [branch 34134ea] deleted
>  1 files changed, 0 insertions(+), 1 deletions(-)
>  delete mode 100644 beta/alpha/file1
>
> $ cd beta/
> $ ln -s ../alpha
> $ cd ..
> $ git add .
> $ git commit -m "symlink"
> [branch b8dfba0] symlink
>  1 files changed, 1 insertions(+), 0 deletions(-)
>  create mode 120000 beta/alpha
>
> $ git checkout master
> Switched to branch 'master'
>
> ### All works if we're just fast-forwarding ###
>
> $ git branch backup
> $ git merge branch
> Updating 0eddb98..b8dfba0
> Fast forward
>  beta/alpha       |    1 +
>  beta/alpha/file1 |    1 -
>  2 files changed, 1 insertions(+), 1 deletions(-)
>  create mode 120000 beta/alpha
>  delete mode 100644 beta/alpha/file1
>
> ### Trying to restore to backup
> $ git reset --hard backup
> error: Invalid path ''
> HEAD is now at 0eddb98 second commit
> $ git status
> # On branch master
> # Changed but not updated:
> #   (use "git add/rm <file>..." to update what will be committed)
> #   (use "git checkout -- <file>..." to discard changes in working directory)
> #
> #       deleted:    alpha/file1
> #
> no changes added to commit (use "git add" and/or "git commit -a")
>
> ### Needed second reset --hard.
>
> $ git reset --hard
> HEAD is now at 0eddb98 second commit
>
> $ git status
> # On branch master
> nothing to commit (working directory clean)
>
> ### We're back to original master now
>
> $ echo "change" >> alpha/file1
> $ git commit -a -m "third commit"
> [master 0f64b88] third commit
>  1 files changed, 1 insertions(+), 0 deletions(-)
>
> ### Here it goes
>
> $ git merge branch
> CONFLICT (directory/file): There is a directory with name beta/alpha
> in HEAD. Adding beta/alpha as beta/alpha~branch
> Removing beta/alpha/file1
> Automatic merge failed; fix conflicts and then commit the result.
> [4168][agladysh.agmac: test]$ git status
> beta/alpha: needs merge
> # On branch master
> # Changes to be committed:
> #   (use "git reset HEAD <file>..." to unstage)
> #
> #       deleted:    beta/alpha/file1
> #
> # Changed but not updated:
> #   (use "git add <file>..." to update what will be committed)
> #   (use "git checkout -- <file>..." to discard changes in working directory)
> #
> #       unmerged:   beta/alpha
> #
> # Untracked files:
> #   (use "git add <file>..." to include in what will be committed)
> #
> #       beta/alpha~branch
> $ git mergetool
> Merging the files: beta/alpha
>
> mv: rename beta/alpha to ./beta/alpha.BACKUP.55777: No such file or directory
> cp: ./beta/alpha.BACKUP.55777: No such file or directory
> Deleted merge conflict for 'beta/alpha':
>  {local}: deleted
>  {remote}: a symbolic link -> '../alpha'
> Use (c)reated or (d)eleted file, or (a)bort? c
> fatal: beta/alpha: unable to stat (No such file or directory)
> mv: rename ./beta/alpha.BACKUP.55777 to beta/alpha.orig: No such file
> or directory
>

  reply	other threads:[~2009-06-09  8:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-05  5:43 Troubles when directory is replaced by symlink Alexander Gladysh
2009-06-09  8:18 ` Alexander Gladysh [this message]
2009-06-11 11:48   ` Jeff King
2009-06-11 14:37     ` Kjetil Barvik
2009-06-14 14:34     ` Kjetil Barvik
2009-06-24 22:07       ` James Pickens
2009-06-25 22:51         ` Kjetil Barvik
2009-06-26 13:14         ` Kjetil Barvik
2009-06-26 14:14           ` Johannes Sixt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c6c947f60906090118n78d3c40fq11d1390f8776c2c0@mail.gmail.com \
    --to=agladysh@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.