git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phillip Wood <phillip.wood123@gmail.com>
To: Sangeeta NB <sangunb09@gmail.com>,
	Junio C Hamano <gitster@pobox.com>,
	phillip.wood@dunelm.org.uk, kaartic.sivaraam@gmail.com
Cc: git@vger.kernel.org
Subject: Re: [Outreachy] Introduction
Date: Thu, 15 Oct 2020 10:23:59 +0100	[thread overview]
Message-ID: <3c0bf417-b3d5-b615-c605-49a5d8be4e06@gmail.com> (raw)
In-Reply-To: <CAHjREB4Qw78xS-T=LA80yVf_u3=Hbpxg5tqBnP1QK44FRkBFOQ@mail.gmail.com>

Hi Sangeeta

On 14/10/2020 16:52, Sangeeta NB wrote:
> Hey everyone,
> 
> I created a PR at gitgitgadget here[1] but it is failing at three
> tests of git rm[2].  I looked at the behavior of git status at some
> other places( by pausing  'git diff HEAD with dirty
> submodule(untracked)' in t/t4027-diff-submodule.sh and looking at `git
> status` behavior)  but it was working perfectly fine(was giving what
> output was expected). But here[2] I couldn't understand why is it
> failing. Can someone please have a look at the PR and give me some
> pointers? I know I am asking way out of too much but I tried a lot on
> what could have been missing but couldn't find anything.

I've spent some time looking at it and I cannot understand what is going 
on :-( I think it may possibly be something to do with that test looking 
at a nested submodule and the options not being properly propagated down 
to that submodule - it might be worth looking at the diff code that 
handles submodules.

I've got a fixup which I'll post after this which gets rid of the global 
flag and instead uses a flag in struct diff_options. I had a quick look 
through the test changes and I thinking it would be worth considering if 
some of them should instead be changed to pass --ignore-submodules=none 
rather than changing the expected result.

Best Wishes

Phillip

> 
> [1] https://github.com/gitgitgadget/git/pull/751
> [2] https://github.com/git/git/blob/master/t/t3600-rm.sh#L691
> 
> Regards,
> Sangeeta
> 
> On Mon, Oct 12, 2020 at 9:27 PM Junio C Hamano <gitster@pobox.com> wrote:
>>
>> Sangeeta NB <sangunb09@gmail.com> writes:
>>
>>> A fix for making this as the default behaviour can be:
>>>
>>> --- a/diff.c
>>> +++ b/diff.c
>>> @@ -422,6 +422,7 @@ int git_diff_ui_config(const char *var, const char
>>> *value, void *cb)
>>>          if (git_color_config(var, value, cb) < 0)
>>>                  return -1;
>>>
>>> +       handle_ignore_submodules_arg(&default_diff_options, "untracked");
>>>          return git_diff_basic_config(var, value, cb);
>>
>> This function is called for each and every element of configuration
>> item in your ~/.gitconfig and .git/config; by definition, the
>> default behaviour is what is used when the user did not specify
>> anything so what is usually done is to do that kind of defaulting
>> before the code calls git_config() with a callback function like
>> this.
>>
>> And more importantly, the users may have
>>
>>      [diff] ignoresubmodules=<value>
>>
>> in their configuration file.  After calling handle_ignore_submodules_arg()
>> with the value the user desires, the above code will overwrite it with
>> a hardcoded default---at that point that is no longer "the default"
>> to be used when the user didn't specify.
>>
>> I am wondering if the init_diff_ui_defaults() function is the right
>> location to add the above call.
>>
>>>   }
>>>
>>> But this would also involve a lot of changes in the way tests are
>>> written as 12 out of 19 tests in t4027-diff-submodule.sh failed after
>>> adding this patch.
>>
>> If the tests expect that the -dirty suffix is added at the end of
>> "Subproject commit 2f256705..." when the submodule directory has a
>> untracked file, it is expected that such tests need to be updated
>> to the new world order you are introducing, which is "just like 'git
>> describe --dirty' does not consider having an untracked file does not
>> make otherwise clean checkout a dirty one, 'git diff' should not
>> show that a submodule is dirty in its output if its working tree has
>> an untracked file but is otherwise clean".
>>
>>
>>
>> What follows is a note for more experienced developers, but I notice
>> that over the years, we seems to have done a shoddy job adjusting
>> the implementation in diff.c file in the hope of adding support to
>> work in multiple repositories; most file-scope static globals like
>> default_diff_options and diff_detect_rename_default are still only
>> read while in the main repository, yet repo_diff_setup() pretends as
>> if an invocation of the diff machinery in a different repository can
>> use settings that are repository specific.  Again, this is not
>> something you need to be worried about.

  reply	other threads:[~2020-10-15  9:24 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-07 20:10 [Outreachy] Introduction Sangeeta NB
2020-10-08  9:07 ` Phillip Wood
2020-10-09  7:41   ` Sangeeta NB
2020-10-09 18:29     ` Phillip Wood
2020-10-11 11:30       ` Sangeeta NB
2020-10-12 10:18         ` Phillip Wood
2020-10-12 11:22         ` Kaartic Sivaraam
2020-10-12 15:57         ` Junio C Hamano
2020-10-14 15:52           ` Sangeeta NB
2020-10-15  9:23             ` Phillip Wood [this message]
2020-10-15  9:26               ` [PATCH] fixup! diff: do not show submodule with untracked files as "-dirty" Phillip Wood
2020-10-15 10:18               ` [Outreachy] Introduction Sangeeta NB
2020-10-15 13:39                 ` Phillip Wood
2020-10-15 13:57                   ` Sangeeta NB
2020-10-15 14:45                     ` Phillip Wood
2020-10-16  5:27                       ` Sangeeta NB
2020-10-16 13:26                         ` Phillip Wood
2020-10-10 11:48 Charvi Mendiratta
2020-10-11  8:09 ` Christian Couder
     [not found]   ` <CAPSFM5cXN57z56Cvq-NX1H4raS7d8=qXEFDQqpypJfoYzbxcyA@mail.gmail.com>
2020-10-15 18:56     ` Charvi Mendiratta
2020-10-15 19:16       ` Junio C Hamano
2020-10-17  8:09         ` Charvi Mendiratta
2020-10-16  8:28 Zodwa Phakathi
2020-10-16  8:46 ` Christian Couder
     [not found]   ` <CAGdqGXrLN2W_CgqfmfkCSu_hmZ9Ze8A1N9n08bgPRPApSMraSQ@mail.gmail.com>
2020-10-16 10:02     ` Christian Couder
2020-10-16 22:09 Joey S
2020-10-16 23:08 ` Jonathan Nieder
2020-10-17  0:42   ` Joey S

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=3c0bf417-b3d5-b615-c605-49a5d8be4e06@gmail.com \
    --to=phillip.wood123@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=kaartic.sivaraam@gmail.com \
    --cc=phillip.wood@dunelm.org.uk \
    --cc=sangunb09@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).