git@vger.kernel.org mailing list mirror (one of many)
 help / Atom feed
From: Duy Nguyen <pclouds@gmail.com>
To: Stefan Beller <sbeller@google.com>
Cc: git <git@vger.kernel.org>
Subject: Re: [PATCH/RFC] add--interactive: ignore all internal submodule changes
Date: Thu, 11 Jan 2018 18:06:11 +0700
Message-ID: <CACsJy8CgzrSu7bZYQAPOK=P+CWK2vjTS3=biBBP6uZGe5ZoSMw@mail.gmail.com> (raw)
In-Reply-To: <CAGZ79kbUL6UBBB-wL+BxBdbomt+sxa66VVSYBxxBt6JVfPVfKA@mail.gmail.com>

On Thu, Jan 11, 2018 at 2:47 AM, Stefan Beller <sbeller@google.com> wrote:
> On Wed, Jan 10, 2018 at 3:06 AM, Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote:
>> For 'add -i' and 'add -p' the only action we can take on a dirty
>> submodule entry (from the superproject perspective) is its SHA-1. The
>> content changes inside do not matter, at least until interactive add has
>> --recurse-submodules or something.
>>
>> Ignore all dirty changes to reduce the questions 'add -i' and 'add -p'
>> throw at the user when submodules are dirty.
>>
>> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
>> ---
>>  $DAYJOB started to use submodules and this annoys me so much when I
>>  use 'git add -p'. I'm neither very familiar with add--interactive nor
>>  submodules code but this seems to work. Hopefully it's a correct
>>  change.
>
> I would think this fixes your problem and it looks correct.
>
> However I wonder about some subtle detail:
> the "dirty" setting will ignore anything inside the submodule, and
> only pay attention to the delta in gitlinks between HEAD and index.

Wait, why does diff-files, the command about worktree and index, look
at HEAD? Testing, testing... no I think it still works as expected

> ~/w/git/temp/z $ git ls-files  --stage foo
160000 41521690bee4b76ad108a403b79415f8591a5592 0       foo
> ~/w/git/temp/z $ git -C foo rev-parse HEAD
3bc15b2e78ec3a5c5ea27715f20adaa2669446b1
> ~/w/git/temp/z $ ../git diff --ignore-submodules=dirty foo
diff --git a/foo b/foo
index 4152169..3bc15b2 160000
--- a/foo
+++ b/foo
@@ -1 +1 @@
-Subproject commit 41521690bee4b76ad108a403b79415f8591a5592
+Subproject commit 3bc15b2e78ec3a5c5ea27715f20adaa2669446b1
> ~/w/git/temp/z $ ../git diff-files --ignore-submodules=dirty foo
:160000 160000 41521690bee4b76ad108a403b79415f8591a5592
0000000000000000000000000000000000000000 M      foo

If I reset foo/.git/HEAD back to 4152169... then diff-files
--ignore..=dirty returns empty. So I think it does check submodule's
HEAD.

> Maybe we'd want to have a mode "dirty-except-submodule-HEAD",
> which would ignore all submodule worktree changes, but if its HEAD
> is different than the gitlink in the superproject index or HEAD, such that
> checking out a different revision inside the submodule is not lost
> when staging things in the superproject for a new commit?
-- 
Duy

  reply index

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-10 11:06 Nguyễn Thái Ngọc Duy
2018-01-10 19:47 ` Stefan Beller
2018-01-11 11:06   ` Duy Nguyen [this message]
2018-01-13 12:10 ` [PATCH v2] add--interactive: ignore submodule changes except HEAD Nguyễn Thái Ngọc Duy

Reply instructions:

You may reply publically 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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to='CACsJy8CgzrSu7bZYQAPOK=P+CWK2vjTS3=biBBP6uZGe5ZoSMw@mail.gmail.com' \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=sbeller@google.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

git@vger.kernel.org mailing list mirror (one of many)

Archives are clonable:
	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.org/gmane.comp.version-control.git

 note: .onion URLs require Tor: https://www.torproject.org/
       or Tor2web: https://www.tor2web.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox