git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Herland <johan@herland.net>
To: Johannes Sixt <j.sixt@viscovery.net>
Cc: git@vger.kernel.org, gitster@pobox.com, david@tethera.net,
	pclouds@gmail.com
Subject: Re: [PATCH jh/notes-merge-in-git-dir-worktree] fixup! t3310 on Windows
Date: Wed, 14 Mar 2012 13:56:44 +0100	[thread overview]
Message-ID: <CALKQrgdWZM959OyrEp+WCCehczZmMA3K8_RAcf23aAczKBCfvA@mail.gmail.com> (raw)
In-Reply-To: <4F60882E.90303@viscovery.net>

On Wed, Mar 14, 2012 at 12:59, Johannes Sixt <j.sixt@viscovery.net> wrote:
> Am 3/14/2012 12:39, schrieb Johan Herland:
>> On Wed, Mar 14, 2012 at 09:39, Johannes Sixt <j.sixt@viscovery.net> wrote:
>>> From: Johannes Sixt <j6t@kdbg.org>
>>>
>>> On Windows, a directory cannot be removed while it is the working
>>> directory of a process. "git notes merge --commit" attempts to remove
>>> .git/NOTES_MERGE_WORKTREE, but during the test the directory was still
>>> "occupied" by the shell. Move the command out of the subshell to release
>>> the directory.
>>>
>>> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
>>> ---
>>>  Feel free to squash this into 1/2.
>>>
>>>  t/t3310-notes-merge-manual-resolve.sh |    4 ++--
>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/t/t3310-notes-merge-manual-resolve.sh b/t/t3310-notes-merge-manual-resolve.sh
>>> index d6d6ac6..6351877 100755
>>> --- a/t/t3310-notes-merge-manual-resolve.sh
>>> +++ b/t/t3310-notes-merge-manual-resolve.sh
>>> @@ -565,9 +565,9 @@ test_expect_success 'switch cwd before committing notes merge' '
>>>        (
>>>                cd .git/NOTES_MERGE_WORKTREE &&
>>>                echo "foo" > $(git rev-parse HEAD) &&
>>> -               echo "bar" >> $(git rev-parse HEAD) &&
>>> -               git notes merge --commit
>>> +               echo "bar" >> $(git rev-parse HEAD)
>>>        ) &&
>>> +       git notes merge --commit &&
>>
>> NAK. This defeats the entire purpose of this test. The bug that we're
>> trying to solve is exactly the situation where the user has changed
>> into the .git/NOTES_MERGE_WORKTREE directory, and invokes 'git notes
>> merge --commit' from within. We need to find a different solution for
>> this on Windows. Maybe we should just abort 'git notes merge
>> --commit/--abort' if the current directory is within
>> .git/NOTES_MERGE_WORKTREE (and we're on Windows)?
>
> Isn't this an indication that something *VERY* wrong is happening? How do
> you explain to POSIX people that you have just pulled the rug unter their
> feet?
>
> $ git notes merge --commit
> $ git notes
> fatal: Unable to read current working directory: No such file or directory

True.

> I doubt that the use-case that is tested here makes sense.

As David wrote, the use case is likely to pop up among regular users.
We can't simply ignore it.

> Or .git/NOTES_MERGE_WORKTREE should not be removed. Would it be an option
> to clear it out only when it is needed, right before it is filled again?

Maybe, but then we wouldn't be able to warn or abort in the case where
there is a previous unfinished notes merge, and the user tries to
start a new notes merge. Instead, we'd silently overwrite the previous
unfinished notes merge...

Maybe it's better to simply detect if cwd is inside
.git/NOTES_MERGE_WORKTREE, and then abort, telling the user to chdir
out before trying again?


...Johan

-- 
Johan Herland, <johan@herland.net>
www.herland.net

  parent reply	other threads:[~2012-03-14 12:56 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-24  6:36 [PATCH/WIP 00/11] read_directory() rewrite to support struct pathspec Nguyễn Thái Ngọc Duy
2011-10-24  6:36 ` [PATCH/WIP 01/11] Introduce "check-attr --excluded" as a replacement for "add --ignore-missing" Nguyễn Thái Ngọc Duy
2011-10-27 18:08   ` Junio C Hamano
2011-10-28 20:51     ` Nguyen Thai Ngoc Duy
2011-10-24  6:36 ` [PATCH/WIP 02/11] notes-merge: use opendir/readdir instead of using read_directory() Nguyễn Thái Ngọc Duy
2011-10-25 19:27   ` Junio C Hamano
2011-10-26  0:08     ` Nguyen Thai Ngoc Duy
2011-10-26 17:37       ` Junio C Hamano
2011-10-27  7:51         ` Nguyen Thai Ngoc Duy
2011-10-27 17:23           ` Junio C Hamano
2011-10-28 20:47             ` Nguyen Thai Ngoc Duy
2012-03-12 14:47   ` [PATCH 1/2] t3310: Add testcase demonstrating failure to --commit from within another dir Johan Herland
2012-03-12 14:47     ` [PATCH 2/2] notes-merge: use opendir/readdir instead of using read_directory() Johan Herland
2012-03-12 14:53       ` Nguyen Thai Ngoc Duy
2012-03-14  8:39       ` [PATCH jh/notes-merge-in-git-dir-worktree] fixup! t3310 on Windows Johannes Sixt
2012-03-14 11:39         ` Johan Herland
2012-03-14 11:59           ` Johannes Sixt
2012-03-14 12:20             ` David Bremner
2012-03-14 12:56             ` Johan Herland [this message]
2012-03-14 17:44               ` Junio C Hamano
2012-03-14 23:55                 ` [PATCH 3/2] notes-merge: Don't remove .git/NOTES_MERGE_WORKTREE; it may be the user's cwd Johan Herland
2012-03-15  7:02                   ` Junio C Hamano
2012-03-15  7:16                     ` Junio C Hamano
2012-03-15  7:39                       ` Johan Herland
2012-03-15  8:04                         ` Re* " Junio C Hamano
2012-03-15  8:12                         ` Junio C Hamano
2012-03-15  8:12                   ` Johannes Sixt
2011-10-24  6:36 ` [PATCH/WIP 03/11] t5403: avoid doing "git add foo/bar" where foo/.git exists Nguyễn Thái Ngọc Duy
2011-10-25 19:19   ` Junio C Hamano
2011-10-26  0:18     ` Nguyen Thai Ngoc Duy
2011-10-26 17:26       ` Junio C Hamano
2011-10-27  8:06         ` Nguyen Thai Ngoc Duy
2011-10-27 17:41           ` Junio C Hamano
2011-10-30  5:55             ` Nguyen Thai Ngoc Duy
2011-10-30  7:08               ` Junio C Hamano
2011-10-30  9:55                 ` Nguyen Thai Ngoc Duy
2011-10-30 23:47                   ` Junio C Hamano
2011-10-24  6:36 ` [PATCH/WIP 04/11] tree-walk.c: do not leak internal structure in tree_entry_len() Nguyễn Thái Ngọc Duy
2011-10-25 19:20   ` Junio C Hamano
2011-10-24  6:36 ` [PATCH/WIP 05/11] symbolize return values of tree_entry_interesting() Nguyễn Thái Ngọc Duy
2011-10-25 19:24   ` Junio C Hamano
2011-10-27 18:36   ` Junio C Hamano
2011-10-30  9:17     ` Nguyen Thai Ngoc Duy
2011-10-24  6:36 ` [PATCH/WIP 06/11] read_directory_recursive: reduce one indentation level Nguyễn Thái Ngọc Duy
2011-10-24  6:36 ` [PATCH/WIP 07/11] tree_entry_interesting: make use of local pointer "item" Nguyễn Thái Ngọc Duy
2011-10-24  6:36 ` [PATCH/WIP 08/11] tree-walk: mark useful pathspecs Nguyễn Thái Ngọc Duy
2011-10-24  6:36 ` [PATCH/WIP 09/11] tree_entry_interesting: differentiate partial vs full match Nguyễn Thái Ngọc Duy
2011-10-24  6:36 ` [PATCH/WIP 10/11] read-dir: stop using path_simplify code in favor of tree_entry_interesting() Nguyễn Thái Ngọc Duy
2011-10-24  6:36 ` [PATCH/WIP 11/11] dir.c: remove dead code after read_directory() rewrite Nguyễn Thái Ngọc Duy
2011-10-24 17:10 ` [PATCH/WIP 00/11] read_directory() rewrite to support struct pathspec Junio C Hamano

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=CALKQrgdWZM959OyrEp+WCCehczZmMA3K8_RAcf23aAczKBCfvA@mail.gmail.com \
    --to=johan@herland.net \
    --cc=david@tethera.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j.sixt@viscovery.net \
    --cc=pclouds@gmail.com \
    /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 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 NNTP newsgroup(s).