git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Denton Liu <liu.denton@gmail.com>
To: Shourya Shukla <shouryashukla.oo@gmail.com>
Cc: git@vger.kernel.org, christian.couder@gmail.com
Subject: Re: [RFC][PATCH 0/2] submodule: port 'set-url' from shell to C
Date: Mon, 27 Apr 2020 06:17:20 -0400	[thread overview]
Message-ID: <20200427101720.GA649724@generichostname> (raw)
In-Reply-To: <20200427071920.GA23846@konoha>

Hi Shourya,

On Mon, Apr 27, 2020 at 12:49:20PM +0530, Shourya Shukla wrote:
> On 20/04 04:19, Denton Liu wrote:
> > > 1. The patch fails test #2 in t7420, i.e., the test to verify the working of 'set-url'
> > >    subcommand.
> > 
> > The 'set-url' command implicitly runs sync once it is changed. I would
> > go further than what Christian suggests and just call sync_submodule()
> > (in C) at the end of module_set_url().
> 
> I have implemented this, yet running the test still gives an error. The
> function 'init_pathspec_item' in 'pathspec.c' tends to fail. Going
> further deep, the function 'prefix_path_gently' fails. I think this is
> happening because of the relative path outside the superproject for
> '../newsubmodule' and hence it throws a problem with prefixing.

I can't think of a reason why Git should be trying to do anything with
the path `../newsubmodule`. The set-url part should only write that
string into the `.gitmodules` and the sync part should only write into
`.git/config`. Neither of these steps should actually access the
submodule repo in any way.

> The exact function responsible here is 'normalize_path_copy' in
> 'path.c'.
> 
> On doing '-i -v' while running the test. The problem comes down to:
> 
> fatal: ../newsubmodule: '../newsubmodule' is outside repository at '<path>/git/t/trash directory.t7420-submodule-set-url/super'

Perhaps it's failing at the `git submodule update --remote` part? It's
hard to tell without more information. One thing you can do is try
running the test with `-x` which would enable shell tracing. This gives
even more information on the test that's running, including exactly
which command is failing.

> What exactly is wrong here and how should this problem
> and similar ones (if encountered) be approached? Do we follow
> certain procedures when debugging problems at such an intricate level?

I can't tell exactly what's wrong from the information you've provided.
Do you have link to the code you're working on? Alternatively, it might
be a good idea to post a RFC patch onto this list for wider discussion.

Some general debugging techniques that I've found helpful include

	* debug prints using fprintf(stderr, ...)

	* `-x` for test scripts (as mentioned above)

	* `debug` in test scripts (which launches GDB)

	* using `GIT_DEBUGGER=1 ./bin-wrappers/git <subcommand>` (which
	  also launches GDB)

although I'm not quite sure how applicable they are to your case. Maybe
it would be helpful for you to grab a stack trace of where the die() is
being called in GDB to understand the cause of the problem?

-Denton

> Regards,
> Shourya Shukla

      reply	other threads:[~2020-04-27 10:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-16 21:04 [RFC][PATCH 0/2] submodule: port 'set-url' from shell to C Shourya Shukla
2020-04-16 21:04 ` [PATCH 1/2] submodule.c: update URL in .gitmodules using update_url_in_gitmodules Shourya Shukla
2020-04-16 21:04 ` [PATCH 2/2] submodule: port subcommand 'set-url' from shell to C Shourya Shukla
2020-04-17 22:13   ` Christian Couder
2020-04-17 22:09 ` [RFC][PATCH 0/2] submodule: port " Christian Couder
2020-04-20  8:19 ` Denton Liu
2020-04-27  7:19   ` Shourya Shukla
2020-04-27 10:17     ` Denton Liu [this message]

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=20200427101720.GA649724@generichostname \
    --to=liu.denton@gmail.com \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=shouryashukla.oo@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).